24 #include "llvm/ADT/SmallString.h"
25 #include "llvm/Bitcode/ReaderWriter.h"
26 #include "llvm/IR/DebugInfo.h"
27 #include "llvm/IR/DiagnosticInfo.h"
28 #include "llvm/IR/DiagnosticPrinter.h"
29 #include "llvm/IR/LLVMContext.h"
30 #include "llvm/IR/Module.h"
31 #include "llvm/IRReader/IRReader.h"
32 #include "llvm/Linker/Linker.h"
33 #include "llvm/Pass.h"
34 #include "llvm/Support/MemoryBuffer.h"
35 #include "llvm/Support/SourceMgr.h"
36 #include "llvm/Support/Timer.h"
38 using namespace clang;
43 virtual void anchor();
49 raw_pwrite_stream *AsmOutStream;
52 Timer LLVMIRGeneration;
54 std::unique_ptr<CodeGenerator> Gen;
56 std::unique_ptr<llvm::Module> TheModule;
62 llvm::Module *CurLinkModule =
nullptr;
70 bool TimePasses,
const std::string &InFile,
71 const SmallVectorImpl<std::pair<unsigned, llvm::Module *>> &LinkModules,
72 raw_pwrite_stream *OS, LLVMContext &
C,
74 : Diags(Diags), Action(Action), CodeGenOpts(CodeGenOpts),
75 TargetOpts(TargetOpts), LangOpts(LangOpts), AsmOutStream(OS),
76 Context(nullptr), LLVMIRGeneration(
"LLVM IR Generation Time"),
78 CodeGenOpts, C, CoverageInfo)) {
79 llvm::TimePassesIsEnabled = TimePasses;
80 for (
auto &
I : LinkModules)
81 this->LinkModules.push_back(
82 std::make_pair(
I.first, std::unique_ptr<llvm::Module>(
I.second)));
84 std::unique_ptr<llvm::Module>
takeModule() {
return std::move(TheModule); }
86 for (
auto &
I : LinkModules)
91 Gen->HandleCXXStaticMemberVarInstantiation(VD);
95 assert(!
Context &&
"initialized multiple times");
99 if (llvm::TimePassesIsEnabled)
100 LLVMIRGeneration.startTimer();
102 Gen->Initialize(Ctx);
104 TheModule.reset(Gen->GetModule());
106 if (llvm::TimePassesIsEnabled)
107 LLVMIRGeneration.stopTimer();
113 "LLVM IR generation of declaration");
115 if (llvm::TimePassesIsEnabled)
116 LLVMIRGeneration.startTimer();
118 Gen->HandleTopLevelDecl(D);
120 if (llvm::TimePassesIsEnabled)
121 LLVMIRGeneration.stopTimer();
129 "LLVM IR generation of inline method");
130 if (llvm::TimePassesIsEnabled)
131 LLVMIRGeneration.startTimer();
133 Gen->HandleInlineMethodDefinition(D);
135 if (llvm::TimePassesIsEnabled)
136 LLVMIRGeneration.stopTimer();
141 PrettyStackTraceString CrashInfo(
"Per-file LLVM IR generation");
142 if (llvm::TimePassesIsEnabled)
143 LLVMIRGeneration.startTimer();
145 Gen->HandleTranslationUnit(C);
147 if (llvm::TimePassesIsEnabled)
148 LLVMIRGeneration.stopTimer();
157 llvm::Module *M = Gen->ReleaseModule();
165 assert(TheModule.get() == M &&
166 "Unexpected module change during IR generation");
170 LLVMContext &Ctx = TheModule->getContext();
171 LLVMContext::InlineAsmDiagHandlerTy OldHandler =
172 Ctx.getInlineAsmDiagnosticHandler();
173 void *OldContext = Ctx.getInlineAsmDiagnosticContext();
174 Ctx.setInlineAsmDiagnosticHandler(InlineAsmDiagHandler,
this);
176 LLVMContext::DiagnosticHandlerTy OldDiagnosticHandler =
177 Ctx.getDiagnosticHandler();
178 void *OldDiagnosticContext = Ctx.getDiagnosticContext();
179 Ctx.setDiagnosticHandler(DiagnosticHandler,
this);
182 for (
auto &
I : LinkModules) {
183 unsigned LinkFlags =
I.first;
184 CurLinkModule =
I.second.get();
185 if (Linker::linkModules(*M, std::move(
I.second), LinkFlags))
191 TheModule.get(),
Action, AsmOutStream);
193 Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);
195 Ctx.setDiagnosticHandler(OldDiagnosticHandler, OldDiagnosticContext);
201 "LLVM IR generation of declaration");
202 Gen->HandleTagDeclDefinition(D);
206 Gen->HandleTagDeclRequiredDefinition(D);
210 Gen->CompleteTentativeDefinition(D);
214 Gen->HandleVTable(RD);
218 Gen->HandleLinkerOptionPragma(Opts);
222 llvm::StringRef
Value)
override {
223 Gen->HandleDetectMismatch(Name, Value);
227 Gen->HandleDependentLibrary(Opts);
231 unsigned LocCookie) {
241 void InlineAsmDiagHandler2(
const llvm::SMDiagnostic &,
244 void DiagnosticHandlerImpl(
const llvm::DiagnosticInfo &DI);
248 bool InlineAsmDiagHandler(
const llvm::DiagnosticInfoInlineAsm &D);
252 bool StackSizeDiagHandler(
const llvm::DiagnosticInfoStackSize &D);
256 void EmitOptimizationMessage(
const llvm::DiagnosticInfoOptimizationBase &D,
259 OptimizationRemarkHandler(
const llvm::DiagnosticInfoOptimizationRemark &D);
260 void OptimizationRemarkHandler(
261 const llvm::DiagnosticInfoOptimizationRemarkMissed &D);
262 void OptimizationRemarkHandler(
263 const llvm::DiagnosticInfoOptimizationRemarkAnalysis &D);
264 void OptimizationRemarkHandler(
265 const llvm::DiagnosticInfoOptimizationRemarkAnalysisFPCommute &D);
266 void OptimizationRemarkHandler(
267 const llvm::DiagnosticInfoOptimizationRemarkAnalysisAliasing &D);
268 void OptimizationFailureHandler(
269 const llvm::DiagnosticInfoOptimizationFailure &D);
272 void BackendConsumer::anchor() {}
286 const MemoryBuffer *LBuf =
287 LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
291 std::unique_ptr<llvm::MemoryBuffer> CBuf =
292 llvm::MemoryBuffer::getMemBufferCopy(LBuf->getBuffer(),
293 LBuf->getBufferIdentifier());
298 unsigned Offset = D.getLoc().getPointer() - LBuf->getBufferStart();
314 StringRef Message = D.getMessage();
315 if (Message.startswith(
"error: "))
316 Message = Message.substr(7);
320 if (D.getLoc() != SMLoc())
324 switch (D.getKind()) {
325 case llvm::SourceMgr::DK_Error:
326 DiagID = diag::err_fe_inline_asm;
328 case llvm::SourceMgr::DK_Warning:
329 DiagID = diag::warn_fe_inline_asm;
331 case llvm::SourceMgr::DK_Note:
332 DiagID = diag::note_fe_inline_asm;
339 Diags.Report(LocCookie, DiagID).AddString(Message);
341 if (D.getLoc().isValid()) {
345 for (
const std::pair<unsigned, unsigned> &Range : D.getRanges()) {
346 unsigned Column = D.getColumnNo();
357 Diags.Report(Loc, DiagID).AddString(Message);
360 #define ComputeDiagID(Severity, GroupName, DiagID) \
362 switch (Severity) { \
363 case llvm::DS_Error: \
364 DiagID = diag::err_fe_##GroupName; \
366 case llvm::DS_Warning: \
367 DiagID = diag::warn_fe_##GroupName; \
369 case llvm::DS_Remark: \
370 llvm_unreachable("'remark' severity not expected"); \
372 case llvm::DS_Note: \
373 DiagID = diag::note_fe_##GroupName; \
378 #define ComputeDiagRemarkID(Severity, GroupName, DiagID) \
380 switch (Severity) { \
381 case llvm::DS_Error: \
382 DiagID = diag::err_fe_##GroupName; \
384 case llvm::DS_Warning: \
385 DiagID = diag::warn_fe_##GroupName; \
387 case llvm::DS_Remark: \
388 DiagID = diag::remark_fe_##GroupName; \
390 case llvm::DS_Note: \
391 DiagID = diag::note_fe_##GroupName; \
400 std::string Message = D.getMsgStr().str();
408 Diags.Report(LocCookie, DiagID).AddString(Message);
415 Diags.Report(Loc, DiagID).AddString(Message);
423 if (D.getSeverity() != llvm::DS_Warning)
428 if (
const Decl *ND = Gen->GetDeclForMangledName(D.getFunction().getName())) {
429 Diags.Report(ND->getASTContext().getFullLoc(ND->getLocation()),
430 diag::warn_fe_frame_larger_than)
439 const llvm::DiagnosticInfoOptimizationBase &D,
unsigned DiagID) {
441 assert(D.getSeverity() == llvm::DS_Remark ||
442 D.getSeverity() == llvm::DS_Warning);
450 if (D.isLocationAvailable()) {
451 D.getLocation(&Filename, &Line, &Column);
453 if (FE && Line > 0) {
456 DILoc = SourceMgr.translateFileLineCol(FE, Line, Column ? Column : 1);
465 if (
const Decl *FD = Gen->GetDeclForMangledName(D.getFunction().getName()))
466 Loc = FD->getASTContext().getFullLoc(FD->getBodyRBrace());
468 Diags.Report(Loc, DiagID)
472 if (DILoc.
isInvalid() && D.isLocationAvailable())
477 Diags.Report(Loc, diag::note_fe_backend_optimization_remark_invalid_loc)
478 << Filename << Line <<
Column;
482 const llvm::DiagnosticInfoOptimizationRemark &D) {
485 if (CodeGenOpts.OptimizationRemarkPattern &&
486 CodeGenOpts.OptimizationRemarkPattern->match(D.getPassName()))
487 EmitOptimizationMessage(D, diag::remark_fe_backend_optimization_remark);
491 const llvm::DiagnosticInfoOptimizationRemarkMissed &D) {
495 if (CodeGenOpts.OptimizationRemarkMissedPattern &&
496 CodeGenOpts.OptimizationRemarkMissedPattern->match(D.getPassName()))
497 EmitOptimizationMessage(D,
498 diag::remark_fe_backend_optimization_remark_missed);
502 const llvm::DiagnosticInfoOptimizationRemarkAnalysis &D) {
507 if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
508 (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
509 CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName())))
510 EmitOptimizationMessage(
511 D, diag::remark_fe_backend_optimization_remark_analysis);
515 const llvm::DiagnosticInfoOptimizationRemarkAnalysisFPCommute &D) {
520 if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
521 (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
522 CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName())))
523 EmitOptimizationMessage(
524 D, diag::remark_fe_backend_optimization_remark_analysis_fpcommute);
528 const llvm::DiagnosticInfoOptimizationRemarkAnalysisAliasing &D) {
533 if (D.getPassName() == llvm::DiagnosticInfo::AlwaysPrint ||
534 (CodeGenOpts.OptimizationRemarkAnalysisPattern &&
535 CodeGenOpts.OptimizationRemarkAnalysisPattern->match(D.getPassName())))
536 EmitOptimizationMessage(
537 D, diag::remark_fe_backend_optimization_remark_analysis_aliasing);
541 const llvm::DiagnosticInfoOptimizationFailure &D) {
542 EmitOptimizationMessage(D, diag::warn_fe_backend_optimization_failure);
548 unsigned DiagID = diag::err_fe_inline_asm;
549 llvm::DiagnosticSeverity
Severity = DI.getSeverity();
551 switch (DI.getKind()) {
552 case llvm::DK_InlineAsm:
553 if (InlineAsmDiagHandler(cast<DiagnosticInfoInlineAsm>(DI)))
557 case llvm::DK_StackSize:
558 if (StackSizeDiagHandler(cast<DiagnosticInfoStackSize>(DI)))
563 assert(CurLinkModule);
565 if (Severity != DS_Error)
567 DiagID = diag::err_fe_cannot_link_module;
569 case llvm::DK_OptimizationRemark:
572 OptimizationRemarkHandler(cast<DiagnosticInfoOptimizationRemark>(DI));
574 case llvm::DK_OptimizationRemarkMissed:
577 OptimizationRemarkHandler(cast<DiagnosticInfoOptimizationRemarkMissed>(DI));
579 case llvm::DK_OptimizationRemarkAnalysis:
582 OptimizationRemarkHandler(
583 cast<DiagnosticInfoOptimizationRemarkAnalysis>(DI));
585 case llvm::DK_OptimizationRemarkAnalysisFPCommute:
588 OptimizationRemarkHandler(
589 cast<DiagnosticInfoOptimizationRemarkAnalysisFPCommute>(DI));
591 case llvm::DK_OptimizationRemarkAnalysisAliasing:
594 OptimizationRemarkHandler(
595 cast<DiagnosticInfoOptimizationRemarkAnalysisAliasing>(DI));
597 case llvm::DK_OptimizationFailure:
600 OptimizationFailureHandler(cast<DiagnosticInfoOptimizationFailure>(DI));
607 std::string MsgStorage;
609 raw_string_ostream Stream(MsgStorage);
610 DiagnosticPrinterRawOStream DP(Stream);
614 if (DiagID == diag::err_fe_cannot_link_module) {
615 Diags.Report(diag::err_fe_cannot_link_module)
616 << CurLinkModule->getModuleIdentifier() << MsgStorage;
622 Diags.Report(Loc, DiagID).AddString(MsgStorage);
627 : Act(_Act), VMContext(_VMContext ? _VMContext : new LLVMContext),
628 OwnsVMContext(!_VMContext) {}
644 if (!LinkModules.empty())
652 return std::move(TheModule);
656 OwnsVMContext =
false;
660 static raw_pwrite_stream *
677 llvm_unreachable(
"Invalid action!");
680 std::unique_ptr<ASTConsumer>
688 if (LinkModules.empty())
690 const std::string &LinkBCFile =
I.second;
695 << LinkBCFile << BCBuf.getError().message();
700 ErrorOr<std::unique_ptr<llvm::Module>> ModuleOrErr =
701 getLazyBitcodeModule(std::move(*BCBuf), *VMContext);
702 if (std::error_code EC = ModuleOrErr.getError()) {
716 std::unique_ptr<PPCallbacks>(CoverageInfo));
723 OS, *VMContext, CoverageInfo));
725 return std::move(Result);
730 unsigned LocCookie) {
731 SM.print(
nullptr, llvm::errs());
746 llvm::MemoryBuffer *MainFile = SM.
getBuffer(FID, &Invalid);
750 llvm::SMDiagnostic Err;
751 TheModule = parseIR(MainFile->getMemBufferRef(), Err, *VMContext);
757 if (Err.getLineNo() > 0) {
758 assert(Err.getColumnNo() >= 0);
760 Err.getLineNo(), Err.getColumnNo() + 1);
764 StringRef Msg = Err.getMessage();
765 if (Msg.startswith(
"error: "))
775 if (TheModule->getTargetTriple() != TargetOpts.
Triple) {
777 diag::warn_fe_override_module)
779 TheModule->setTargetTriple(TargetOpts.
Triple);
782 LLVMContext &Ctx = TheModule->getContext();
786 TheModule.get(), BA, OS);
796 void EmitAssemblyAction::anchor() { }
800 void EmitBCAction::anchor() { }
804 void EmitLLVMAction::anchor() { }
808 void EmitLLVMOnlyAction::anchor() { }
812 void EmitCodeGenOnlyAction::anchor() { }
816 void EmitObjAction::anchor() { }
void EmitOptimizationMessage(const llvm::DiagnosticInfoOptimizationBase &D, unsigned DiagID)
Specialized handlers for optimization remarks.
Defines the clang::ASTContext interface.
LangOptions & getLangOpts()
void HandleInlineMethodDefinition(CXXMethodDecl *D) override
This callback is invoked each time an inline method definition is completed.
PreprocessorOptions & getPreprocessorOpts()
static void InlineAsmDiagHandler(const llvm::SMDiagnostic &SM, void *Context, unsigned LocCookie)
static DeclContext * castToDeclContext(const Decl *)
Implements support for file system lookup, file system caching, and directory search management...
bool hasIRSupport() const override
Does this action support use with IR files?
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs...
Defines the clang::FileManager interface and associated types.
Emit human-readable LLVM assembly.
Run CodeGen, but don't emit anything.
void EndSourceFileAction() override
Callback at the end of processing a single input.
void ExecuteAction() override
Implement the ExecuteAction interface by running Sema on the already-initialized AST consumer...
Defines the SourceManager interface.
Decl - This represents one declaration (or definition), e.g.
CompilerInstance & getCompilerInstance() const
bool HandleTopLevelDecl(DeclGroupRef D) override
HandleTopLevelDecl - Handle the specified top-level declaration.
llvm::MemoryBuffer * getBuffer(FileID FID, SourceLocation Loc, bool *Invalid=nullptr) const
Return the buffer for the specified FileID.
Stores additional source code information like skipped ranges which is required by the coverage mappi...
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
void HandleTagDeclRequiredDefinition(const TagDecl *D) override
This callback is invoked the first time each TagDecl is required to be complete.
std::unique_ptr< llvm::Module > takeModule()
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
TargetInfo & getTarget() const
Don't emit anything (benchmarking mode)
VarDecl - An instance of this class is created to represent a variable declaration or definition...
SourceManager & getSourceManager() const
Return the current source manager.
Options for controlling the target.
Severity
Enum values that allow the client to map NOTEs, WARNINGs, and EXTENSIONs to either Ignore (nothing)...
const char * getDataLayoutString() const
void HandleTagDeclDefinition(TagDecl *D) override
HandleTagDeclDefinition - This callback is invoked each time a TagDecl (e.g.
InputKind getCurrentFileKind() const
static raw_pwrite_stream * GetOutputStream(CompilerInstance &CI, StringRef InFile, BackendAction Action)
bool StackSizeDiagHandler(const llvm::DiagnosticInfoStackSize &D)
Specialized handler for StackSize diagnostic.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
#define ComputeDiagRemarkID(Severity, GroupName, DiagID)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
void OptimizationFailureHandler(const llvm::DiagnosticInfoOptimizationFailure &D)
void CompleteTentativeDefinition(VarDecl *D) override
CompleteTentativeDefinition - Callback invoked at the end of a translation unit to notify the consume...
CodeGenOptions & getCodeGenOpts()
void ExecuteAction() override
Callback to run the program action, using the initialized compiler instance.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts, const TargetOptions &TOpts, const LangOptions &LOpts, StringRef TDesc, llvm::Module *M, BackendAction Action, raw_pwrite_stream *OS)
const TargetInfo & getTargetInfo() const
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
FrontendOptions & getFrontendOpts()
Concrete class used by the front-end to report problems and issues.
void DiagnosticHandlerImpl(const llvm::DiagnosticInfo &DI)
This function is invoked when the backend needs to report something to the user.
void OptimizationRemarkHandler(const llvm::DiagnosticInfoOptimizationRemark &D)
static void DiagnosticHandler(const llvm::DiagnosticInfo &DI, void *Context)
static void BitcodeInlineAsmDiagHandler(const llvm::SMDiagnostic &SM, void *Context, unsigned LocCookie)
HeaderSearchOptions & getHeaderSearchOpts()
SourceLocation translateFileLineCol(const FileEntry *SourceFile, unsigned Line, unsigned Col) const
Get the source location for the given file:line:col triplet.
detail::InMemoryDirectory::const_iterator I
Preprocessor & getPreprocessor() const
Return the current preprocessor.
void releaseLinkModules()
const FileEntry * getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
A little helper class used to produce diagnostics.
BackendConsumer * BEConsumer
const FileEntry * getFileEntryForID(FileID FID) const
Returns the FileEntry record for the provided FileID.
EmitLLVMAction(llvm::LLVMContext *_VMContext=nullptr)
~CodeGenAction() override
CodeGenAction(unsigned _Act, llvm::LLVMContext *_VMContext=nullptr)
Create a new code generation action.
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, unsigned LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
unsigned ShowTimers
Show timers for individual actions.
Defines the clang::Preprocessor interface.
Emit native object files.
EmitObjAction(llvm::LLVMContext *_VMContext=nullptr)
DiagnosticsEngine & getDiagnostics() const
Get the current diagnostics engine.
The result type of a method or function.
EmitBCAction(llvm::LLVMContext *_VMContext=nullptr)
static FullSourceLoc ConvertBackendLocation(const llvm::SMDiagnostic &D, SourceManager &CSM)
ConvertBackendLocation - Convert a location in a temporary llvm::SourceMgr buffer to be a valid FullS...
Emit native assembly files.
BackendConsumer(BackendAction Action, DiagnosticsEngine &Diags, const HeaderSearchOptions &HeaderSearchOpts, const PreprocessorOptions &PPOpts, const CodeGenOptions &CodeGenOpts, const TargetOptions &TargetOpts, const LangOptions &LangOpts, bool TimePasses, const std::string &InFile, const SmallVectorImpl< std::pair< unsigned, llvm::Module * >> &LinkModules, raw_pwrite_stream *OS, LLVMContext &C, CoverageSourceInfo *CoverageInfo=nullptr)
EmitCodeGenOnlyAction(llvm::LLVMContext *_VMContext=nullptr)
CompilerInstance - Helper class for managing a single instance of the Clang compiler.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
TagDecl - Represents the declaration of a struct/union/class/enum.
const StringRef getCurrentFile() const
Cached information about one file (either on disk or in the virtual file system). ...
Represents a static or instance method of a struct/union/class.
void HandleLinkerOptionPragma(llvm::StringRef Opts) override
Handle a pragma that appends to Linker Options.
#define ComputeDiagID(Severity, GroupName, DiagID)
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
FileID getMainFileID() const
Returns the FileID of the main source file.
EmitLLVMOnlyAction(llvm::LLVMContext *_VMContext=nullptr)
std::unique_ptr< llvm::Module > takeModule()
Take the generated LLVM module, for use after the action has been run.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
llvm::raw_null_ostream * createNullOutputFile()
FileManager & getFileManager() const
Return the current file manager to the caller.
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(const FileEntry *Entry, bool isVolatile=false, bool ShouldCloseOpenFile=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
void HandleDependentLibrary(llvm::StringRef Opts) override
Handle a dependent library created by a pragma in the source.
void InlineAsmDiagHandler2(const llvm::SMDiagnostic &, SourceLocation LocCookie)
InlineAsmDiagHandler2 - This function is invoked when the backend hits an error parsing inline asm...
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 Initialize(ASTContext &Ctx) override
Initialize - This is called to initialize the consumer, providing the ASTContext. ...
void addLinkModule(llvm::Module *Mod, unsigned LinkFlags)
setLinkModule - Set the link module to be used by this action.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
std::unique_ptr< ASTConsumer > CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override
Create the AST consumer object for this action, if supported.
SourceManager & getSourceManager()
raw_pwrite_stream * createDefaultOutputFile(bool Binary=true, StringRef BaseInput="", StringRef Extension="")
Create the default output file (from the invocation's options) and add it to the list of tracked outp...
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
EmitAssemblyAction(llvm::LLVMContext *_VMContext=nullptr)
Represents a C++ struct/union/class.
llvm::LLVMContext * takeLLVMContext()
Take the LLVM context used by this action.
CodeGenerator * CreateLLVMCodeGen(DiagnosticsEngine &Diags, const std::string &ModuleName, const HeaderSearchOptions &HeaderSearchOpts, const PreprocessorOptions &PreprocessorOpts, const CodeGenOptions &CGO, llvm::LLVMContext &C, CoverageSourceInfo *CoverageInfo=nullptr)
CreateLLVMCodeGen - Create a CodeGenerator instance.
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD) override
HandleCXXStaticMemberVarInstantiation - Tell the consumer that this.
Defines the clang::TargetInfo interface.
A SourceLocation and its associated SourceManager.
std::vector< std::pair< unsigned, std::string > > LinkBitcodeFiles
The name of the bitcode file to link before optzns.
void HandleTranslationUnit(ASTContext &C) override
HandleTranslationUnit - This method is called when the ASTs for entire translation unit have been par...
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file. ...
A trivial tuple used to represent a source range.
std::string Triple
If given, the name of the target triple to compile for.
TargetOptions & getTargetOpts()
void HandleDetectMismatch(llvm::StringRef Name, llvm::StringRef Value) override
Handle a pragma that emits a mismatch identifier and value to the object file for the linker to work ...
void addPPCallbacks(std::unique_ptr< PPCallbacks > C)
This class handles loading and caching of source files into memory.
PrettyStackTraceDecl - If a crash occurs, indicate that it happened when doing something to a specifi...