clang  6.0.0svn
Public Member Functions | List of all members
clang::CodeGenerator Class Reference

The primary public interface to the Clang code generator. More...

#include "clang/CodeGen/ModuleBuilder.h"

Inheritance diagram for clang::CodeGenerator:
Inheritance graph
[legend]
Collaboration diagram for clang::CodeGenerator:
Collaboration graph
[legend]

Public Member Functions

CodeGen::CodeGenModuleCGM ()
 Return an opaque reference to the CodeGenModule object, which can be used in various secondary APIs. More...
 
llvm::Module * GetModule ()
 Return the module that this code generator is building into. More...
 
llvm::Module * ReleaseModule ()
 Release ownership of the module to the caller. More...
 
CodeGen::CGDebugInfogetCGDebugInfo ()
 Return debug info code generator. More...
 
const DeclGetDeclForMangledName (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. More...
 
llvm::Constant * GetAddrOfGlobal (GlobalDecl decl, bool isForDefinition)
 Return the LLVM address of the given global entity. More...
 
llvm::Module * StartModule (llvm::StringRef ModuleName, llvm::LLVMContext &C)
 Create a new llvm::Module after calling HandleTranslationUnit. More...
 
- Public Member Functions inherited from clang::ASTConsumer
 ASTConsumer ()
 
virtual ~ASTConsumer ()
 
virtual void Initialize (ASTContext &Context)
 Initialize - This is called to initialize the consumer, providing the ASTContext. More...
 
virtual bool HandleTopLevelDecl (DeclGroupRef D)
 HandleTopLevelDecl - Handle the specified top-level declaration. More...
 
virtual void HandleInlineFunctionDefinition (FunctionDecl *D)
 This callback is invoked each time an inline (method or friend) function definition in a class is completed. More...
 
virtual void HandleInterestingDecl (DeclGroupRef D)
 HandleInterestingDecl - Handle the specified interesting declaration. More...
 
virtual void HandleTranslationUnit (ASTContext &Ctx)
 HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed. More...
 
virtual void HandleTagDeclDefinition (TagDecl *D)
 HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g. More...
 
virtual void HandleTagDeclRequiredDefinition (const TagDecl *D)
 This callback is invoked the first time each TagDecl is required to be complete. More...
 
virtual void HandleCXXImplicitFunctionInstantiation (FunctionDecl *D)
 Invoked when a function is implicitly instantiated. More...
 
virtual void HandleTopLevelDeclInObjCContainer (DeclGroupRef D)
 Handle the specified top-level declaration that occurred inside and ObjC container. More...
 
virtual void HandleImplicitImportDecl (ImportDecl *D)
 Handle an ImportDecl that was implicitly created due to an inclusion directive. More...
 
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. More...
 
virtual void AssignInheritanceModel (CXXRecordDecl *RD)
 Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl. More...
 
virtual void HandleCXXStaticMemberVarInstantiation (VarDecl *D)
 HandleCXXStaticMemberVarInstantiation - Tell the consumer that this. More...
 
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. More...
 
virtual ASTMutationListenerGetASTMutationListener ()
 If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here. More...
 
virtual ASTDeserializationListenerGetASTDeserializationListener ()
 If the consumer is interested in entities being deserialized from AST files, it should return a pointer to a ASTDeserializationListener here. More...
 
virtual void PrintStats ()
 PrintStats - If desired, print any statistics. More...
 
virtual bool shouldSkipFunctionBody (Decl *D)
 This callback is called for each function if the Parser was initialized with SkipFunctionBodies set to true. More...
 

Detailed Description

The primary public interface to the Clang code generator.

This is not really an abstract interface.

Definition at line 44 of file ModuleBuilder.h.

Member Function Documentation

◆ CGM()

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 302 of file ModuleBuilder.cpp.

◆ GetAddrOfGlobal()

llvm::Constant * CodeGenerator::GetAddrOfGlobal ( GlobalDecl  decl,
bool  isForDefinition 
)

Return the LLVM address of the given global entity.

Parameters
isForDefinitionIf 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 322 of file ModuleBuilder.cpp.

◆ getCGDebugInfo()

CGDebugInfo * CodeGenerator::getCGDebugInfo ( )

Return debug info code generator.

Definition at line 314 of file ModuleBuilder.cpp.

Referenced by clang::MacroPPCallbacks::MacroUndefined().

◆ GetDeclForMangledName()

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 318 of file ModuleBuilder.cpp.

◆ GetModule()

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 306 of file ModuleBuilder.cpp.

◆ ReleaseModule()

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 310 of file ModuleBuilder.cpp.

◆ StartModule()

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 328 of file ModuleBuilder.cpp.


The documentation for this class was generated from the following files: