Class TranslationResult

java.lang.Object
de.fraunhofer.aisec.cpg.graph.Node
de.fraunhofer.aisec.cpg.TranslationResult
All Implemented Interfaces:
Persistable, de.fraunhofer.aisec.cpg.helpers.StatisticsHolder, IVisitable<de.fraunhofer.aisec.cpg.graph.Node>

public class TranslationResult
extends de.fraunhofer.aisec.cpg.graph.Node
implements de.fraunhofer.aisec.cpg.helpers.StatisticsHolder
The global (intermediate) result of the translation. A LanguageFrontend will initially populate it and a Pass can extend it.
  • Nested Class Summary

    Nested classes/interfaces inherited from class de.fraunhofer.aisec.cpg.graph.Node

    de.fraunhofer.aisec.cpg.graph.Node.Companion

    Nested classes/interfaces inherited from interface de.fraunhofer.aisec.cpg.helpers.StatisticsHolder

    de.fraunhofer.aisec.cpg.helpers.StatisticsHolder.DefaultImpls
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String SOURCE_LOCATIONS_TO_FRONTEND  

    Fields inherited from class de.fraunhofer.aisec.cpg.graph.Node

    Companion, EMPTY_NAME, TO_STRING_STYLE
  • Constructor Summary

    Constructors
    Constructor Description
    TranslationResult​(de.fraunhofer.aisec.cpg.TranslationManager translationManager)  
  • Method Summary

    Modifier and Type Method Description
    void addBenchmark​(de.fraunhofer.aisec.cpg.helpers.MeasurementHolder b)  
    void addComponent​(de.fraunhofer.aisec.cpg.graph.Component sc)
    Add a Component to this translation result in a thread safe way.
    void addTranslationUnit​(TranslationUnitDeclaration tu)
    Deprecated.
    This should not be used anymore.
    java.util.Set<de.fraunhofer.aisec.cpg.graph.Node> getAdditionalNodes()  
    de.fraunhofer.aisec.cpg.helpers.BenchmarkResults getBenchmarkResults()  
    java.util.List<de.fraunhofer.aisec.cpg.helpers.MeasurementHolder> getBenchmarks()  
    java.util.List<de.fraunhofer.aisec.cpg.graph.Component> getComponents()
    List of software components.
    TranslationConfiguration getConfig()  
    java.util.Map<java.lang.String,​java.lang.Object> getScratch()
    Scratch storage that can be used by passes to store additional information in this result.
    java.util.List<java.lang.String> getTranslatedFiles()  
    de.fraunhofer.aisec.cpg.TranslationManager getTranslationManager()  
    java.util.List<TranslationUnitDeclaration> getTranslationUnits()
    Checks if only a single software component has been analyzed and returns its translation units.
    boolean isCancelled()  

    Methods inherited from class de.fraunhofer.aisec.cpg.graph.Node

    addAnnotations, addNextDFG, addNextEOG, addPrevDFG, addPrevEOG, addTypedef, clearNextEOG, disconnectFromGraph, equals, getAnnotations, getArgumentIndex, getAstChildren, getCode, getComment, getFile, getId, getLocation, getName, getNextDFG, getNextEOG, getNextEOGEdges, getPrevDFG, getPrevEOG, getPrevEOGEdges, getTypedefs, hashCode, isImplicit, isInferred, removeNextDFG, removePrevDFG, removePrevEOGEntry, setAnnotations, setArgumentIndex, setCode, setComment, setFile, setId, setImplicit, setInferred, setLocation, setName, setNextDFG, setNextEOG, setNextEOGEdges, setPrevDFG, setPrevEOG, setPrevEOGEdges, setTypedefs, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface de.fraunhofer.aisec.cpg.processing.IVisitable

    accept
  • Field Details

    • SOURCE_LOCATIONS_TO_FRONTEND

      public static final java.lang.String SOURCE_LOCATIONS_TO_FRONTEND
      See Also:
      Constant Field Values
  • Constructor Details

    • TranslationResult

      public TranslationResult​(de.fraunhofer.aisec.cpg.TranslationManager translationManager)
  • Method Details

    • isCancelled

      public boolean isCancelled()
    • getTranslationUnits

      public java.util.List<TranslationUnitDeclaration> getTranslationUnits()
      Checks if only a single software component has been analyzed and returns its translation units. For multiple software components, it aggregates the results.
      Returns:
      the list of all translation units.
    • addTranslationUnit

      @Deprecated(since="4.4.1") public void addTranslationUnit​(TranslationUnitDeclaration tu)
      Deprecated.
      This should not be used anymore. Instead, the corresponding component should be selected and the translation unit should be added there.
      If no component exists, it generates a [Component] called "application" and adds [tu]. If a component already exists, adds the tu to this component.
      Parameters:
      tu - The translation unit to add.
    • getComponents

      public java.util.List<de.fraunhofer.aisec.cpg.graph.Component> getComponents()
      List of software components. Note that this list is immutable. Use addComponent(Component) if you wish to modify it.
      Returns:
      the list of software components
    • addComponent

      public void addComponent​(de.fraunhofer.aisec.cpg.graph.Component sc)
      Add a Component to this translation result in a thread safe way.
      Parameters:
      sc - The software component to add
    • getScratch

      public java.util.Map<java.lang.String,​java.lang.Object> getScratch()
      Scratch storage that can be used by passes to store additional information in this result. Callers must ensure that keys are unique. It is recommended to prefix them with the class name of the Pass.
      Returns:
      the scratch storage
    • getAdditionalNodes

      public java.util.Set<de.fraunhofer.aisec.cpg.graph.Node> getAdditionalNodes()
    • getTranslationManager

      public de.fraunhofer.aisec.cpg.TranslationManager getTranslationManager()
    • addBenchmark

      public void addBenchmark​(@NotNull de.fraunhofer.aisec.cpg.helpers.MeasurementHolder b)
      Specified by:
      addBenchmark in interface de.fraunhofer.aisec.cpg.helpers.StatisticsHolder
    • getBenchmarks

      @NotNull public java.util.List<de.fraunhofer.aisec.cpg.helpers.MeasurementHolder> getBenchmarks()
      Specified by:
      getBenchmarks in interface de.fraunhofer.aisec.cpg.helpers.StatisticsHolder
    • getTranslatedFiles

      @NotNull public java.util.List<java.lang.String> getTranslatedFiles()
      Specified by:
      getTranslatedFiles in interface de.fraunhofer.aisec.cpg.helpers.StatisticsHolder
    • getConfig

      @NotNull public TranslationConfiguration getConfig()
      Specified by:
      getConfig in interface de.fraunhofer.aisec.cpg.helpers.StatisticsHolder
    • getBenchmarkResults

      @NotNull public de.fraunhofer.aisec.cpg.helpers.BenchmarkResults getBenchmarkResults()
      Specified by:
      getBenchmarkResults in interface de.fraunhofer.aisec.cpg.helpers.StatisticsHolder