Improve --debug-warnings output for 'auto' tokens without type. Do not report that prematurely before the type is set properly.
This commit is contained in:
parent
20278d9c92
commit
ebcca4edd1
|
@ -59,7 +59,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
createSymbolDatabaseVariableSymbolTable();
|
||||
createSymbolDatabaseSetScopePointers();
|
||||
createSymbolDatabaseSetVariablePointers();
|
||||
setValueTypeInTokenList();
|
||||
setValueTypeInTokenList(false);
|
||||
createSymbolDatabaseSetFunctionPointers(true);
|
||||
createSymbolDatabaseSetTypePointers();
|
||||
createSymbolDatabaseEnums();
|
||||
|
@ -5395,7 +5395,7 @@ static const Function *getOperatorFunction(const Token * const tok)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void SymbolDatabase::setValueTypeInTokenList()
|
||||
void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings)
|
||||
{
|
||||
Token * tokens = const_cast<Tokenizer *>(mTokenizer)->list.front();
|
||||
|
||||
|
@ -5605,7 +5605,7 @@ void SymbolDatabase::setValueTypeInTokenList()
|
|||
}
|
||||
}
|
||||
|
||||
if (mSettings->debugwarnings) {
|
||||
if (reportDebugWarnings && mSettings->debugwarnings) {
|
||||
for (Token *tok = tokens; tok; tok = tok->next()) {
|
||||
if (tok->str() == "auto" && !tok->valueType())
|
||||
debugMessage(tok, "auto token with no type.");
|
||||
|
|
|
@ -1238,7 +1238,7 @@ public:
|
|||
void validateVariables() const;
|
||||
|
||||
/** Set valuetype in provided tokenlist */
|
||||
void setValueTypeInTokenList();
|
||||
void setValueTypeInTokenList(bool reportDebugWarnings);
|
||||
|
||||
/**
|
||||
* Calculates sizeof value for given type.
|
||||
|
|
|
@ -2315,9 +2315,9 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
|
|||
|
||||
if (mTimerResults) {
|
||||
Timer t("Tokenizer::simplifyTokens1::setValueType", mSettings->showtime, mTimerResults);
|
||||
mSymbolDatabase->setValueTypeInTokenList();
|
||||
mSymbolDatabase->setValueTypeInTokenList(true);
|
||||
} else {
|
||||
mSymbolDatabase->setValueTypeInTokenList();
|
||||
mSymbolDatabase->setValueTypeInTokenList(true);
|
||||
}
|
||||
|
||||
if (mTimerResults) {
|
||||
|
@ -4762,7 +4762,7 @@ bool Tokenizer::simplifyTokenList2()
|
|||
|
||||
// Create symbol database and then remove const keywords
|
||||
createSymbolDatabase();
|
||||
mSymbolDatabase->setValueTypeInTokenList();
|
||||
mSymbolDatabase->setValueTypeInTokenList(true);
|
||||
|
||||
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings);
|
||||
|
||||
|
|
Loading…
Reference in New Issue