clang: lib/CodeGen/BackendConsumer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_LIB_CODEGEN_BACKENDCONSUMER_H

10#define LLVM_CLANG_LIB_CODEGEN_BACKENDCONSUMER_H

11

14

15#include "llvm/IR/DiagnosticInfo.h"

16#include "llvm/Support/Timer.h"

17

18namespace llvm {

19 class DiagnosticInfoDontCall;

20}

21

23class ASTContext;

24class CodeGenAction;

25class CoverageSourceInfo;

26

28 using LinkModule = CodeGenAction::LinkModule;

29

30 virtual void anchor();

36 std::unique_ptr<raw_pwrite_stream> AsmOutStream;

39

40 llvm::Timer LLVMIRGeneration;

41 unsigned LLVMIRGenerationRefCount = 0;

42

43

44

45

46 bool IRGenFinished = false;

47

48 bool TimerIsEnabled = false;

49

51

52 std::unique_ptr Gen;

53

55

56

57

58

59

60

61

62

63

64 std::vector<std::pair<llvm::hash_code, FullSourceLoc>>

65 ManglingFullSourceLocs;

66

67

68

69

70 llvm::Module *CurLinkModule = nullptr;

71

72public:

76 StringRef InFile, std::unique_ptr<raw_pwrite_stream> OS,

78 llvm::Module *CurLinkModule = nullptr);

79

81 std::unique_ptrllvm::Module takeModule();

82

84

97

98

100

101

102

104 const llvm::DiagnosticInfoWithLocationBase &D,

105 bool &BadDebugInfo, StringRef &Filename,

106 unsigned &Line, unsigned &Column) const;

107

109 const llvm::Function &F) const;

110

112

113

114

116

118

119

120

122

123

124

126

127

129

130

131

133 unsigned DiagID);

134 void

137 const llvm::OptimizationRemarkAnalysisFPCommute &D);

139 const llvm::OptimizationRemarkAnalysisAliasing &D);

141 const llvm::DiagnosticInfoOptimizationFailure &D);

143

144

146};

147

148}

149#endif

ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

llvm::Module * getModule() const

void CompleteExternalDeclaration(DeclaratorDecl *D) override

CompleteExternalDeclaration - Callback invoked at the end of a translation unit to notify the consume...

void OptimizationRemarkHandler(const llvm::DiagnosticInfoOptimizationBase &D)

bool StackSizeDiagHandler(const llvm::DiagnosticInfoStackSize &D)

Specialized handler for StackSize diagnostic.

void HandleVTable(CXXRecordDecl *RD) override

Callback involved at the end of a translation unit to notify the consumer that a vtable for the given...

void HandleTagDeclDefinition(TagDecl *D) override

HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.

bool HandleTopLevelDecl(DeclGroupRef D) override

HandleTopLevelDecl - Handle the specified top-level declaration.

void Initialize(ASTContext &Ctx) override

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

void HandleInlineFunctionDefinition(FunctionDecl *D) override

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

void OptimizationFailureHandler(const llvm::DiagnosticInfoOptimizationFailure &D)

void DiagnosticHandlerImpl(const llvm::DiagnosticInfo &DI)

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

void HandleTagDeclRequiredDefinition(const TagDecl *D) override

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

void HandleInterestingDecl(DeclGroupRef D) override

HandleInterestingDecl - Handle the specified interesting declaration.

void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override

HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.

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

bool ResourceLimitDiagHandler(const llvm::DiagnosticInfoResourceLimit &D)

Specialized handler for ResourceLimit diagnostic.

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

void AssignInheritanceModel(CXXRecordDecl *RD) override

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

void HandleTranslationUnit(ASTContext &C) override

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

void CompleteTentativeDefinition(VarDecl *D) override

CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...

void UnsupportedDiagHandler(const llvm::DiagnosticInfoUnsupported &D)

Specialized handler for unsupported backend feature diagnostic.

bool InlineAsmDiagHandler(const llvm::DiagnosticInfoInlineAsm &D)

Specialized handler for InlineAsm diagnostic.

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.

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

Specialized handlers for optimization remarks.

void DontCallDiagHandler(const llvm::DiagnosticInfoDontCall &D)

void MisExpectDiagHandler(const llvm::DiagnosticInfoMisExpect &D)

Specialized handler for misexpect warnings.

CodeGenerator * getCodeGenerator()

void SrcMgrDiagHandler(const llvm::DiagnosticInfoSrcMgr &D)

Specialized handler for diagnostics reported using SMDiagnostic.

Represents a C++ struct/union/class.

CodeGenOptions - Track various options which control how the code is optimized and passed to the back...

The primary public interface to the Clang code generator.

CompilerInstance - Helper class for managing a single instance of the Clang compiler.

Stores additional source code information like skipped ranges which is required by the coverage mappi...

Represents a ValueDecl that came out of a declarator.

Concrete class used by the front-end to report problems and issues.

A SourceLocation and its associated SourceManager.

Represents a function declaration or definition.

Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...

Represents the declaration of a struct/union/class/enum.

Options for controlling the target.

Represents a variable declaration or definition.

The JSON file list parser is used to communicate input to InstallAPI.

Diagnostic wrappers for TextAPI types for error reporting.