-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
C++: Support if consteval
and if ! consteval
#18502
base: main
Are you sure you want to change the base?
Conversation
c4673e1
to
f70bf5b
Compare
p1.nodeAt(n1, s) and | ||
p2.nodeBefore(n2, s.getThen()) | ||
or | ||
p1.nodeAt(n1, s) and | ||
p2.nodeBefore(n2, s.getElse()) |
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.
Here we allow both branches of the consteval if to be reached.
TranslatedStmt getEvaluatedBranch() { | ||
result = getTranslatedStmt(stmt.getRuntimeEvaluatedBranch()) | ||
} |
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.
We pick a single branch that can be reached. For now this is the branch that is taken at runtime, we can change this later if we see that using the compile time branch improves analysis quality.
from Stmt stmt, int kind, int kind_new, Location location | ||
where | ||
stmts(stmt, kind, location) and | ||
if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statement in it |
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.
if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statement in it | |
if isConstevalIf(stmt) then kind_new = 7 else kind_new = kind // Turns consteval if into a block with two block statements in it |
Pull Request checklist
All query authors
.qhelp
. See the documentation in this repository.Internal query authors only
.ql
,.qll
, or.qhelp
files. See the documentation (internal access required).