summaryrefslogtreecommitdiff
path: root/lib/MC/MCContext.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2012-12-18 00:31:01 +0000
committerEric Christopher <echristo@gmail.com>2012-12-18 00:31:01 +0000
commit6c583141bf6b7a6b5f8125c1037ecbc089813288 (patch)
tree7e22b30849a5a15a044a3423d0e8df884992ceea /lib/MC/MCContext.cpp
parent2318ba16ef4414eec4bc43eaf6e0703c40e1c580 (diff)
downloadllvm-6c583141bf6b7a6b5f8125c1037ecbc089813288.tar.gz
llvm-6c583141bf6b7a6b5f8125c1037ecbc089813288.tar.bz2
llvm-6c583141bf6b7a6b5f8125c1037ecbc089813288.tar.xz
Add support for passing -main-file-name all the way through to
the assembler. Part of PR14624 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170390 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCContext.cpp')
-rw-r--r--lib/MC/MCContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/MC/MCContext.cpp b/lib/MC/MCContext.cpp
index 29727ac8a6..d206dd9f50 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() {