Class CXXLanguageFrontend
- java.lang.Object
-
- de.fraunhofer.aisec.cpg.frontends.LanguageFrontend
-
- de.fraunhofer.aisec.cpg.frontends.cpp.CXXLanguageFrontend
-
public class CXXLanguageFrontend extends LanguageFrontend
The language frontend for translating CXX languages into the graph. It uses Eclipse CDT to parse the actual source code into an AST.Frontend for ONE CXX File
-
-
Field Summary
Fields Modifier and Type Field Description static TypeINT_TYPEstatic TypeLONG_LONG_TYPEstatic TypeLONG_TYPEstatic TypeTYPE_UNSIGNED_LONGstatic TypeTYPE_UNSIGNED_LONG_LONG-
Fields inherited from class de.fraunhofer.aisec.cpg.frontends.LanguageFrontend
config, log, objectListeners, predicateListeners, processedMapping, scopeManager
-
-
Constructor Summary
Constructors Constructor Description CXXLanguageFrontend(@NonNull TranslationConfiguration config, ScopeManager scopeManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable DeclarationcacheDeclaration(org.eclipse.cdt.core.dom.ast.IBinding binding, Declaration declaration)voidcleanup()voidexpressionRefersToDeclaration(Expression expression, org.eclipse.cdt.core.dom.ast.IASTExpression iastExpression)DeclarationgetCachedDeclaration(org.eclipse.cdt.core.dom.ast.IBinding binding)<T> @Nullable java.lang.StringgetCodeFromRawNode(T astNode)Returns the raw code of the ast node, generic for java or c++ ast nodes.DeclarationHandlergetDeclarationHandler()de.fraunhofer.aisec.cpg.frontends.cpp.DeclarationListHandlergetDeclarationListHandler()de.fraunhofer.aisec.cpg.frontends.cpp.DeclaratorHandlergetDeclaratorHandler()de.fraunhofer.aisec.cpg.frontends.cpp.ExpressionHandlergetExpressionHandler()InitializerHandlergetInitializerHandler()ParameterDeclarationHandlergetParameterDeclarationHandler()<T> @NonNull RegiongetRegionFromRawNode(T astNode)Returns theRegionof the code with line and column, index starting at 1, generic for java or c++ ast nodes.de.fraunhofer.aisec.cpg.frontends.cpp.StatementHandlergetStatementHandler()TranslationUnitDeclarationparse(java.io.File file)<S,T>
voidsetComment(S s, T ctx)-
Methods inherited from class de.fraunhofer.aisec.cpg.frontends.LanguageFrontend
addRecord, clearProcessed, getCodeOfSubregion, getNamespaceDelimiter, getNewLineType, getRecordForName, getRecords, getScopeManager, mergeRegions, parseAll, process, registerObjectListener, registerPredicateListener, setCodeAndRegion, setScopeManager
-
-
-
-
Constructor Detail
-
CXXLanguageFrontend
public CXXLanguageFrontend(@NonNull TranslationConfiguration config, ScopeManager scopeManager)
-
-
Method Detail
-
parse
public TranslationUnitDeclaration parse(java.io.File file) throws TranslationException
- Specified by:
parsein classLanguageFrontend- Throws:
TranslationException
-
getCodeFromRawNode
public <T> @Nullable java.lang.String getCodeFromRawNode(T astNode)
Description copied from class:LanguageFrontendReturns the raw code of the ast node, generic for java or c++ ast nodes.- Specified by:
getCodeFromRawNodein classLanguageFrontend- Type Parameters:
T- the raw ast type- Parameters:
astNode- the ast node- Returns:
- the source code
-
getRegionFromRawNode
public <T> @NonNull Region getRegionFromRawNode(T astNode)
Description copied from class:LanguageFrontendReturns theRegionof the code with line and column, index starting at 1, generic for java or c++ ast nodes.- Specified by:
getRegionFromRawNodein classLanguageFrontend- Type Parameters:
T- the raw ast type- Parameters:
astNode- the ast node- Returns:
- the region
-
expressionRefersToDeclaration
public void expressionRefersToDeclaration(Expression expression, org.eclipse.cdt.core.dom.ast.IASTExpression iastExpression)
-
cacheDeclaration
public @Nullable Declaration cacheDeclaration(org.eclipse.cdt.core.dom.ast.IBinding binding, Declaration declaration)
-
getCachedDeclaration
public Declaration getCachedDeclaration(org.eclipse.cdt.core.dom.ast.IBinding binding)
-
cleanup
public void cleanup()
- Overrides:
cleanupin classLanguageFrontend
-
setComment
public <S,T> void setComment(S s, T ctx)- Specified by:
setCommentin classLanguageFrontend
-
getDeclarationHandler
public DeclarationHandler getDeclarationHandler()
-
getDeclarationListHandler
public de.fraunhofer.aisec.cpg.frontends.cpp.DeclarationListHandler getDeclarationListHandler()
-
getDeclaratorHandler
public de.fraunhofer.aisec.cpg.frontends.cpp.DeclaratorHandler getDeclaratorHandler()
-
getExpressionHandler
public de.fraunhofer.aisec.cpg.frontends.cpp.ExpressionHandler getExpressionHandler()
-
getInitializerHandler
public InitializerHandler getInitializerHandler()
-
getParameterDeclarationHandler
public ParameterDeclarationHandler getParameterDeclarationHandler()
-
getStatementHandler
public de.fraunhofer.aisec.cpg.frontends.cpp.StatementHandler getStatementHandler()
-
-