diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCContext.cpp | 6 | ||||
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp index 29727ac..d206dd9 100644 --- a/lib/MC/MCContext.cpp +++ b/lib/MC/MCContext.cpp @@ -21,6 +21,7 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/Support/ELF.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" #include "llvm/Support/SourceMgr.h" using namespace llvm; @@ -48,6 +49,11 @@ MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri, SecureLogFile = getenv("AS_SECURE_LOG_FILE"); SecureLog = 0; SecureLogUsed = false; + + if (SrcMgr && SrcMgr->getNumBuffers() > 0) + MainFileName = SrcMgr->getMemoryBuffer(0)->getBufferIdentifier(); + else + MainFileName = ""; } MCContext::~MCContext() { diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index e1a1f89..85d3187 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -613,7 +613,8 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { getStreamer().EmitLabel(SectionStartSym); getContext().setGenDwarfSectionStartSym(SectionStartSym); getStreamer().EmitDwarfFileDirective(getContext().nextGenDwarfFileNumber(), - StringRef(), SrcMgr.getMemoryBuffer(CurBuffer)->getBufferIdentifier()); + StringRef(), + getContext().getMainFileName()); } // While we have input, parse each statement. |