-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[analyzer][clang-tidy][NFC] Clean up eagerly-assume handling #112209
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
Changes from all commits
ea6ab3f
fc143af
f033068
8c4ec72
5e97f6d
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 |
---|---|---|
|
@@ -299,13 +299,12 @@ ANALYZER_OPTION( | |
|
||
ANALYZER_OPTION( | ||
bool, ShouldEagerlyAssume, "eagerly-assume", | ||
"Whether we should eagerly assume evaluations of conditionals, thus, " | ||
"bifurcating the path. This indicates how the engine should handle " | ||
"expressions such as: 'x = (y != 0)'. When this is true then the " | ||
"subexpression 'y != 0' will be eagerly assumed to be true or false, thus " | ||
"evaluating it to the integers 0 or 1 respectively. The upside is that " | ||
"this can increase analysis precision until we have a better way to lazily " | ||
"evaluate such logic. The downside is that it eagerly bifurcates paths.", | ||
"If this is enabled (the default behavior), when the analyzer encounters " | ||
"a comparison operator or logical negation, it immediately splits the " | ||
steakhal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"state to separate the case when the expression is true and the case when " | ||
"it's false. The upside is that this can increase analysis precision until " | ||
"we have a better way to lazily evaluate such logic; the downside is that " | ||
"it eagerly bifurcates paths.", | ||
Comment on lines
+306
to
+307
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. I know this part of the change is only because of formatting, but here we are saying that "the downside [of eagerly bifurcating the path] is that it eagerly bifurcates paths", which has a very low information value. 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. Fair point, but I think it's still useful to highlight that bifurcating paths is a downside, not a helpful effect. 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. My problem is that it does not explain well why it is a downside, considering we have a strong claim "increases analysis precision" in the other sentence. 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.
I think in this case it's more like "the downside [of eagerly assuming the value of a bool expression] is that it eagerly bifurcates paths"
I think in this case the why is that "it eagerly bifurcates paths". 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.
I do not think there is a significant difference here, because the help text, as it stands now, immediately tries to explain what a "bifurcation" is (which one may or may not understand that this is actually the definition of that term) by saying "splits the state to separate […] true and […] false". So we say that turning this option on will cause bifurcation…
…and then go on and say that the bifurcation (which is the only immediate effect of turning this option on) is a downside. That still does not explain to me why this would be a problem, and what trade-offs I am making when the benefit is the increased precision. Will it cause more CPU use? Will it make the analysis run longer? Or, conversely, will it actually make it run shorter? There is this claim about a behavioural change with no mentions of the actual observeable difference. And, remember, these documentation tidbits exist for the user, as it is dumped with the |
||
true) | ||
|
||
ANALYZER_OPTION( | ||
|
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.
Is this a functionality loss from Tidy's perspective? AFAIK, there is no way to set CSA analyser engine options when invoked through Tidy.
Uh oh!
There was an error while loading. Please reload this page.
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.
Clang-Tidy can set CSA options, I recently added support for it for
--verify-config
in #109523, where I had checked which syntax it has, and if the syntax worked beforehand.E.g.:
clang-analyzer-optin.cplusplus.UninitializedObject:Pedantic: true
Uh oh!
There was an error while loading. Please reload this page.
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.
No, this is not functionality loss from Tidy's perspective, because this data member is dead, its value doesn't influence anything. The
eagerly-assume
feature is controlled by a different data memberAnalyzerOptions.ShouldEagerlyAssume
(which is true by default).