diff options
author | Ali Tamur <tamur@google.com> | 2019-03-25 21:09:07 +0000 |
---|---|---|
committer | Ali Tamur <tamur@google.com> | 2019-03-25 21:09:07 +0000 |
commit | fdce82a814c05b1f89ae50c494845b27ec043891 (patch) | |
tree | f1eb5306630129c5eddd9e46289e6ac27a70dafd /llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | |
parent | e3959de26867d65410d4d5e1fc8c9c8f5bb2951a (diff) | |
download | bcm5719-llvm-fdce82a814c05b1f89ae50c494845b27ec043891.tar.gz bcm5719-llvm-fdce82a814c05b1f89ae50c494845b27ec043891.zip |
Revert "[llvm] Prevent duplicate files in debug line header in dwarf 5."
This reverts commit 312ab05887d0e2caa29aaf843cefe39379a98d36.
My commit broke the build; I will revert and find out what happened.
llvm-svn: 356951
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp index 6ad06a8553e..53420187773 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -1017,28 +1017,14 @@ bool DWARFDebugLine::LineTable::lookupAddressRangeImpl( } bool DWARFDebugLine::LineTable::hasFileAtIndex(uint64_t FileIndex) const { - uint16_t DwarfVersion = Prologue.getVersion(); - assert(DwarfVersion != 0 && "LineTable has no dwarf version information"); - if (DwarfVersion >= 5) - return FileIndex < Prologue.FileNames.size(); - else - return FileIndex != 0 && FileIndex <= Prologue.FileNames.size(); -} -const llvm::DWARFDebugLine::FileNameEntry & -DWARFDebugLine::LineTable::getFileNameEntry(uint64_t Index) const { - uint16_t DwarfVersion = Prologue.getVersion(); - assert(DwarfVersion != 0 && "LineTable has no dwarf version information"); - if (DwarfVersion >= 5) - return Prologue.FileNames[Index]; - else - return Prologue.FileNames[Index - 1]; + return FileIndex != 0 && FileIndex <= Prologue.FileNames.size(); } Optional<StringRef> DWARFDebugLine::LineTable::getSourceByIndex(uint64_t FileIndex, FileLineInfoKind Kind) const { if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex)) return None; - const FileNameEntry &Entry = getFileNameEntry(FileIndex); + const FileNameEntry &Entry = Prologue.FileNames[FileIndex - 1]; if (Optional<const char *> source = Entry.Source.getAsCString()) return StringRef(*source); return None; @@ -1058,7 +1044,7 @@ bool DWARFDebugLine::LineTable::getFileNameByIndex(uint64_t FileIndex, std::string &Result) const { if (Kind == FileLineInfoKind::None || !hasFileAtIndex(FileIndex)) return false; - const FileNameEntry &Entry = getFileNameEntry(FileIndex); + const FileNameEntry &Entry = Prologue.FileNames[FileIndex - 1]; StringRef FileName = Entry.Name.getAsCString().getValue(); if (Kind != FileLineInfoKind::AbsoluteFilePath || isPathAbsoluteOnWindowsOrPosix(FileName)) { |