Class Pass

java.lang.Object
de.fraunhofer.aisec.cpg.passes.Pass
All Implemented Interfaces:
java.util.function.Consumer<TranslationResult>
Direct Known Subclasses:
CallResolver, ControlFlowSensitiveDFGPass, EvaluationOrderGraphPass, FilenameMapper, ImportResolver, JavaExternalTypeHierarchyResolver, TypeHierarchyResolver, TypeResolver, VariableUsageResolver

public abstract class Pass
extends java.lang.Object
implements java.util.function.Consumer<TranslationResult>
Represents an abstract class that enhances the graph before it is persisted.

Passes are expected to mutate the TranslationResult.

  • Field Summary

    Fields
    Modifier and Type Field Description
    protected @Nullable LanguageFrontend lang  
    protected static org.slf4j.Logger log  
  • Constructor Summary

    Constructors
    Constructor Description
    Pass()  
  • Method Summary

    Modifier and Type Method Description
    abstract void cleanup()  
    @Nullable LanguageFrontend getLang()  
    void setLang​(@Nullable LanguageFrontend lang)
    Passes may need information about what source language they are parsing.
    boolean supportsLanguageFrontend​(LanguageFrontend lang)
    Specifies, whether this pass supports this particular language frontend.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Consumer

    accept, andThen
  • Field Details

    • log

      protected static final org.slf4j.Logger log
    • lang

      protected @Nullable LanguageFrontend lang
  • Constructor Details

    • Pass

      public Pass()
  • Method Details

    • getLang

      public @Nullable LanguageFrontend getLang()
      Returns:
      May be null
    • setLang

      public void setLang​(@Nullable LanguageFrontend lang)
      Passes may need information about what source language they are parsing.
      Parameters:
      lang - May be null
    • cleanup

      public abstract void cleanup()
    • supportsLanguageFrontend

      public boolean supportsLanguageFrontend​(LanguageFrontend lang)
      Specifies, whether this pass supports this particular language frontend. This defaults to true and needs to be overridden if a different behaviour is wanted.

      Note: this is not yet used, since we do not have an easy way at the moment to find out which language frontend a result used.

      Parameters:
      lang - the language frontend
      Returns:
      true by default