summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/AsmParser.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2018-03-06 01:59:56 +0000
committerPaul Robinson <paul.robinson@sony.com>2018-03-06 01:59:56 +0000
commitd5069ba3da031774ad6b751f0f72c65e7dda9b04 (patch)
treeefa6dae9e93355da9e17edf2ba279c6ae71bdbf9 /llvm/lib/MC/MCParser/AsmParser.cpp
parentb8b9af2ad46ff1ed901956c155c48c15cb585fa9 (diff)
downloadbcm5719-llvm-d5069ba3da031774ad6b751f0f72c65e7dda9b04.tar.gz
bcm5719-llvm-d5069ba3da031774ad6b751f0f72c65e7dda9b04.zip
[DWARFv5] Emit file 0 to the line table.
DWARF v5 specifies that the root file (also given in the DW_AT_name attribute of the compilation unit DIE) should be emitted explicitly to the line table's list of files. This makes the line table more independent of the .debug_info section. Differential Revision: https://reviews.llvm.org/D44054 llvm-svn: 326758
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 76eef5e3725..062c7117b68 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3258,8 +3258,8 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
FileNumber = getTok().getIntVal();
Lex();
- if (FileNumber < 1)
- return TokError("file number less than one");
+ if (FileNumber < 0)
+ return TokError("negative file number");
}
std::string Path = getTok().getString();
@@ -3338,6 +3338,8 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
// we turn off -g option, directly use the existing debug info instead.
if (getContext().getGenDwarfForAssembly())
getContext().setGenDwarfForAssembly(false);
+ else if (FileNumber == 0)
+ getStreamer().emitDwarfFile0Directive(Directory, Filename, CKMem, Source);
else {
Expected<unsigned> FileNumOrErr = getStreamer().tryEmitDwarfFileDirective(
FileNumber, Directory, Filename, CKMem, Source);
OpenPOWER on IntegriCloud