Class TranslationConfiguration

java.lang.Object
de.fraunhofer.aisec.cpg.TranslationConfiguration

public class TranslationConfiguration
extends java.lang.Object
The configuration for the TranslationManager holds all information that is used during the translation.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  TranslationConfiguration.Builder
  • Field Summary

    Fields
    Modifier and Type Field Description
    boolean codeInNodes
    should the code of a node be shown as parameter in the node *
    boolean debugParser
    Set to true to generate debug output for the parser.
    boolean disableCleanup
    Switch off cleaning up TypeManager memory after analysis.
    java.util.List<java.lang.String> includeBlacklist
    This acts as a black list for include files, if the array is not empty.
    java.lang.String[] includePaths
    Paths to look for include files.
    java.util.List<java.lang.String> includeWhitelist
    This acts as a white list for include files, if the array is not empty.
    boolean loadIncludes
    Set to true to transitively load include files into the CPG.
    boolean matchCommentsToNodes
    If true the frontend shall use a heuristic matching of comments found in the source file to match them to the closest AST node and save it in the comment property.
    boolean processAnnotations
    Set to true to process annotations or annotation-like elements.
    java.util.Map<java.lang.String,​java.lang.String> symbols
    Definition of additional symbols, mostly useful for C++.
  • Method Summary

    Modifier and Type Method Description
    static TranslationConfiguration.Builder builder()  
    @Nullable de.fraunhofer.aisec.cpg.frontends.CompilationDatabase getCompilationDatabase()  
    java.util.Map<java.lang.Class<? extends LanguageFrontend>,​java.util.List<java.lang.String>> getFrontends()  
    de.fraunhofer.aisec.cpg.InferenceConfiguration getInferenceConfiguration()  
    java.util.List<Pass> getRegisteredPasses()  
    java.util.Map<java.lang.String,​java.util.List<java.io.File>> getSoftwareComponents()  
    java.util.List<java.io.File> getSourceLocations()
    Returns a list of all analyzed files.
    java.util.Map<java.lang.String,​java.lang.String> getSymbols()  
    java.io.File getTopLevel()  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • debugParser

      public final boolean debugParser
      Set to true to generate debug output for the parser.
    • loadIncludes

      public final boolean loadIncludes
      Set to true to transitively load include files into the CPG.

      If this value is set to false but includePaths are given, the parser will resolve symbols/templates from these include, but do not load the parse tree into the CPG

    • includePaths

      public final java.lang.String[] includePaths
      Paths to look for include files.

      It is recommended to set proper include paths as otherwise unresolved symbols/templates will result in subsequent parser mistakes, such as treating "<" as a BinaryOperator in the following example: <code> std::unique_ptr<Botan::Cipher_Mode> bla; </code>

      As long as loadIncludes is set to false, include files will only be parsed, but not loaded into the CPG. *

    • includeWhitelist

      public final java.util.List<java.lang.String> includeWhitelist
      This acts as a white list for include files, if the array is not empty. Only the specified includes files will be parsed and processed in the CPG, unless it is a port of the blacklist, in which it will be ignored.
    • includeBlacklist

      public final java.util.List<java.lang.String> includeBlacklist
      This acts as a black list for include files, if the array is not empty. The specified includes files will excluded from being parsed and processed in the CPG. The blacklist entries always take priority over those in the whitelist.
    • disableCleanup

      public boolean disableCleanup
      Switch off cleaning up TypeManager memory after analysis.

      Set this to true only for testing.

    • codeInNodes

      public final boolean codeInNodes
      should the code of a node be shown as parameter in the node *
    • processAnnotations

      public final boolean processAnnotations
      Set to true to process annotations or annotation-like elements.
    • symbols

      public final java.util.Map<java.lang.String,​java.lang.String> symbols
      Definition of additional symbols, mostly useful for C++.
    • matchCommentsToNodes

      public final boolean matchCommentsToNodes
      If true the frontend shall use a heuristic matching of comments found in the source file to match them to the closest AST node and save it in the comment property.
  • Method Details

    • builder

      public static TranslationConfiguration.Builder builder()
    • getSymbols

      public java.util.Map<java.lang.String,​java.lang.String> getSymbols()
    • getSourceLocations

      public java.util.List<java.io.File> getSourceLocations()
      Returns a list of all analyzed files.
    • getSoftwareComponents

      public java.util.Map<java.lang.String,​java.util.List<java.io.File>> getSoftwareComponents()
    • getCompilationDatabase

      public @Nullable de.fraunhofer.aisec.cpg.frontends.CompilationDatabase getCompilationDatabase()
    • getTopLevel

      public java.io.File getTopLevel()
    • getRegisteredPasses

      public java.util.List<Pass> getRegisteredPasses()
    • getFrontends

      public java.util.Map<java.lang.Class<? extends LanguageFrontend>,​java.util.List<java.lang.String>> getFrontends()
    • getInferenceConfiguration

      public de.fraunhofer.aisec.cpg.InferenceConfiguration getInferenceConfiguration()
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object