class CodeGenerator

Declaration

class CodeGenerator : public ASTConsumer { /* full declaration omitted */ };

Description

The primary public interface to the Clang code generator. This is not really an abstract interface.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:48

Inherits from: ASTConsumer

Member Variables

Method Overview

Inherited from ASTConsumer:

Methods

CodeGen::CodeGenModule& CGM()

Description

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.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:55

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

Description

Return the LLVM address of the given global entity.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:94

Parameters

clang::GlobalDecl decl
bool 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.

const clang::Decl* GetDeclForMangledName(
    llvm::StringRef MangledName)

Description

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.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:80

Parameters

llvm::StringRef MangledName

llvm::StringRef GetMangledName(
    clang::GlobalDecl GD)

Description

Given a global declaration, return a mangled name for this declaration which has been added to this code generator via a Handle method.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:84

Parameters

clang::GlobalDecl GD

llvm::Module* GetModule()

Description

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.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:65

llvm::Module* ReleaseModule()

Description

Release ownership of the module to the caller. It is illegal to call methods other than GetModule on the CodeGenerator after releasing its module.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:71

llvm::Module* StartModule(
    llvm::StringRef ModuleName,
    llvm::LLVMContext& C)

Description

Create a new \c llvm::Module after calling HandleTranslationUnit. This enable codegen in interactive processing environments.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:98

Parameters

llvm::StringRef ModuleName
llvm::LLVMContext& C

virtual void anchor()

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:49

CodeGen::CGDebugInfo* getCGDebugInfo()

Description

Return debug info code generator.

Declared at: clang/include/clang/CodeGen/ModuleBuilder.h:74