summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit906da23229af3e8f11694f6feb125682f02c93dc (patch)
tree3605e50651eb04af950ae0a094aae207fd330a98 /llvm/lib
parenta7c3273e85790b664f7b5d048b12e8c3cb0c3dc4 (diff)
downloadbcm5719-llvm-906da23229af3e8f11694f6feb125682f02c93dc.tar.gz
bcm5719-llvm-906da23229af3e8f11694f6feb125682f02c93dc.zip
Add support for passing -main-file-name all the way through to
the assembler. Part of PR14624 llvm-svn: 170390
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCContext.cpp6
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp3
2 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 29727ac8a6a..d206dd9f504 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/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/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index e1a1f89f423..85d31872a73 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud