diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Assignment.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Assignment.qll index f30c9ec8d67..56ec87b23f2 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/Assignment.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/Assignment.qll @@ -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 diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll index 1e4b52283fc..4bf21a43f63 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll @@ -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()) } }