mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C++: Add a predicate for getting the 0'th child of a 'ConditionDeclExpr' without casting it to a 'VariableAccess' and use it in IR generation.
This commit is contained in:
@@ -244,9 +244,15 @@ class ConditionDeclExpr extends Expr, @condition_decl {
|
||||
|
||||
/**
|
||||
* Gets the compiler-generated variable access that conceptually occurs after
|
||||
* the initialization of the declared variable.
|
||||
* the initialization of the declared variable, if any.
|
||||
*/
|
||||
VariableAccess getVariableAccess() { result = this.getChild(0) }
|
||||
VariableAccess getVariableAccess() { result = this.getExpr() }
|
||||
|
||||
/**
|
||||
* Gets the expression that is evaluated after the initialization of the declared
|
||||
* variable.
|
||||
*/
|
||||
Expr getExpr() { result = this.getChild(0) }
|
||||
|
||||
/**
|
||||
* Gets the expression that initializes the declared variable. This predicate
|
||||
|
||||
@@ -3173,7 +3173,7 @@ class TranslatedConditionDeclExpr extends TranslatedNonConstantExpr {
|
||||
private TranslatedConditionDecl getDecl() { result = getTranslatedConditionDecl(expr) }
|
||||
|
||||
private TranslatedExpr getConditionExpr() {
|
||||
result = getTranslatedExpr(expr.getVariableAccess().getFullyConverted())
|
||||
result = getTranslatedExpr(expr.getExpr().getFullyConverted())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user