programmemory.cpp: avoid repeated iteration over values in Executor::executeImpl()#6701
programmemory.cpp: avoid repeated iteration over values in Executor::executeImpl()#6701firewave wants to merge 2 commits intocppcheck-opensource:mainfrom
Executor::executeImpl()#6701Conversation
|
Clang 17 The example from https://trac.cppcheck.net/ticket/10765#comment:4: Clang 17 |
|
@pfultz2 Is this a valid change? The previous code had priority which value type have been taken which is no longer the case in the new code. Tests are still passing and I also added an else to break into and that was never hit so it seems like this change should be fine. |
|
Tokens can have more than one known value, but its not very common. |
| } | ||
| default: | ||
| break; | ||
| } |
There was a problem hiding this comment.
I think it would be better to make this a function that returns a pointer to the value. Then we can just write if((const ValueFlow::Value* value = findKnownValue(expr->values()))) here.
There was a problem hiding this comment.
Makes sense.
But then we would need to exclude the INT handling since that currently has priority and a different handling.
So the priority of fetching the type is important? What is such a case? We should add a unit test for that (if there isn't one already). |
|
Requires #7181 to be merged first. There are multiple known values. |
No description provided.