pass `TokenList` as reference into `ValueFlow::setValues()` (#4868)
This avoid lots of unchecked pointer dereferences. There was a single case which checked it and that looked like a leftover. The only way this might have been a `nullptr` pointer was through several default constructors which were not used at all so I removed them.
This commit is contained in:
parent
b2511fb3ae
commit
77c479a6c4
|
@ -544,7 +544,7 @@ unsigned int CppCheck::check(const std::string &path)
|
|||
Tokenizer tokenizer(&mSettings, this);
|
||||
tokenizer.list.appendFileIfNew(path);
|
||||
clangimport::parseClangAstDump(&tokenizer, ast);
|
||||
ValueFlow::setValues(&tokenizer.list,
|
||||
ValueFlow::setValues(tokenizer.list,
|
||||
const_cast<SymbolDatabase*>(tokenizer.getSymbolDatabase()),
|
||||
this,
|
||||
&mSettings,
|
||||
|
|
|
@ -3361,9 +3361,9 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration)
|
|||
if (doValueFlow) {
|
||||
if (mTimerResults) {
|
||||
Timer t("Tokenizer::simplifyTokens1::ValueFlow", mSettings->showtime, mTimerResults);
|
||||
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings, mTimerResults);
|
||||
ValueFlow::setValues(list, mSymbolDatabase, mErrorLogger, mSettings, mTimerResults);
|
||||
} else {
|
||||
ValueFlow::setValues(&list, mSymbolDatabase, mErrorLogger, mSettings, mTimerResults);
|
||||
ValueFlow::setValues(list, mSymbolDatabase, mErrorLogger, mSettings, mTimerResults);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -51,7 +51,7 @@ namespace ValueFlow {
|
|||
const Value * valueFlowConstantFoldAST(Token *expr, const Settings *settings);
|
||||
|
||||
/// Perform valueflow analysis.
|
||||
void setValues(TokenList* tokenlist,
|
||||
void setValues(TokenList& tokenlist,
|
||||
SymbolDatabase* symboldatabase,
|
||||
ErrorLogger* errorLogger,
|
||||
const Settings* settings,
|
||||
|
|
Loading…
Reference in New Issue