diff options
author | Paul Robinson <paul.robinson@sony.com> | 2018-01-12 19:17:50 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2018-01-12 19:17:50 +0000 |
commit | 612e89d74f04e9811509582a1d8430173da7cd30 (patch) | |
tree | b13a38dd30bd044f9d15d0f04e11686c7a6f498f /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | abb8dfc1146858cbdf920e0801e055c971ef6de5 (diff) | |
download | bcm5719-llvm-612e89d74f04e9811509582a1d8430173da7cd30.tar.gz bcm5719-llvm-612e89d74f04e9811509582a1d8430173da7cd30.zip |
[DWARFv5] CodeGen support for MD5 file checksums
Pass MD5 checksums through from IR to assembly/object files.
After this, getting Clang to compute the MD5 should be the last step
to supporting MD5 in the DWARF v5 line table header.
Differential Revision: https://reviews.llvm.org/D41926
llvm-svn: 322391
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index 0443bde0cf2..e77e8d9b354 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -94,17 +94,17 @@ void DwarfCompileUnit::addLocalLabelAddress(DIE &Die, DIEInteger(0)); } -unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName, - StringRef DirName, - MD5::MD5Result *Checksum) { +unsigned DwarfCompileUnit::getOrCreateSourceID(const DIFile *File) { // If we print assembly, we can't separate .file entries according to // compile units. Thus all files will belong to the default compile unit. // FIXME: add a better feature test than hasRawTextSupport. Even better, // extend .file to support this. + unsigned CUID = Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID(); + if (!File) + return Asm->OutStreamer->EmitDwarfFileDirective(0, "", "", nullptr, CUID); return Asm->OutStreamer->EmitDwarfFileDirective( - 0, DirName, FileName, Checksum, - Asm->OutStreamer->hasRawTextSupport() ? 0 : getUniqueID()); + 0, File->getDirectory(), File->getFilename(), getMD5AsBytes(File), CUID); } DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE( @@ -444,7 +444,7 @@ DIE *DwarfCompileUnit::constructInlinedScopeDIE(LexicalScope *Scope) { // Add the call site information to the DIE. const DILocation *IA = Scope->getInlinedAt(); addUInt(*ScopeDIE, dwarf::DW_AT_call_file, None, - getOrCreateSourceID(IA->getFilename(), IA->getDirectory(), nullptr)); + getOrCreateSourceID(IA->getFile())); addUInt(*ScopeDIE, dwarf::DW_AT_call_line, None, IA->getLine()); if (IA->getDiscriminator() && DD->getDwarfVersion() >= 4) addUInt(*ScopeDIE, dwarf::DW_AT_GNU_discriminator, None, @@ -688,9 +688,7 @@ DIE *DwarfCompileUnit::constructImportedEntityDIE( else EntityDie = getDIE(Entity); assert(EntityDie); - auto *File = Module->getFile(); - addSourceLine(*IMDie, Module->getLine(), File ? File->getFilename() : "", - File ? File->getDirectory() : ""); + addSourceLine(*IMDie, Module->getLine(), Module->getFile()); addDIEEntry(*IMDie, dwarf::DW_AT_import, *EntityDie); StringRef Name = Module->getName(); if (!Name.empty()) |