C++: Extend getFunction to handle orphaned local variables

This commit is contained in:
Jeroen Ketema
2022-08-19 15:22:30 +02:00
parent 3b81f4860e
commit 309fecac92

View File

@@ -398,6 +398,8 @@ class LocalVariable extends LocalScopeVariable, @localvariable {
exists(DeclStmt s | s.getADeclaration() = this and s.getEnclosingFunction() = result)
or
exists(ConditionDeclExpr e | e.getVariable() = this and e.getEnclosingFunction() = result)
or
orphaned_variables(underlyingElement(this), unresolveElement(result))
}
}