class CodeGenAction

Declaration

class CodeGenAction : public ASTFrontendAction { /* full declaration omitted */ };

Description

Abstract base class to use for AST consumer-based frontend actions.

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:24

Inherits from: ASTFrontendAction

Member Variables

private unsigned int Act
private std::unique_ptr<llvm::Module> TheModule
private SmallVector<clang::CodeGenAction::LinkModule, 4> LinkModules
Bitcode modules to link in to our module.
private llvm::LLVMContext* VMContext
private bool OwnsVMContext
public clang::BackendConsumer* BEConsumer

Method Overview

Inherited from ASTFrontendAction:

Inherited from FrontendAction:

Methods

CodeGenAction(
    unsigned int _Act,
    llvm::LLVMContext* _VMContext = nullptr)

Description

Create a new code generation action. If the optional \p _VMContext parameter is supplied, the action uses it without taking ownership, otherwise it creates a fresh LLVM context and takes ownership.

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:60

Parameters

unsigned int _Act
llvm::LLVMContext* _VMContext = nullptr

std::unique_ptr<ASTConsumer> CreateASTConsumer(
    clang::CompilerInstance& CI,
    llvm::StringRef InFile)

Description

Create the AST consumer object for this action, if supported. This routine is called as part of BeginSourceFile(), which will fail if the AST consumer cannot be created. This will not be called if the action has indicated that it only uses the preprocessor.

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:64

Parameters

clang::CompilerInstance& CI
- The current compiler instance, provided as a convenience, see getCompilerInstance().
llvm::StringRef InFile
- The current input file, provided as a convenience, see getCurrentFile().

Returns

The new AST consumer, or null on failure.

void EndSourceFileAction()

Description

Callback at the end of processing a single input. This is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:69

void ExecuteAction()

Description

Implement the ExecuteAction interface by running Sema on the already-initialized AST consumer. This will also take care of instantiating a code completion consumer if the user requested it and the action supports it.

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:67

clang::CodeGenerator* getCodeGenerator() const

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:81

bool hasIRSupport() const

Description

Does this action support use with IR files?

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:62

std::unique_ptr<llvm::Module> loadModule(
    llvm::MemoryBufferRef MBRef)

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:54

Parameters

llvm::MemoryBufferRef MBRef

llvm::LLVMContext* takeLLVMContext()

Description

Take the LLVM context used by this action.

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:79

std::unique_ptr<llvm::Module> takeModule()

Description

Take the generated LLVM module, for use after the action has been run. The result may be null on failure.

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:76

~CodeGenAction()

Declared at: clang/include/clang/CodeGen/CodeGenAction.h:72