class BackendConsumer

Declaration

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

Description

ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs. This abstraction layer allows the client to be independent of the AST producer (e.g. parser vs AST dump file reader, etc).

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:105

Inherits from: ASTConsumer

Member Variables

private clang::DiagnosticsEngine& Diags
private clang::BackendAction Action
private const clang::HeaderSearchOptions& HeaderSearchOpts
private const clang::CodeGenOptions& CodeGenOpts
private const clang::TargetOptions& TargetOpts
private const clang::LangOptions& LangOpts
private std::unique_ptr<raw_pwrite_stream> AsmOutStream
private clang::ASTContext* Context
private llvm::Timer LLVMIRGeneration
private unsigned int LLVMIRGenerationRefCount
private bool IRGenFinished = false
True if we've finished generating IR. This prevents us from generating additional LLVM IR after emitting output in HandleTranslationUnit. This can happen when Clang plugins trigger additional AST deserialization.
private bool TimerIsEnabled = false
private std::unique_ptr<CodeGenerator> Gen
private SmallVector<clang::BackendConsumer::LinkModule, 4> LinkModules
private std::vector< std::pair<llvm::hash_code, FullSourceLoc>> ManglingFullSourceLocs
private llvm::Module* CurLinkModule = nullptr

Method Overview

Inherited from ASTConsumer:

Methods

void AssignInheritanceModel(
    clang::CXXRecordDecl* RD)

Description

Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:410

Parameters

clang::CXXRecordDecl* RD

BackendConsumer(
    clang::BackendAction Action,
    clang::DiagnosticsEngine& Diags,
    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
    const clang::HeaderSearchOptions&
        HeaderSearchOpts,
    const clang::PreprocessorOptions& PPOpts,
    const clang::CodeGenOptions& CodeGenOpts,
    const clang::TargetOptions& TargetOpts,
    const clang::LangOptions& LangOpts,
    const std::string& InFile,
    SmallVector<
        clang::BackendConsumer::LinkModule,
        4> LinkModules,
    std::unique_ptr<raw_pwrite_stream> OS,
    llvm::LLVMContext& C,
    clang::CoverageSourceInfo* CoverageInfo =
        nullptr)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:148

Parameters

clang::BackendAction Action
clang::DiagnosticsEngine& Diags
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS
const clang::HeaderSearchOptions& HeaderSearchOpts
const clang::PreprocessorOptions& PPOpts
const clang::CodeGenOptions& CodeGenOpts
const clang::TargetOptions& TargetOpts
const clang::LangOptions& LangOpts
const std::string& InFile
SmallVector<clang::BackendConsumer::LinkModule, 4> LinkModules
std::unique_ptr<raw_pwrite_stream> OS
llvm::LLVMContext& C
clang::CoverageSourceInfo* CoverageInfo = nullptr

BackendConsumer(
    clang::BackendAction Action,
    clang::DiagnosticsEngine& Diags,
    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
    const clang::HeaderSearchOptions&
        HeaderSearchOpts,
    const clang::PreprocessorOptions& PPOpts,
    const clang::CodeGenOptions& CodeGenOpts,
    const clang::TargetOptions& TargetOpts,
    const clang::LangOptions& LangOpts,
    llvm::Module* Module,
    SmallVector<
        clang::BackendConsumer::LinkModule,
        4> LinkModules,
    llvm::LLVMContext& C,
    clang::CoverageSourceInfo* CoverageInfo =
        nullptr)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:174

Parameters

clang::BackendAction Action
clang::DiagnosticsEngine& Diags
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS
const clang::HeaderSearchOptions& HeaderSearchOpts
const clang::PreprocessorOptions& PPOpts
const clang::CodeGenOptions& CodeGenOpts
const clang::TargetOptions& TargetOpts
const clang::LangOptions& LangOpts
llvm::Module* Module
SmallVector<clang::BackendConsumer::LinkModule, 4> LinkModules
llvm::LLVMContext& C
clang::CoverageSourceInfo* CoverageInfo = nullptr

void CompleteExternalDeclaration(
    clang::VarDecl* D)

Description

CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consumer that the given external declaration should be completed.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:406

Parameters

clang::VarDecl* D

void CompleteTentativeDefinition(
    clang::VarDecl* D)

Description

CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consumer that the given tentative definition should be completed. The variable declaration itself will be a tentative definition. If it had an incomplete array type, its type will have already been changed to an array of size 1. However, the declaration remains a tentative definition and has not been modified by the introduction of an implicit zero initializer.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:402

Parameters

clang::VarDecl* D

void DiagnosticHandlerImpl(
    const llvm::DiagnosticInfo& DI)

Description

This function is invoked when the backend needs to report something to the user.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:427

Parameters

const llvm::DiagnosticInfo& DI

void DontCallDiagHandler(
    const llvm::DiagnosticInfoDontCall& D)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:453

Parameters

const llvm::DiagnosticInfoDontCall& D

void EmitOptimizationMessage(
    const llvm::DiagnosticInfoOptimizationBase& D,
    unsigned int DiagID)

Description

Specialized handlers for optimization remarks. Note that these handlers only accept remarks and they always handle them.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:443

Parameters

const llvm::DiagnosticInfoOptimizationBase& D
unsigned int DiagID

void HandleCXXStaticMemberVarInstantiation(
    clang::VarDecl* VD)

Description

HandleCXXStaticMemberVarInstantiation - Tell the consumer that this

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:202

Parameters

clang::VarDecl* VD

void HandleInlineFunctionDefinition(
    clang::FunctionDecl* D)

Description

This callback is invoked each time an inline (method or friend) function definition in a class is completed.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:243

Parameters

clang::FunctionDecl* D

void HandleInterestingDecl(clang::DeclGroupRef D)

Description

HandleInterestingDecl - Handle the specified interesting declaration. This is called by the AST reader when deserializing things that might interest the consumer. The default implementation forwards to HandleTopLevelDecl.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:256

Parameters

clang::DeclGroupRef D

void HandleTagDeclDefinition(clang::TagDecl* D)

Description

HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g. struct, union, enum, class) is completed. This allows the client to hack on the type, which can occur at any point in the file (because these can be defined in declspecs).

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:391

Parameters

clang::TagDecl* D

void HandleTagDeclRequiredDefinition(
    const clang::TagDecl* D)

Description

This callback is invoked the first time each TagDecl is required to be complete.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:398

Parameters

const clang::TagDecl* D

bool HandleTopLevelDecl(clang::DeclGroupRef D)

Description

HandleTopLevelDecl - Handle the specified top-level declaration. This is called by the parser to process every top-level Decl*.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:220

Parameters

clang::DeclGroupRef D

Returns

true to continue parsing, or false to abort parsing.

void HandleTranslationUnit(clang::ASTContext& C)

Description

HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:296

Parameters

clang::ASTContext& C

void HandleVTable(clang::CXXRecordDecl* RD)

Description

Callback involved at the end of a translation unit to notify the consumer that a vtable for the given C++ class is required.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:414

Parameters

clang::CXXRecordDecl* RD
The class whose vtable was used.

void Initialize(clang::ASTContext& Ctx)

Description

Initialize - This is called to initialize the consumer, providing the ASTContext.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:206

Parameters

clang::ASTContext& Ctx

bool InlineAsmDiagHandler(
    const llvm::DiagnosticInfoInlineAsm& D)

Description

Specialized handler for InlineAsm diagnostic.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:431

Parameters

const llvm::DiagnosticInfoInlineAsm& D

Returns

True if the diagnostic has been successfully reported, false otherwise.

bool LinkInModules()

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:263

void MisExpectDiagHandler(
    const llvm::DiagnosticInfoMisExpect& D)

Description

Specialized handler for misexpect warnings. Note that misexpect remarks are emitted through ORE

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:456

Parameters

const llvm::DiagnosticInfoMisExpect& D

void OptimizationFailureHandler(
    const llvm::DiagnosticInfoOptimizationFailure&
        D)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:451

Parameters

const llvm::DiagnosticInfoOptimizationFailure& D

void OptimizationRemarkHandler(
    const llvm::DiagnosticInfoOptimizationBase& D)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:446

Parameters

const llvm::DiagnosticInfoOptimizationBase& D

void OptimizationRemarkHandler(
    const llvm::
        OptimizationRemarkAnalysisFPCommute& D)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:447

Parameters

const llvm::OptimizationRemarkAnalysisFPCommute& D

void OptimizationRemarkHandler(
    const llvm::
        OptimizationRemarkAnalysisAliasing& D)

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:449

Parameters

const llvm::OptimizationRemarkAnalysisAliasing& D

void SrcMgrDiagHandler(
    const llvm::DiagnosticInfoSrcMgr& D)

Description

Specialized handler for diagnostics reported using SMDiagnostic.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:433

Parameters

const llvm::DiagnosticInfoSrcMgr& D

bool StackSizeDiagHandler(
    const llvm::DiagnosticInfoStackSize& D)

Description

Specialized handler for StackSize diagnostic.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:437

Parameters

const llvm::DiagnosticInfoStackSize& D

Returns

True if the diagnostic has been successfully reported, false otherwise.

void UnsupportedDiagHandler(
    const llvm::DiagnosticInfoUnsupported& D)

Description

Specialized handler for unsupported backend feature diagnostic.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:439

Parameters

const llvm::DiagnosticInfoUnsupported& D

virtual void anchor()

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:108

const clang::FullSourceLoc
getBestLocationFromDebugLoc(
    const llvm::DiagnosticInfoWithLocationBase& D,
    bool& BadDebugInfo,
    llvm::StringRef& Filename,
    unsigned int& Line,
    unsigned int& Column) const

Description

Get the best possible source location to represent a diagnostic that may have associated debug info.

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:421

Parameters

const llvm::DiagnosticInfoWithLocationBase& D
bool& BadDebugInfo
llvm::StringRef& Filename
unsigned int& Line
unsigned int& Column

clang::CodeGenerator* getCodeGenerator()

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:200

Optional<clang::FullSourceLoc>
getFunctionSourceLocation(
    const llvm::Function& F) const

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:425

Parameters

const llvm::Function& F

llvm::Module* getModule() const

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:195

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

Declared at: clang/lib/CodeGen/CodeGenAction.cpp:196