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.
This commit is contained in:
Jonas Jensen
2019-02-04 19:34:16 +01:00
parent f8318ef96f
commit 3e03835630

View File

@@ -4,10 +4,12 @@ private import semmle.code.cpp.ir.implementation.raw.internal.IRConstruction as
newtype TIRVariable =
TIRAutomaticUserVariable(LocalScopeVariable var, Function func) {
Construction::functionHasIR(func) and
var.getFunction() = func or
var.(Parameter).getCatchBlock().getEnclosingFunction() = func
} or
TIRStaticUserVariable(Variable var, Function func) {
Construction::functionHasIR(func) and
(
var instanceof GlobalOrNamespaceVariable or
var instanceof MemberVariable and not var instanceof Field