Skip to content

Commit 3e03835

Browse files
committed
C++: Only create variables in FunctionIRs
The previous commit had the side effect that `IRVariable`s were created for all `Functions`, including those that did not have IR. This commit restricts all `TIRVariable` constructors to functions that have IR.
1 parent f8318ef commit 3e03835

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cpp/ql/src/semmle/code/cpp/ir/internal/TIRVariable.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ private import semmle.code.cpp.ir.implementation.raw.internal.IRConstruction as
44

55
newtype TIRVariable =
66
TIRAutomaticUserVariable(LocalScopeVariable var, Function func) {
7+
Construction::functionHasIR(func) and
78
var.getFunction() = func or
89
var.(Parameter).getCatchBlock().getEnclosingFunction() = func
910
} or
1011
TIRStaticUserVariable(Variable var, Function func) {
12+
Construction::functionHasIR(func) and
1113
(
1214
var instanceof GlobalOrNamespaceVariable or
1315
var instanceof MemberVariable and not var instanceof Field

0 commit comments

Comments
 (0)