Skip to content

Commit 309feca

Browse files
committed
C++: Extend getFunction to handle orphaned local variables
1 parent 3b81f48 commit 309feca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cpp/ql/lib/semmle/code/cpp/Variable.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ class LocalVariable extends LocalScopeVariable, @localvariable {
398398
exists(DeclStmt s | s.getADeclaration() = this and s.getEnclosingFunction() = result)
399399
or
400400
exists(ConditionDeclExpr e | e.getVariable() = this and e.getEnclosingFunction() = result)
401+
or
402+
orphaned_variables(underlyingElement(this), unresolveElement(result))
401403
}
402404
}
403405

0 commit comments

Comments
 (0)