clang 22.0.0git
clang::BackendConsumer Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/BackendConsumer.h"

Inheritance diagram for clang::BackendConsumer:
[legend]

Public Member Functions

 BackendConsumer (CompilerInstance &CI, BackendAction Action, IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS, llvm::LLVMContext &C, SmallVector< LinkModule, 4 > LinkModules, StringRef InFile, std::unique_ptr< raw_pwrite_stream > OS, CoverageSourceInfo *CoverageInfo, llvm::Module *CurLinkModule=nullptr)
llvm::Module * getModule () const
std::unique_ptr< llvm::Module > takeModule ()
CodeGeneratorgetCodeGenerator ()
void HandleCXXStaticMemberVarInstantiation (VarDecl *VD) override
 HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
void Initialize (ASTContext &Ctx) override
 Initialize - This is called to initialize the consumer, providing the ASTContext.
bool HandleTopLevelDecl (DeclGroupRef D) override
 HandleTopLevelDecl - Handle the specified top-level declaration.
void HandleInlineFunctionDefinition (FunctionDecl *D) override
 This callback is invoked each time an inline (method or friend) function definition in a class is completed.
void HandleInterestingDecl (DeclGroupRef D) override
 HandleInterestingDecl - Handle the specified interesting declaration.
void HandleTranslationUnit (ASTContext &C) override
 HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been parsed.
void HandleTagDeclDefinition (TagDecl *D) override
 HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.
void HandleTagDeclRequiredDefinition (const TagDecl *D) override
 This callback is invoked the first time each TagDecl is required to be complete.
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.
void CompleteExternalDeclaration (DeclaratorDecl *D) override
 CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consumer that the given external declaration should be completed.
void AssignInheritanceModel (CXXRecordDecl *RD) override
 Callback invoked when an MSInheritanceAttr has been attached to a CXXRecordDecl.
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.
bool LinkInModules (llvm::Module *M)
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.
std::optional< FullSourceLocgetFunctionSourceLocation (const llvm::Function &F) const
void DiagnosticHandlerImpl (const llvm::DiagnosticInfo &DI)
 This function is invoked when the backend needs to report something to the user.
bool InlineAsmDiagHandler (const llvm::DiagnosticInfoInlineAsm &D)
 Specialized handler for InlineAsm diagnostic.
void SrcMgrDiagHandler (const llvm::DiagnosticInfoSrcMgr &D)
 Specialized handler for diagnostics reported using SMDiagnostic.
bool StackSizeDiagHandler (const llvm::DiagnosticInfoStackSize &D)
 Specialized handler for StackSize diagnostic.
bool ResourceLimitDiagHandler (const llvm::DiagnosticInfoResourceLimit &D)
 Specialized handler for ResourceLimit diagnostic.
void UnsupportedDiagHandler (const llvm::DiagnosticInfoUnsupported &D)
 Specialized handler for unsupported backend feature diagnostic.
void EmitOptimizationMessage (const llvm::DiagnosticInfoOptimizationBase &D, unsigned DiagID)
 Specialized handlers for optimization remarks.
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 llvm::DiagnosticInfoDontCall &D)
void MisExpectDiagHandler (const llvm::DiagnosticInfoMisExpect &D)
 Specialized handler for misexpect warnings.
Public Member Functions inherited from clang::ASTConsumer
 ASTConsumer ()=default
virtual ~ASTConsumer ()
virtual void HandleCXXImplicitFunctionInstantiation (FunctionDecl *D)
 Invoked when a function is implicitly instantiated.
virtual void HandleTopLevelDeclInObjCContainer (DeclGroupRef D)
 Handle the specified top-level declaration that occurred inside and ObjC container.
virtual void HandleImplicitImportDecl (ImportDecl *D)
 Handle an ImportDecl that was implicitly created due to an inclusion directive.
virtual ASTMutationListenerGetASTMutationListener ()
 If the consumer is interested in entities getting modified after their initial creation, it should return a pointer to an ASTMutationListener here.
virtual ASTDeserializationListenerGetASTDeserializationListener ()
 If the consumer is interested in entities being deserialized from AST files, it should return a pointer to a ASTDeserializationListener here.
virtual void PrintStats ()
 PrintStats - If desired, print any statistics.
virtual bool shouldSkipFunctionBody (Decl *D)
 This callback is called for each function if the Parser was initialized with SkipFunctionBodies set to true.

Detailed Description

Definition at line 27 of file BackendConsumer.h.

Constructor & Destructor Documentation

◆ BackendConsumer()

clang::BackendConsumer::BackendConsumer ( CompilerInstance & CI,
BackendAction Action,
IntrusiveRefCntPtr< llvm::vfs::FileSystem > VFS,
llvm::LLVMContext & C,
SmallVector< LinkModule, 4 > LinkModules,
StringRef InFile,
std::unique_ptr< raw_pwrite_stream > OS,
CoverageSourceInfo * CoverageInfo,
llvm::Module * CurLinkModule = nullptr )

Definition at line 109 of file CodeGenAction.cpp.

References clang::C, and clang::CreateLLVMCodeGen().

Member Function Documentation

◆ AssignInheritanceModel()

void clang::BackendConsumer::AssignInheritanceModel ( CXXRecordDecl * RD)
overridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 345 of file CodeGenAction.cpp.

◆ CompleteExternalDeclaration()

void clang::BackendConsumer::CompleteExternalDeclaration ( DeclaratorDecl * D)
overridevirtual

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 341 of file CodeGenAction.cpp.

◆ CompleteTentativeDefinition()

void clang::BackendConsumer::CompleteTentativeDefinition ( VarDecl * D)
overridevirtual

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 337 of file CodeGenAction.cpp.

◆ DiagnosticHandlerImpl()

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

◆ DontCallDiagHandler()

void BackendConsumer::DontCallDiagHandler ( const llvm::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 630 of file CodeGenAction.cpp.

References clang::Column, getBestLocationFromDebugLoc(), and clang::Line.

Referenced by OptimizationFailureHandler(), OptimizationRemarkHandler(), OptimizationRemarkHandler(), and OptimizationRemarkHandler().

◆ getBestLocationFromDebugLoc()

const FullSourceLoc BackendConsumer::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.

Definition at line 541 of file CodeGenAction.cpp.

References clang::Column, getFunctionSourceLocation(), clang::SourceLocation::isInvalid(), and clang::Line.

Referenced by EmitOptimizationMessage(), MisExpectDiagHandler(), and UnsupportedDiagHandler().

◆ getCodeGenerator()

CodeGenerator * clang::BackendConsumer::getCodeGenerator ( )

Definition at line 139 of file CodeGenAction.cpp.

◆ getFunctionSourceLocation()

std::optional< FullSourceLoc > BackendConsumer::getFunctionSourceLocation ( const llvm::Function & F) const

◆ getModule()

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

Definition at line 131 of file CodeGenAction.cpp.

Referenced by HandleTranslationUnit().

◆ HandleCXXStaticMemberVarInstantiation()

void clang::BackendConsumer::HandleCXXStaticMemberVarInstantiation ( VarDecl * D)
overridevirtual

HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.

Reimplemented from clang::ASTConsumer.

Definition at line 143 of file CodeGenAction.cpp.

References clang::ASTConsumer::HandleCXXStaticMemberVarInstantiation().

◆ HandleInlineFunctionDefinition()

void clang::BackendConsumer::HandleInlineFunctionDefinition ( FunctionDecl * D)
overridevirtual

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 178 of file CodeGenAction.cpp.

◆ HandleInterestingDecl()

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

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 191 of file CodeGenAction.cpp.

References HandleTopLevelDecl().

◆ HandleTagDeclDefinition()

void clang::BackendConsumer::HandleTagDeclDefinition ( TagDecl * D)
overridevirtual

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 326 of file CodeGenAction.cpp.

◆ HandleTagDeclRequiredDefinition()

void clang::BackendConsumer::HandleTagDeclRequiredDefinition ( const TagDecl * D)
overridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 333 of file CodeGenAction.cpp.

◆ HandleTopLevelDecl()

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

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 161 of file CodeGenAction.cpp.

References clang::DeclGroupRef::begin().

Referenced by HandleInterestingDecl().

◆ HandleTranslationUnit()

void clang::BackendConsumer::HandleTranslationUnit ( ASTContext & Ctx)
overridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 234 of file CodeGenAction.cpp.

References clang::C, clang::EmbedBitcode(), clang::emitBackendOutput(), clang::Error, getModule(), llvm::hash_value(), LinkInModules(), and clang::reportOptRecordError().

◆ HandleVTable()

void clang::BackendConsumer::HandleVTable ( CXXRecordDecl * RD)
overridevirtual

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 349 of file CodeGenAction.cpp.

◆ Initialize()

void clang::BackendConsumer::Initialize ( ASTContext & Context)
overridevirtual

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

Reimplemented from clang::ASTConsumer.

Definition at line 147 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 486 of file CodeGenAction.cpp.

References ComputeDiagID, clang::SourceLocation::getFromRawEncoding(), and clang::SourceLocation::isValid().

Referenced by DiagnosticHandlerImpl().

◆ LinkInModules()

bool clang::BackendConsumer::LinkInModules ( llvm::Module * M)

◆ MisExpectDiagHandler()

void BackendConsumer::MisExpectDiagHandler ( const llvm::DiagnosticInfoMisExpect & D)

Specialized handler for misexpect warnings.

Note that misexpect remarks are emitted through ORE

Definition at line 743 of file CodeGenAction.cpp.

References clang::Column, getBestLocationFromDebugLoc(), and clang::Line.

Referenced by DiagnosticHandlerImpl().

◆ OptimizationFailureHandler()

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

Definition at line 723 of file CodeGenAction.cpp.

References EmitOptimizationMessage().

Referenced by DiagnosticHandlerImpl().

◆ OptimizationRemarkHandler() [1/3]

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

Definition at line 667 of file CodeGenAction.cpp.

References EmitOptimizationMessage().

Referenced by DiagnosticHandlerImpl().

◆ OptimizationRemarkHandler() [2/3]

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

Definition at line 711 of file CodeGenAction.cpp.

References EmitOptimizationMessage().

◆ OptimizationRemarkHandler() [3/3]

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

Definition at line 699 of file CodeGenAction.cpp.

References EmitOptimizationMessage().

◆ ResourceLimitDiagHandler()

bool BackendConsumer::ResourceLimitDiagHandler ( const llvm::DiagnosticInfoResourceLimit & D)

Specialized handler for ResourceLimit diagnostic.

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

Definition at line 527 of file CodeGenAction.cpp.

References ComputeDiagID, and getFunctionSourceLocation().

Referenced by DiagnosticHandlerImpl().

◆ 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 511 of file CodeGenAction.cpp.

References getFunctionSourceLocation().

Referenced by DiagnosticHandlerImpl().

◆ takeModule()

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

Definition at line 135 of file CodeGenAction.cpp.

◆ UnsupportedDiagHandler()

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

Specialized handler for unsupported backend feature diagnostic.

Definition at line 593 of file CodeGenAction.cpp.

References clang::Column, getBestLocationFromDebugLoc(), and clang::Line.

Referenced by DiagnosticHandlerImpl().


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