clang 20.0.0git
|
The primary public interface to the Clang code generator. More...
#include "clang/CodeGen/ModuleBuilder.h"
Public Member Functions | |
CodeGen::CodeGenModule & | CGM () |
Return an opaque reference to the CodeGenModule object, which can be used in various secondary APIs. | |
llvm::Module * | GetModule () |
Return the module that this code generator is building into. | |
llvm::Module * | ReleaseModule () |
Release ownership of the module to the caller. | |
CodeGen::CGDebugInfo * | getCGDebugInfo () |
Return debug info code generator. | |
const Decl * | GetDeclForMangledName (llvm::StringRef MangledName) |
Given a mangled name, return a declaration which mangles that way which has been added to this code generator via a Handle method. | |
llvm::StringRef | GetMangledName (GlobalDecl GD) |
Given a global declaration, return a mangled name for this declaration which has been added to this code generator via a Handle method. | |
llvm::Constant * | GetAddrOfGlobal (GlobalDecl decl, bool isForDefinition) |
Return the LLVM address of the given global entity. | |
llvm::Module * | StartModule (llvm::StringRef ModuleName, llvm::LLVMContext &C) |
Create a new llvm::Module after calling HandleTranslationUnit. | |
Public Member Functions inherited from clang::ASTConsumer | |
ASTConsumer ()=default | |
virtual | ~ASTConsumer () |
virtual void | Initialize (ASTContext &Context) |
Initialize - This is called to initialize the consumer, providing the ASTContext. | |
virtual bool | HandleTopLevelDecl (DeclGroupRef D) |
HandleTopLevelDecl - Handle the specified top-level declaration. | |
virtual void | HandleInlineFunctionDefinition (FunctionDecl *D) |
This callback is invoked each time an inline (method or friend) function definition in a class is completed. | |
virtual void | HandleInterestingDecl (DeclGroupRef D) |
HandleInterestingDecl - Handle the specified interesting declaration. | |
virtual void | HandleTranslationUnit (ASTContext &Ctx) |
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed. | |
virtual void | HandleTagDeclDefinition (TagDecl *D) |
HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g. | |
virtual void | HandleTagDeclRequiredDefinition (const TagDecl *D) |
This callback is invoked the first time each TagDecl is required to be complete. | |
virtual void | HandleCXXImplicitFunctionInstantiation (FunctionDecl *D) |
Invoked when a function is implicitly instantiated. | |
virtual void | HandleTopLevelDeclInObjCContainer (DeclGroupRef D) |
Handle the specified top-level declaration that occurred inside and ObjC container. | |
virtual void | HandleImplicitImportDecl (ImportDecl *D) |
Handle an ImportDecl that was implicitly created due to an inclusion directive. | |
virtual void | CompleteTentativeDefinition (VarDecl *D) |
CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consumer that the given tentative definition should be completed. | |
virtual void | CompleteExternalDeclaration (DeclaratorDecl *D) |
CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consumer that the given external declaration should be completed. | |
virtual void | AssignInheritanceModel (CXXRecordDecl *RD) |
Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl. | |
virtual void | HandleCXXStaticMemberVarInstantiation (VarDecl *D) |
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this. | |
virtual void | HandleVTable (CXXRecordDecl *RD) |
Callback involved at the end of a translation unit to notify the consumer that a vtable for the given C++ class is required. | |
virtual ASTMutationListener * | GetASTMutationListener () |
If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here. | |
virtual ASTDeserializationListener * | GetASTDeserializationListener () |
If the consumer is interested in entities being deserialized from AST files, it should return a pointer to a ASTDeserializationListener here. | |
virtual void | PrintStats () |
PrintStats - If desired, print any statistics. | |
virtual bool | shouldSkipFunctionBody (Decl *D) |
This callback is called for each function if the Parser was initialized with SkipFunctionBodies set to true . | |
The primary public interface to the Clang code generator.
This is not really an abstract interface.
Definition at line 52 of file ModuleBuilder.h.
CodeGenModule & CodeGenerator::CGM | ( | ) |
Return an opaque reference to the CodeGenModule object, which can be used in various secondary APIs.
It is valid as long as the CodeGenerator exists.
Definition at line 328 of file ModuleBuilder.cpp.
References CGM().
Referenced by CGM().
llvm::Constant * CodeGenerator::GetAddrOfGlobal | ( | GlobalDecl | decl, |
bool | isForDefinition | ||
) |
Return the LLVM address of the given global entity.
isForDefinition | If true, the caller intends to define the entity; the object returned will be an llvm::GlobalValue of some sort. If false, the caller just intends to use the entity; the object returned may be any sort of constant value, and the code generator will schedule the entity for emission if a definition has been registered with this code generator. |
Definition at line 352 of file ModuleBuilder.cpp.
References GetAddrOfGlobal().
Referenced by GetAddrOfGlobal().
CGDebugInfo * CodeGenerator::getCGDebugInfo | ( | ) |
Return debug info code generator.
Definition at line 340 of file ModuleBuilder.cpp.
References getCGDebugInfo().
Referenced by getCGDebugInfo(), clang::MacroPPCallbacks::MacroDefined(), and clang::MacroPPCallbacks::MacroUndefined().
const Decl * CodeGenerator::GetDeclForMangledName | ( | llvm::StringRef | MangledName | ) |
Given a mangled name, return a declaration which mangles that way which has been added to this code generator via a Handle method.
This may return null if there was no matching declaration.
Definition at line 344 of file ModuleBuilder.cpp.
References GetDeclForMangledName().
Referenced by GetDeclForMangledName().
llvm::StringRef CodeGenerator::GetMangledName | ( | GlobalDecl | GD | ) |
Given a global declaration, return a mangled name for this declaration which has been added to this code generator via a Handle method.
Definition at line 348 of file ModuleBuilder.cpp.
References GetMangledName().
Referenced by GetMangledName(), and clang::IncrementalParser::GetMangledName().
llvm::Module * CodeGenerator::GetModule | ( | ) |
Return the module that this code generator is building into.
This may return null after HandleTranslationUnit is called; this signifies that there was an error generating code. A diagnostic will have been generated in this case, and the module will be deleted.
It will also return null if the module is released.
Definition at line 332 of file ModuleBuilder.cpp.
References GetModule().
Referenced by GetModule().
llvm::Module * CodeGenerator::ReleaseModule | ( | ) |
Release ownership of the module to the caller.
It is illegal to call methods other than GetModule on the CodeGenerator after releasing its module.
Definition at line 336 of file ModuleBuilder.cpp.
References ReleaseModule().
Referenced by ReleaseModule().
llvm::Module * CodeGenerator::StartModule | ( | llvm::StringRef | ModuleName, |
llvm::LLVMContext & | C | ||
) |
Create a new llvm::Module
after calling HandleTranslationUnit.
This enable codegen in interactive processing environments.
Definition at line 358 of file ModuleBuilder.cpp.
References clang::C, and StartModule().
Referenced by StartModule().