-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueFlow: pass ErrorLogger
by reference into ValueFlow::setValues()
/ removed need for LifetimeStore::Context
#5299
Changes from all commits
d6e12b8
4595196
e27d171
eef052c
76a459a
c8de69b
92cbc6c
127d361
589d6f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1149,7 +1149,7 @@ void Tokenizer::simplifyTypedefCpp() | |
return; | ||
|
||
if (maxTime > 0 && std::time(nullptr) > maxTime) { | ||
if (mSettings.debugwarnings) { | ||
if (mErrorLogger && mSettings.debugwarnings) { | ||
ErrorMessage::FileLocation loc(list.getFiles()[0], 0, 0); | ||
ErrorMessage errmsg({std::move(loc)}, | ||
emptyString, | ||
|
@@ -3407,11 +3407,12 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration) | |
const bool doValueFlow = !disableValueflowEnv || (std::strcmp(disableValueflowEnv, "1") != 0); | ||
|
||
if (doValueFlow) { | ||
assert(mErrorLogger); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After the change in |
||
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); | ||
} | ||
|
||
arraySizeAfterValueFlow(); | ||
|
@@ -3439,6 +3440,7 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration) | |
return true; | ||
} | ||
|
||
// cppcheck-suppress unusedFunction - used in tests only | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was surprising but it actually foreshadows the cleanup I am planning to make. |
||
bool Tokenizer::tokenize(std::istream &code, | ||
const char FileName[], | ||
const std::string &configuration) | ||
|
@@ -6070,7 +6072,8 @@ void Tokenizer::dump(std::ostream &out) const | |
out << outs; | ||
outs.clear(); | ||
|
||
mSymbolDatabase->printXml(out); | ||
if (mSymbolDatabase) | ||
mSymbolDatabase->printXml(out); | ||
|
||
containers.erase(nullptr); | ||
if (!containers.empty()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the class not assignable. This should be a pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That ship has already sailed - some one line above.
I will take a look at adding that clang-tidy check about this (there was a case of false positives which I am not sure is fixed yet) and there's also #4785 and some discussions which related to that (which apparently are not linked).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI There also would be a compiler error if we would actually try to assign those types. I ran into this issue while working on it. So it is not a silent failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I encountered the first issue we have with this in some other changes. I will try to figure out how to properly handle it so it can be easily be applied in the future. Nothing to do here though since this doesn't change anything as we were using references before.