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(), "[;{}]")))
|
||||
continue;
|
||||
|
||||
_errorLogger->ReportProgress("CheckBufferOverrun::checkGlobalAndLocalVariable", tok);
|
||||
_errorLogger->ReportProgress("CheckBufferOverrun::checkGlobalAndLocalVariable");
|
||||
|
||||
ArrayInfo arrayInfo;
|
||||
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)
|
||||
{
|
||||
|
@ -242,7 +242,7 @@ void ErrorLogger::ReportProgress(const char func[], const Token * const tok)
|
|||
}
|
||||
|
||||
const std::time_t time2 = std::time(NULL);
|
||||
if (time2 >= (time1 + 60))
|
||||
if (time2 >= (time1 + 10))
|
||||
{
|
||||
time1 = time2;
|
||||
|
||||
|
@ -253,8 +253,7 @@ void ErrorLogger::ReportProgress(const char func[], const Token * const tok)
|
|||
std::ostringstream ostr;
|
||||
ostr << "progress:"
|
||||
<< " time=" << str.substr(11, 8)
|
||||
<< " function=" << func
|
||||
<< " parsed-line=" << tok->linenr();
|
||||
<< " function=" << func;
|
||||
|
||||
// Report progress message
|
||||
reportOut(ostr.str());
|
||||
|
|
|
@ -176,9 +176,8 @@ public:
|
|||
* Report progress.
|
||||
*
|
||||
* @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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
if (_errorLogger)
|
||||
_errorLogger->ReportProgress(0);
|
||||
|
||||
std::list<std::string> ret;
|
||||
ret.push_back("");
|
||||
|
||||
|
@ -697,6 +700,9 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
|||
{
|
||||
++linenr;
|
||||
|
||||
if (_errorLogger)
|
||||
_errorLogger->ReportProgress("Preprocessor::getcfgs");
|
||||
|
||||
if (line.compare(0, 6, "#file ") == 0)
|
||||
{
|
||||
includeguard = true;
|
||||
|
@ -851,6 +857,9 @@ std::list<std::string> Preprocessor::getcfgs(const std::string &filedata, const
|
|||
// Remove defined constants from ifdef configurations..
|
||||
for (std::list<std::string>::iterator it = ret.begin(); it != ret.end(); ++it)
|
||||
{
|
||||
if (_errorLogger)
|
||||
_errorLogger->ReportProgress("Preprocessor::getcfgs");
|
||||
|
||||
std::string cfg(*it);
|
||||
for (std::set<std::string>::const_iterator it2 = defines.begin(); it2 != defines.end(); ++it2)
|
||||
{
|
||||
|
|
|
@ -650,6 +650,9 @@ void Tokenizer::simplifyTypedef()
|
|||
bool hasClass = false;
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
if (_errorLogger)
|
||||
_errorLogger->ReportProgress("Tokenizer::simplifyTypedef");
|
||||
|
||||
if (Token::Match(tok, "class|struct|namespace %any%"))
|
||||
{
|
||||
isNamespace = (tok->str() == "namespace");
|
||||
|
@ -1649,7 +1652,7 @@ void Tokenizer::simplifyTypedef()
|
|||
bool Tokenizer::tokenize(std::istream &code, const char FileName[], const std::string &configuration)
|
||||
{
|
||||
if (_errorLogger)
|
||||
_errorLogger->ReportProgress(0, 0);
|
||||
_errorLogger->ReportProgress(0);
|
||||
|
||||
_configuration = configuration;
|
||||
|
||||
|
@ -2678,7 +2681,7 @@ void Tokenizer::setVarId()
|
|||
continue;
|
||||
|
||||
if (_errorLogger)
|
||||
_errorLogger->ReportProgress(__FUNCTION__, tok);
|
||||
_errorLogger->ReportProgress("Tokenizer::setVarId");
|
||||
|
||||
// If pattern is "( %type% *|& %var% )" then check if it's a
|
||||
// variable declaration or a multiplication / mask
|
||||
|
|
Loading…
Reference in New Issue