clang  14.0.0git
Public Member Functions | List of all members
clang::BackendConsumer Class Reference
Inheritance diagram for clang::BackendConsumer:
Inheritance graph
[legend]
Collaboration diagram for clang::BackendConsumer:
Collaboration graph
[legend]

Public Member Functions

 BackendConsumer (BackendAction Action, DiagnosticsEngine &Diags, const HeaderSearchOptions &HeaderSearchOpts, const PreprocessorOptions &PPOpts, const CodeGenOptions &CodeGenOpts, const TargetOptions &TargetOpts, const LangOptions &LangOpts, const std::string &InFile, SmallVector< LinkModule, 4 > LinkModules, std::unique_ptr< raw_pwrite_stream > OS, LLVMContext &C, CoverageSourceInfo *CoverageInfo=nullptr)
 
 BackendConsumer (BackendAction Action, DiagnosticsEngine &Diags, const HeaderSearchOptions &HeaderSearchOpts, const PreprocessorOptions &PPOpts, const CodeGenOptions &CodeGenOpts, const TargetOptions &TargetOpts, const LangOptions &LangOpts, llvm::Module *Module, SmallVector< LinkModule, 4 > LinkModules, LLVMContext &C, CoverageSourceInfo *CoverageInfo=nullptr)
 
llvm::Module * getModule () const
 
std::unique_ptr< llvm::Module > takeModule ()
 
CodeGeneratorgetCodeGenerator ()
 
void HandleCXXStaticMemberVarInstantiation (VarDecl *VD) override
 HandleCXXStaticMemberVarInstantiation - Tell the consumer that this. More...
 
void Initialize (ASTContext &Ctx) override
 Initialize - This is called to initialize the consumer, providing the ASTContext. More...
 
bool HandleTopLevelDecl (DeclGroupRef D) override
 HandleTopLevelDecl - Handle the specified top-level declaration. More...
 
void HandleInlineFunctionDefinition (FunctionDecl *D) override
 This callback is invoked each time an inline (method or friend) function definition in a class is completed. More...
 
void HandleInterestingDecl (DeclGroupRef D) override
 HandleInterestingDecl - Handle the specified interesting declaration. More...
 
bool LinkInModules ()
 
void HandleTranslationUnit (ASTContext &C) override
 HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed. More...
 
void HandleTagDeclDefinition (TagDecl *D) override
 HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g. More...
 
void HandleTagDeclRequiredDefinition (const TagDecl *D) override
 This callback is invoked the first time each TagDecl is required to be complete. More...
 
void CompleteTentativeDefinition (VarDecl *D) override
 CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consumer that the given tentative definition should be completed. More...
 
void CompleteExternalDeclaration (VarDecl *D) override
 CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consumer that the given external declaration should be completed. More...
 
void AssignInheritanceModel (CXXRecordDecl *RD) override
 Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl. More...
 
void HandleVTable (CXXRecordDecl *RD) override
 Callback involved at the end of a translation unit to notify the consumer that a vtable for the given C++ class is required. More...
 
const FullSourceLoc getBestLocationFromDebugLoc (const llvm::DiagnosticInfoWithLocationBase &D, bool &BadDebugInfo, StringRef &Filename, unsigned &Line, unsigned &Column) const
 Get the best possible source location to represent a diagnostic that may have associated debug info. More...
 
Optional< FullSourceLocgetFunctionSourceLocation (const Function &F) const
 
void DiagnosticHandlerImpl (const llvm::DiagnosticInfo &DI)
 This function is invoked when the backend needs to report something to the user. More...
 
bool InlineAsmDiagHandler (const llvm::DiagnosticInfoInlineAsm &D)
 Specialized handler for InlineAsm diagnostic. More...
 
void SrcMgrDiagHandler (const llvm::DiagnosticInfoSrcMgr &D)
 Specialized handler for diagnostics reported using SMDiagnostic. More...
 
bool StackSizeDiagHandler (const llvm::DiagnosticInfoStackSize &D)
 Specialized handler for StackSize diagnostic. More...
 
void UnsupportedDiagHandler (const llvm::DiagnosticInfoUnsupported &D)
 Specialized handler for unsupported backend feature diagnostic. More...
 
void EmitOptimizationMessage (const llvm::DiagnosticInfoOptimizationBase &D, unsigned DiagID)
 Specialized handlers for optimization remarks. More...
 
void OptimizationRemarkHandler (const llvm::DiagnosticInfoOptimizationBase &D)
 
void OptimizationRemarkHandler (const llvm::OptimizationRemarkAnalysisFPCommute &D)
 
void OptimizationRemarkHandler (const llvm::OptimizationRemarkAnalysisAliasing &D)
 
void OptimizationFailureHandler (const llvm::DiagnosticInfoOptimizationFailure &D)
 
void DontCallDiagHandler (const DiagnosticInfoDontCall &D)
 
- Public Member Functions inherited from clang::ASTConsumer
 ASTConsumer ()
 
virtual ~ASTConsumer ()
 
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 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

Definition at line 105 of file CodeGenAction.cpp.

Constructor & Destructor Documentation

◆ BackendConsumer() [1/2]

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

Definition at line 148 of file CodeGenAction.cpp.

◆ BackendConsumer() [2/2]

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

Definition at line 173 of file CodeGenAction.cpp.

Member Function Documentation

◆ AssignInheritanceModel()

void clang::BackendConsumer::AssignInheritanceModel ( CXXRecordDecl RD)
inlineoverridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 399 of file CodeGenAction.cpp.

◆ CompleteExternalDeclaration()

void clang::BackendConsumer::CompleteExternalDeclaration ( VarDecl D)
inlineoverridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 395 of file CodeGenAction.cpp.

◆ CompleteTentativeDefinition()

void clang::BackendConsumer::CompleteTentativeDefinition ( VarDecl D)
inlineoverridevirtual

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.

Reimplemented from clang::ASTConsumer.

Definition at line 391 of file CodeGenAction.cpp.

◆ DiagnosticHandlerImpl()

void BackendConsumer::DiagnosticHandlerImpl ( const llvm::DiagnosticInfo &  DI)

◆ DontCallDiagHandler()

void BackendConsumer::DontCallDiagHandler ( const DiagnosticInfoDontCall &  D)

◆ EmitOptimizationMessage()

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

Specialized handlers for optimization remarks.

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

Definition at line 710 of file CodeGenAction.cpp.

References Filename, getBestLocationFromDebugLoc(), Line, clang::DiagnosticsEngine::Report(), and string().

Referenced by OptimizationFailureHandler(), and OptimizationRemarkHandler().

◆ getBestLocationFromDebugLoc()

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

◆ getCodeGenerator()

CodeGenerator* clang::BackendConsumer::getCodeGenerator ( )
inline

◆ getFunctionSourceLocation()

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

Definition at line 664 of file CodeGenAction.cpp.

References clang::hash_value().

Referenced by getBestLocationFromDebugLoc(), and StackSizeDiagHandler().

◆ getModule()

llvm::Module* clang::BackendConsumer::getModule ( ) const
inline

Definition at line 193 of file CodeGenAction.cpp.

◆ HandleCXXStaticMemberVarInstantiation()

void clang::BackendConsumer::HandleCXXStaticMemberVarInstantiation ( VarDecl D)
inlineoverridevirtual

HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.

Reimplemented from clang::ASTConsumer.

Definition at line 200 of file CodeGenAction.cpp.

◆ HandleInlineFunctionDefinition()

void clang::BackendConsumer::HandleInlineFunctionDefinition ( FunctionDecl D)
inlineoverridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 241 of file CodeGenAction.cpp.

References clang::ASTContext::getSourceManager().

◆ HandleInterestingDecl()

void clang::BackendConsumer::HandleInterestingDecl ( DeclGroupRef  D)
inlineoverridevirtual

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.

Reimplemented from clang::ASTConsumer.

Definition at line 254 of file CodeGenAction.cpp.

◆ HandleTagDeclDefinition()

void clang::BackendConsumer::HandleTagDeclDefinition ( TagDecl D)
inlineoverridevirtual

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).

Reimplemented from clang::ASTConsumer.

Definition at line 380 of file CodeGenAction.cpp.

References clang::ASTContext::getSourceManager().

◆ HandleTagDeclRequiredDefinition()

void clang::BackendConsumer::HandleTagDeclRequiredDefinition ( const TagDecl D)
inlineoverridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 387 of file CodeGenAction.cpp.

◆ HandleTopLevelDecl()

bool clang::BackendConsumer::HandleTopLevelDecl ( DeclGroupRef  D)
inlineoverridevirtual

HandleTopLevelDecl - Handle the specified top-level declaration.

This is called by the parser to process every top-level Decl*.

Returns
true to continue parsing, or false to abort parsing.

Reimplemented from clang::ASTConsumer.

Definition at line 218 of file CodeGenAction.cpp.

References clang::DeclGroupRef::begin(), and clang::ASTContext::getSourceManager().

◆ HandleTranslationUnit()

void clang::BackendConsumer::HandleTranslationUnit ( ASTContext Ctx)
inlineoverridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 294 of file CodeGenAction.cpp.

References clang::EmbedBitcode(), clang::EmitBackendOutput(), clang::hash_value(), clang::CodeGenOptions::ProfileNone, and clang::reportOptRecordError().

◆ HandleVTable()

void clang::BackendConsumer::HandleVTable ( CXXRecordDecl RD)
inlineoverridevirtual

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

Parameters
RDThe class whose vtable was used.

Reimplemented from clang::ASTConsumer.

Definition at line 403 of file CodeGenAction.cpp.

◆ Initialize()

void clang::BackendConsumer::Initialize ( ASTContext Context)
inlineoverridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 204 of file CodeGenAction.cpp.

◆ InlineAsmDiagHandler()

bool BackendConsumer::InlineAsmDiagHandler ( const llvm::DiagnosticInfoInlineAsm &  D)

Specialized handler for InlineAsm diagnostic.

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

Definition at line 578 of file CodeGenAction.cpp.

References clang::StreamingDiagnostic::AddString(), ComputeDiagID, clang::SourceLocation::getFromRawEncoding(), clang::SourceLocation::isValid(), clang::DiagnosticsEngine::Report(), and string().

Referenced by DiagnosticHandlerImpl().

◆ LinkInModules()

bool clang::BackendConsumer::LinkInModules ( )
inline

Definition at line 261 of file CodeGenAction.cpp.

◆ OptimizationFailureHandler()

void BackendConsumer::OptimizationFailureHandler ( const llvm::DiagnosticInfoOptimizationFailure &  D)

Definition at line 805 of file CodeGenAction.cpp.

References EmitOptimizationMessage().

Referenced by DiagnosticHandlerImpl().

◆ OptimizationRemarkHandler() [1/3]

void BackendConsumer::OptimizationRemarkHandler ( const llvm::DiagnosticInfoOptimizationBase &  D)

◆ OptimizationRemarkHandler() [2/3]

void BackendConsumer::OptimizationRemarkHandler ( const llvm::OptimizationRemarkAnalysisAliasing &  D)

◆ OptimizationRemarkHandler() [3/3]

void BackendConsumer::OptimizationRemarkHandler ( const llvm::OptimizationRemarkAnalysisFPCommute &  D)

◆ SrcMgrDiagHandler()

void BackendConsumer::SrcMgrDiagHandler ( const llvm::DiagnosticInfoSrcMgr &  D)

◆ StackSizeDiagHandler()

bool BackendConsumer::StackSizeDiagHandler ( const llvm::DiagnosticInfoStackSize &  D)

Specialized handler for StackSize diagnostic.

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

Definition at line 603 of file CodeGenAction.cpp.

References getFunctionSourceLocation(), and clang::DiagnosticsEngine::Report().

Referenced by DiagnosticHandlerImpl().

◆ takeModule()

std::unique_ptr<llvm::Module> clang::BackendConsumer::takeModule ( )
inline

Definition at line 194 of file CodeGenAction.cpp.

Referenced by clang::CodeGenAction::EndSourceFileAction().

◆ UnsupportedDiagHandler()

void BackendConsumer::UnsupportedDiagHandler ( const llvm::DiagnosticInfoUnsupported &  D)

Specialized handler for unsupported backend feature diagnostic.

Definition at line 673 of file CodeGenAction.cpp.

References Filename, getBestLocationFromDebugLoc(), Line, clang::DiagnosticsEngine::Report(), and string().

Referenced by DiagnosticHandlerImpl().


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