diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/VariableDeclaration.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/VariableDeclaration.kt index c6e7b5b982..964ec5abc3 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/VariableDeclaration.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/VariableDeclaration.kt @@ -26,6 +26,7 @@ package de.fraunhofer.aisec.cpg.graph.declarations import de.fraunhofer.aisec.cpg.graph.* +import de.fraunhofer.aisec.cpg.graph.scopes.GlobalScope import de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression import de.fraunhofer.aisec.cpg.graph.statements.expressions.Expression import de.fraunhofer.aisec.cpg.graph.statements.expressions.Reference @@ -50,6 +51,10 @@ open class VariableDeclaration : ValueDeclaration(), HasInitializer, HasType.Typ @AST var templateParameters: List? = null + /** Determines if this is a global variable. */ + val isGlobal: Boolean + get() = this.scope is GlobalScope + /** * C++ uses implicit constructor calls for statements like `A a;` but this only applies to types * that are actually classes and not just primitive types or typedef aliases of primitives.