File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -62,12 +62,20 @@ private predicate ignoreConstantValue(Operation op) {
6262 op instanceof BitwiseXorExpr
6363}
6464
65+ /** Holds if `expr` contains an address-of expression that EDG may have constant-folded. */
66+ private predicate containsAddressOf ( Expr expr ) {
67+ expr instanceof AddressOfExpr
68+ or
69+ containsAddressOf ( expr .getAChild ( ) )
70+ }
71+
6572/**
6673 * Holds if `expr` is a constant of a type that can be replaced directly with
6774 * its value in the IR. This does not include address constants as we have no
6875 * means to express those as QL values.
6976 */
7077predicate isIRConstant ( Expr expr ) {
78+ not containsAddressOf ( expr ) and
7179 exists ( expr .getValue ( ) ) and
7280 // We avoid constant folding certain operations since it's often useful to
7381 // mark one of those as a source in dataflow, and if the operation is
You can’t perform that action at this time.
0 commit comments