[PATCH] D42011: [DWARFv5] Enable MD5 checksums

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 14:12:12 PST 2018


probinson created this revision.
probinson added reviewers: dblaikie, aprantl.
probinson added a project: debug-info.
Herald added subscribers: cfe-commits, JDevlieghere.

Under `-gdwarf-5` generate MD5 checksums of source files to emit to the DWARF v5 line table.

This consumes 16 bytes per source file in the line table, but allows a debugger to verify that
the source file hasn't changed since build time, which Clang has never allowed before.


Repository:
  rC Clang

https://reviews.llvm.org/D42011

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/test/CodeGen/debug-info-file-checksum.c


Index: clang/test/CodeGen/debug-info-file-checksum.c
===================================================================
--- clang/test/CodeGen/debug-info-file-checksum.c
+++ clang/test/CodeGen/debug-info-file-checksum.c
@@ -1,4 +1,5 @@
 // RUN: %clang -emit-llvm -S -g -gcodeview -x c %S/Inputs/debug-info-file-checksum.c -o - | FileCheck %s
+// RUN: %clang -emit-llvm -S -gdwarf-5 -x c %S/Inputs/debug-info-file-checksum.c -o - | FileCheck %s
 
 // Check that "checksum" is created correctly for the compiled file.
 
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -365,7 +365,8 @@
 CGDebugInfo::computeChecksum(FileID FID, SmallString<32> &Checksum) const {
   Checksum.clear();
 
-  if (!CGM.getCodeGenOpts().EmitCodeView)
+  if (!CGM.getCodeGenOpts().EmitCodeView &&
+      CGM.getCodeGenOpts().DwarfVersion < 5)
     return llvm::DIFile::CSK_None;
 
   SourceManager &SM = CGM.getContext().getSourceManager();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42011.129703.patch
Type: text/x-patch
Size: 1056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180112/80b00c77/attachment.bin>


More information about the cfe-commits mailing list