GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — added (optional) lazy execution of ValueFlow by firewave · Pull Request #4521 · cppcheck-opensource/cppcheck Conversation
firewave
force-pushed
the
vf
branch
3 times, most recently
from
2b93752 to
07ba92f
Compare
pfultz2
reviewed
Collaborator
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. These two variables can be moved into the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
| const ValueFlow::Value* Token::getContainerSizeValue(const MathLib::bigint val) const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I kept it to avoid the function calls (which obviously won't do much) since some of these might be called loooooots of times. I haven't profiled any of this yet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I would not call it "redundant" but "unnecessary". Still needs to be profiled.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const ValueFlow::Value* Token::getMovedValue() const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const ValueFlow::Value* Token::getMaxValue(bool condition, MathLib::bigint path) const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const ValueFlow::Value* Token::getValue(const MathLib::bigint val) const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return false; | ||
| return mImpl->mValues && | ||
| std::any_of(mImpl->mValues->begin(), mImpl->mValues->end(), [&](const ValueFlow::Value& value) { | ||
| return !values().empty() && |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| bool Token::hasKnownValue() const | ||
| { | ||
| return mImpl->mValues && std::any_of(mImpl->mValues->begin(), mImpl->mValues->end(), std::mem_fn(&ValueFlow::Value::isKnown)); | ||
| return !values().empty() && std::any_of(values().begin(), values().end(), std::mem_fn(&ValueFlow::Value::isKnown)); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| bool Token::hasKnownIntValue() const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const Token *Token::getValueTokenMaxStrLength() const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const Token *Token::getValueTokenMinStrSize(const Settings *settings, MathLib::bigint* path) const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, nonneg int argnr, const Settings *settings) const | ||
| { | ||
| if (!mImpl->mValues || !settings) | ||
| if (values().empty() || !settings) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const ValueFlow::Value * Token::getValueGE(const MathLib::bigint val, const Settings *settings) const | ||
| { | ||
| if (!mImpl->mValues) | ||
| if (values().empty()) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
values().empty() is redundant here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I think its a lot cleaner to use |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That was my takeaway as well after I "cracked" this and saw only one method needs to access the raw pointers - which is quite nice. I will extract the encapsulation and cleanup parts of this into a separate PR but it still needs some work (see below).
I am aware of that. I already fixed up a few mistakes I made in earlier revisions. But it is still very much WIP... I still have to profile this with valueflow enabled and disabled. Also the lazy execution doesn't save anything at all. There's also some tests failing with the lazy execution. But I guess they just lack the lazy execution hook. Still it is interesting and maybe we should make valueflow more explicit in tests so we know what depends on it. It might also help with determining how to increase the test coverage. But I haven't looked into this at all. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This should "help" (as in executing less code) with tests which use the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I will try to pull out the wrapper function for values so this can finally progress. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I filed https://trac.cppcheck.net/ticket/14243 about this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.