summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-06-21 16:42:03 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-06-21 16:42:03 +0000
commit547adcaaac64d2f4802e194c38309ad4e48a158f (patch)
tree9d05b878281420db788f42e5ee670a7ff01025bd /llvm/lib/MC/MCParser/AsmParser.cpp
parentddfe69cc995d55ed45a46da18a81072c6effc9e1 (diff)
downloadbcm5719-llvm-547adcaaac64d2f4802e194c38309ad4e48a158f.tar.gz
bcm5719-llvm-547adcaaac64d2f4802e194c38309ad4e48a158f.zip
[DWARF] Warn on and ignore ".file 0" for DWARF v4 and earlier.
This had been messing with the directory table for prior versions, and also could induce a crash when generating asm output. llvm-svn: 335254
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 00418ac70ba..12c7ddee706 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3362,9 +3362,11 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
memcpy(SourceBuf, SourceString.data(), SourceString.size());
Source = StringRef(SourceBuf, SourceString.size());
}
- if (FileNumber == 0)
+ if (FileNumber == 0) {
+ if (Ctx.getDwarfVersion() < 5)
+ return Warning(DirectiveLoc, "file 0 not supported prior to DWARF-5");
getStreamer().emitDwarfFile0Directive(Directory, Filename, CKMem, Source);
- else {
+ } else {
Expected<unsigned> FileNumOrErr = getStreamer().tryEmitDwarfFileDirective(
FileNumber, Directory, Filename, CKMem, Source);
if (!FileNumOrErr)
OpenPOWER on IntegriCloud