summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAli Tamur <tamur@google.com>2019-03-26 20:05:27 +0000
committerAli Tamur <tamur@google.com>2019-03-26 20:05:27 +0000
commit02e96648d75bcd04ad8b4a9e976c8ff8d1a9419e (patch)
treee353f6e7d239fcf8401a7ea35bf4415cc68f7c60 /llvm/lib
parentcea954802817b60e16f89044a9f3ba29cea3a443 (diff)
downloadbcm5719-llvm-02e96648d75bcd04ad8b4a9e976c8ff8d1a9419e.tar.gz
bcm5719-llvm-02e96648d75bcd04ad8b4a9e976c8ff8d1a9419e.zip
Revert "[llvm] Reapply "Prevent duplicate files in debug line header in dwarf 5.""
This reverts commit rL357020. The commit broke the test llvm/test/tools/llvm-objdump/embedded-source.test on some builds including clang-ppc64be-linux-multistage, clang-s390x-linux, clang-with-lto-ubuntu, clang-x64-windows-msvc, llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast (and others). llvm-svn: 357026
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp1
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp20
-rw-r--r--llvm/lib/MC/MCContext.cpp5
-rw-r--r--llvm/lib/MC/MCDwarf.cpp11
6 files changed, 6 insertions, 33 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
index 683d3245e56..d9addb52376 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -101,7 +101,6 @@ class DwarfCompileUnit final : public DwarfUnit {
}
public:
- unsigned getDwarfVersion() const { return DD->getDwarfVersion(); }
DwarfCompileUnit(unsigned UID, const DICompileUnit *Node, AsmPrinter *A,
DwarfDebug *DW, DwarfFile *DWU);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 226014cf0bb..0e0a5b24864 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -319,7 +319,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
: DebugHandlerBase(A), DebugLocs(A->OutStreamer->isVerboseAsm()),
InfoHolder(A, "info_string", DIEValueAllocator),
SkeletonHolder(A, "skel_string", DIEValueAllocator),
- SplitTypeUnitFileTable(A->getDwarfVersion()),
IsDarwin(A->TM.getTargetTriple().isOSDarwin()) {
const Triple &TT = Asm->TM.getTargetTriple();
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 5d8e236a6b3..6e547469c24 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -397,6 +397,7 @@ void DwarfUnit::addSourceLine(DIE &Die, unsigned Line, const DIFile *File) {
return;
unsigned FileID = getOrCreateSourceID(File);
+ assert(FileID && "Invalid file id");
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);
}
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)) {
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 348436f4bd0..49fad131a2c 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -603,8 +603,7 @@ Expected<unsigned> MCContext::getDwarfFile(StringRef Directory,
MD5::MD5Result *Checksum,
Optional<StringRef> Source,
unsigned CUID) {
- MCDwarfLineTable &Table =
- MCDwarfLineTablesCUMap.emplace(CUID, DwarfVersion).first->second;
+ MCDwarfLineTable &Table = MCDwarfLineTablesCUMap[CUID];
return Table.tryGetFile(Directory, FileName, Checksum, Source, FileNumber);
}
@@ -613,7 +612,7 @@ Expected<unsigned> MCContext::getDwarfFile(StringRef Directory,
bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
const MCDwarfLineTable &LineTable = getMCDwarfLineTable(CUID);
if (FileNumber == 0)
- return getDwarfVersion() >= 5;
+ return getDwarfVersion() >= 5 && LineTable.hasRootFile();
if (FileNumber >= LineTable.getMCDwarfFiles().size())
return false;
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index 73b4d4bcd19..83b6b4f1aa3 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -542,15 +542,6 @@ Expected<unsigned> MCDwarfLineTable::tryGetFile(StringRef &Directory,
return Header.tryGetFile(Directory, FileName, Checksum, Source, FileNumber);
}
-bool isRootFile(const MCDwarfFile &RootFile, StringRef &Directory,
- StringRef &FileName, MD5::MD5Result *Checksum) {
- if (RootFile.Name.empty() || RootFile.Name != FileName.data())
- return false;
- if (!RootFile.Checksum)
- return !Checksum;
- return *RootFile.Checksum == *Checksum;
-}
-
Expected<unsigned>
MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
StringRef &FileName,
@@ -570,8 +561,6 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
trackMD5Usage(Checksum);
HasSource = (Source != None);
}
- if (isRootFile(RootFile, Directory, FileName, Checksum) && DwarfVersion >= 5)
- return 0;
if (FileNumber == 0) {
// File numbers start with 1 and/or after any file numbers
// allocated by inline-assembler .file directives.
OpenPOWER on IntegriCloud