Class VariableUsageResolver
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.passes.VariableUsageResolver
-
- All Implemented Interfaces:
Pass,java.util.function.Consumer<TranslationResult>
public class VariableUsageResolver extends java.lang.Object implements Pass
Creates new connections between the place where a variable is declared and where it is used.A field access is modeled with a
MemberExpression. After AST building, its base and member references are set toDeclaredReferenceExpressionstubs. This pass resolves those references and makes the member point to the appropriateFieldDeclarationand the base to the "this"FieldDeclarationof the containing class. It is also capable of resolving references to fields that are inherited from a superclass and thus not declared in the actual base class. When base or member declarations are not found in the graph, a new "dummy"FieldDeclarationis being created that is then used to collect all usages to the same unknown declaration.DeclaredReferenceExpressionstubs are removed from the graph after being resolved.A local variable access is modeled directly with a
DeclaredReferenceExpression. This step of the pass doesn't remove theDeclaredReferenceExpressionnodes like in the field usage case but rather makes their "refersTo" point to the appropriateValueDeclaration.
-
-
Constructor Summary
Constructors Constructor Description VariableUsageResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(TranslationResult result)voidcleanup()LanguageFrontendgetLang()We do not want the passes to depend on a language frontendvoidsetLang(LanguageFrontend lang)We do not want the passes to depend on a language frontend-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.fraunhofer.aisec.cpg.passes.Pass
createUnknownTranslationUnit
-
-
-
-
Method Detail
-
getLang
public LanguageFrontend getLang()
Description copied from interface:PassWe do not want the passes to depend on a language frontend
-
setLang
public void setLang(LanguageFrontend lang)
Description copied from interface:PassWe do not want the passes to depend on a language frontend
-
accept
public void accept(TranslationResult result)
- Specified by:
acceptin interfacejava.util.function.Consumer<TranslationResult>
-
-