Refactoring: Report progress when checking takes a long time. Ticket: #1868
This commit is contained in:
parent
786ca037ec
commit
e358af9018
|
@ -980,7 +980,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
|
||||||
if (tok->previous() && (!tok->previous()->isName() && !Token::Match(tok->previous(), "[;{}]")))
|
if (tok->previous() && (!tok->previous()->isName() && !Token::Match(tok->previous(), "[;{}]")))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_errorLogger->ReportProgress("CheckBufferOverrun::checkGlobalAndLocalVariable", tok);
|
_errorLogger->ReportProgress("CheckBufferOverrun::checkGlobalAndLocalVariable");
|
||||||
|
|
||||||
ArrayInfo arrayInfo;
|
ArrayInfo arrayInfo;
|
||||||
if (arrayInfo.declare(tok, *_tokenizer))
|
if (arrayInfo.declare(tok, *_tokenizer))
|
||||||
|
|
|
@ -233,7 +233,7 @@ void ErrorLogger::ErrorMessage::FileLocation::setfile(const std::string &file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ErrorLogger::ReportProgress(const char func[], const Token * const tok)
|
void ErrorLogger::ReportProgress(const char func[])
|
||||||
{
|
{
|
||||||
if (!func)
|
if (!func)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +242,7 @@ void ErrorLogger::ReportProgress(const char func[], const Token * const tok)
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::time_t time2 = std::time(NULL);
|
const std::time_t time2 = std::time(NULL);
|
||||||
if (time2 >= (time1 + 60))
|
if (time2 >= (time1 + 10))
|
||||||
{
|
{
|
||||||
time1 = time2;
|
time1 = time2;
|
||||||
|
|
||||||
|
@ -253,8 +253,7 @@ void ErrorLogger::ReportProgress(const char func[], const Token * const tok)
|
||||||
std::ostringstream ostr;
|
std::ostringstream ostr;
|
||||||
ostr << "progress:"
|
ostr << "progress:"
|
||||||
<< " time=" << str.substr(11, 8)
|
<< " time=" << str.substr(11, 8)
|
||||||
<< " function=" << func
|
<< " function=" << func;
|
||||||
<< " parsed-line=" << tok->linenr();
|
|
||||||
|
|
||||||
// Report progress message
|
// Report progress message
|
||||||
reportOut(ostr.str());
|
reportOut(ostr.str());
|
||||||
|
|
|
@ -176,9 +176,8 @@ public:
|
||||||
* Report progress.
|
* Report progress.
|
||||||
*
|
*
|
||||||
* @param func function name (NULL = start command)
|
* @param func function name (NULL = start command)
|
||||||
* @param tok current token
|
|
||||||
*/
|
*/
|
||||||
void ReportProgress(const char func[], const Token * const tok);
|
void ReportProgress(const char func[]);
|
||||||
|
|
||||||
static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);
|
static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);
|
||||||
|
|
||||||
|
|
|
@ -676,6 +676,9 @@ std::string Preprocessor::getdef(std::string line, bool def)
|
||||||
|
|
||||||
std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const std::string &filename)
|
std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const std::string &filename)
|
||||||
{
|
{
|
||||||
|
if (_errorLogger)
|
||||||
|
_errorLogger->ReportProgress(0);
|
||||||
|
|
||||||
std::list<std::string> ret;
|
std::list<std::string> ret;
|
||||||
ret.push_back("");
|
ret.push_back("");
|
||||||
|
|
||||||
|
@ -697,6 +700,9 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
||||||
{
|
{
|
||||||
++linenr;
|
++linenr;
|
||||||
|
|
||||||
|
if (_errorLogger)
|
||||||
|
_errorLogger->ReportProgress("Preprocessor::getcfgs");
|
||||||
|
|
||||||
if (line.compare(0, 6, "#file ") == 0)
|
if (line.compare(0, 6, "#file ") == 0)
|
||||||
{
|
{
|
||||||
includeguard = true;
|
includeguard = true;
|
||||||
|
@ -851,6 +857,9 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
||||||
// Remove defined constants from ifdef configurations..
|
// Remove defined constants from ifdef configurations..
|
||||||
for (std::list<std::string>::iterator it = ret.begin(); it != ret.end(); ++it)
|
for (std::list<std::string>::iterator it = ret.begin(); it != ret.end(); ++it)
|
||||||
{
|
{
|
||||||
|
if (_errorLogger)
|
||||||
|
_errorLogger->ReportProgress("Preprocessor::getcfgs");
|
||||||
|
|
||||||
std::string cfg(*it);
|
std::string cfg(*it);
|
||||||
for (std::set<std::string>::const_iterator it2 = defines.begin(); it2 != defines.end(); ++it2)
|
for (std::set<std::string>::const_iterator it2 = defines.begin(); it2 != defines.end(); ++it2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -650,6 +650,9 @@ void Tokenizer::simplifyTypedef()
|
||||||
bool hasClass = false;
|
bool hasClass = false;
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
|
if (_errorLogger)
|
||||||
|
_errorLogger->ReportProgress("Tokenizer::simplifyTypedef");
|
||||||
|
|
||||||
if (Token::Match(tok, "class|struct|namespace %any%"))
|
if (Token::Match(tok, "class|struct|namespace %any%"))
|
||||||
{
|
{
|
||||||
isNamespace = (tok->str() == "namespace");
|
isNamespace = (tok->str() == "namespace");
|
||||||
|
@ -1649,7 +1652,7 @@ void Tokenizer::simplifyTypedef()
|
||||||
bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string &configuration)
|
bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string &configuration)
|
||||||
{
|
{
|
||||||
if (_errorLogger)
|
if (_errorLogger)
|
||||||
_errorLogger->ReportProgress(0, 0);
|
_errorLogger->ReportProgress(0);
|
||||||
|
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
|
||||||
|
@ -2678,7 +2681,7 @@ void Tokenizer::setVarId()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_errorLogger)
|
if (_errorLogger)
|
||||||
_errorLogger->ReportProgress(__FUNCTION__, tok);
|
_errorLogger->ReportProgress("Tokenizer::setVarId");
|
||||||
|
|
||||||
// If pattern is "( %type% *|& %var% )" then check if it's a
|
// If pattern is "( %type% *|& %var% )" then check if it's a
|
||||||
// variable declaration or a multiplication / mask
|
// variable declaration or a multiplication / mask
|
||||||
|
|
Loading…
Reference in New Issue