Package de.fraunhofer.aisec.cpg.passes
Class CallResolver
java.lang.Object
de.fraunhofer.aisec.cpg.passes.Pass
de.fraunhofer.aisec.cpg.passes.CallResolver
- All Implemented Interfaces:
java.util.function.Consumer<TranslationResult>
public class CallResolver extends Pass
Resolves
CallExpression and NewExpression targets.
A CallExpression specifies the method that wants to be called via Node.getName(). The call target is a method of the same class the caller belongs to,
so the name is resolved to the appropriate MethodDeclaration. This pass also takes into
consideration that a method might not be present in the current class, but rather has its
implementation in a superclass, and sets the pointer accordingly.
Constructor calls with ConstructExpression are resolved in such a way that their
ConstructExpression.getInstantiates() points to the correct RecordDeclaration.
Additionally, the ConstructExpression.getConstructor() is set to the according ConstructorDeclaration
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CallResolver() -
Method Summary
Modifier and Type Method Description voidaccept(@NonNull TranslationResult translationResult)static voidaddImplicitTemplateParametersToCall(java.util.List<de.fraunhofer.aisec.cpg.graph.Node> templateParams, de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression constructExpression)Adds implicit duplicates of the TemplateParams to the implicit ConstructExpressionvoidcleanup()Methods inherited from class de.fraunhofer.aisec.cpg.passes.Pass
getLang, setLang, supportsLanguageFrontendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.Consumer
andThen
-
Constructor Details
-
CallResolver
public CallResolver()
-
-
Method Details
-
cleanup
public void cleanup() -
accept
-
addImplicitTemplateParametersToCall
public static void addImplicitTemplateParametersToCall(java.util.List<de.fraunhofer.aisec.cpg.graph.Node> templateParams, de.fraunhofer.aisec.cpg.graph.statements.expressions.ConstructExpression constructExpression)Adds implicit duplicates of the TemplateParams to the implicit ConstructExpression- Parameters:
templateParams- of the VariableDeclaration/NewExpressionconstructExpression- duplicate TemplateParameters (implicit) to preserve AST, as ConstructExpression uses AST as well as the VariableDeclaration/NewExpression
-