clang API Documentation

Public Member Functions | Public Attributes | Protected Member Functions
clang::CodeGenAction Class Reference

#include <CodeGenAction.h>

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

List of all members.

Public Member Functions

 ~CodeGenAction ()
void setLinkModule (llvm::Module *Mod)
std::unique_ptr< llvm::Module > takeModule ()
llvm::LLVMContext * takeLLVMContext ()
 Take the LLVM context used by this action.

Public Attributes

BackendConsumerBEConsumer

Protected Member Functions

 CodeGenAction (unsigned _Act, llvm::LLVMContext *_VMContext=nullptr)
bool hasIRSupport () const override
 Does this action support use with IR files?
std::unique_ptr< ASTConsumerCreateASTConsumer (CompilerInstance &CI, StringRef InFile) override
 Create the AST consumer object for this action, if supported.
void ExecuteAction () override
 Implement the ExecuteAction interface by running Sema on the already-initialized AST consumer.
void EndSourceFileAction () override
 Callback at the end of processing a single input.

Detailed Description

Definition at line 24 of file CodeGenAction.h.


Constructor & Destructor Documentation

CodeGenAction::CodeGenAction ( unsigned  _Act,
llvm::LLVMContext *  _VMContext = nullptr 
) [protected]

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

Definition at line 570 of file CodeGenAction.cpp.

Definition at line 575 of file CodeGenAction.cpp.


Member Function Documentation

std::unique_ptr< ASTConsumer > CodeGenAction::CreateASTConsumer ( CompilerInstance CI,
StringRef  InFile 
) [override, protected, virtual]

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.

Parameters:
CI- The current compiler instance, provided as a convenience, see getCompilerInstance().
InFile- The current input file, provided as a convenience, see getCurrentFile().
Returns:
The new AST consumer, or null on failure.

Implements clang::FrontendAction.

Definition at line 627 of file CodeGenAction.cpp.

References clang::Preprocessor::addPPCallbacks(), clang::Backend_EmitNothing, BEConsumer, clang::FileManager::getBufferForFile(), clang::CompilerInstance::getCodeGenOpts(), clang::CompilerInstance::getDiagnostics(), clang::CompilerInstance::getFileManager(), clang::CompilerInstance::getFrontendOpts(), clang::CompilerInstance::getLangOpts(), GetOutputStream(), clang::CompilerInstance::getPreprocessor(), clang::CompilerInstance::getTargetOpts(), clang::CodeGenOptions::LinkBitcodeFile, clang::DiagnosticsEngine::Report(), and clang::FrontendOptions::ShowTimers.

void CodeGenAction::EndSourceFileAction ( ) [override, protected, virtual]

Callback at the end of processing a single input.

This is guaranteed to only be called following a successful call to BeginSourceFileAction (and BeginSourceFile).

Reimplemented from clang::FrontendAction.

Definition at line 583 of file CodeGenAction.cpp.

References BEConsumer, clang::FrontendAction::getCompilerInstance(), clang::BackendConsumer::takeLinkModule(), and clang::BackendConsumer::takeModule().

void CodeGenAction::ExecuteAction ( ) [override, protected, virtual]
bool CodeGenAction::hasIRSupport ( ) const [override, protected, virtual]

Does this action support use with IR files?

Reimplemented from clang::FrontendAction.

Definition at line 581 of file CodeGenAction.cpp.

void clang::CodeGenAction::setLinkModule ( llvm::Module *  Mod) [inline]

setLinkModule - Set the link module to be used by this action. If a link module is not provided, and CodeGenOptions::LinkBitcodeFile is non-empty, the action will load it from the specified file.

Definition at line 53 of file CodeGenAction.h.

llvm::LLVMContext * CodeGenAction::takeLLVMContext ( )

Take the LLVM context used by this action.

Definition at line 600 of file CodeGenAction.cpp.

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

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

Definition at line 596 of file CodeGenAction.cpp.


Member Data Documentation

Definition at line 62 of file CodeGenAction.h.

Referenced by CreateASTConsumer(), and EndSourceFileAction().


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