Index: include/llvm/MC/MCContext.h =================================================================== --- include/llvm/MC/MCContext.h +++ include/llvm/MC/MCContext.h @@ -59,6 +59,9 @@ /// The SourceMgr for this object, if any. const SourceMgr *SrcMgr; + /// The SourceMgr for inline assembly, if any. + SourceMgr *InlineSrcMgr; + /// The MCAsmInfo for this target. const MCAsmInfo *MAI; @@ -240,6 +243,8 @@ const SourceMgr *getSourceManager() const { return SrcMgr; } + void setInlineSourceManager(SourceMgr *SM) { InlineSrcMgr = SM; } + const MCAsmInfo *getAsmInfo() const { return MAI; } const MCRegisterInfo *getRegisterInfo() const { return MRI; } Index: lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -95,6 +95,8 @@ SourceMgr &SrcMgr = *getInlineSourceManager(); SrcMgr.setIncludeDirs(MCOptions.IASSearchPaths); + MCContext &Context = MMI->getContext(); + Context.setInlineSourceManager(&SrcMgr); // If the current LLVMContext has an inline asm handler, set it in SourceMgr. LLVMContext &LLVMCtx = MMI->getModule()->getContext();