diff options
author | Paul Robinson <paul.robinson@sony.com> | 2018-06-22 14:16:11 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2018-06-22 14:16:11 +0000 |
commit | 11539b0969468cbab46a5b920a5454b016ccc4b9 (patch) | |
tree | 531399d789460d2335fdac157d04fa0190d4ab0e /llvm/lib/MC/MCContext.cpp | |
parent | 1e564504bb17c65a46bbd7dc2ee6a45e78a8101e (diff) | |
download | bcm5719-llvm-11539b0969468cbab46a5b920a5454b016ccc4b9.tar.gz bcm5719-llvm-11539b0969468cbab46a5b920a5454b016ccc4b9.zip |
[DWARFv5] Allow ".loc 0" to refer to the root file.
DWARF v5 explicitly represents file #0 in the line table. Prior
versions did not, so ".loc 0" is still an error in those cases.
Differential Revision: https://reviews.llvm.org/D48452
llvm-svn: 335350
Diffstat (limited to 'llvm/lib/MC/MCContext.cpp')
-rw-r--r-- | llvm/lib/MC/MCContext.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp index 5c4d67b10dd..e4f90f4987a 100644 --- a/llvm/lib/MC/MCContext.cpp +++ b/llvm/lib/MC/MCContext.cpp @@ -556,11 +556,13 @@ Expected<unsigned> MCContext::getDwarfFile(StringRef Directory, /// isValidDwarfFileNumber - takes a dwarf file number and returns true if it /// currently is assigned and false otherwise. bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) { - const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles = getMCDwarfFiles(CUID); - if (FileNumber == 0 || FileNumber >= MCDwarfFiles.size()) + const MCDwarfLineTable &LineTable = getMCDwarfLineTable(CUID); + if (FileNumber == 0) + return getDwarfVersion() >= 5 && LineTable.hasRootFile(); + if (FileNumber >= LineTable.getMCDwarfFiles().size()) return false; - return !MCDwarfFiles[FileNumber].Name.empty(); + return !LineTable.getMCDwarfFiles()[FileNumber].Name.empty(); } /// Remove empty sections from SectionStartEndSyms, to avoid generating |