r333319 - Revert "[DebugInfo] Don't bother with MD5 checksums of preprocessed files."
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Fri May 25 15:35:59 PDT 2018
Author: probinson
Date: Fri May 25 15:35:59 2018
New Revision: 333319
URL: http://llvm.org/viewvc/llvm-project?rev=333319&view=rev
Log:
Revert "[DebugInfo] Don't bother with MD5 checksums of preprocessed files."
This reverts commit d734f2aa3f76fbf355ecd2bbe081d0c1f49867ab.
Also known as r333311. A very small but nonzero number of bots fail.
Removed:
cfe/trunk/test/CodeGen/md5-checksum-crash.c
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=333319&r1=333318&r2=333319&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri May 25 15:35:59 2018
@@ -67,8 +67,6 @@ CGDebugInfo::CGDebugInfo(CodeGenModule &
DBuilder(CGM.getModule()) {
for (const auto &KV : CGM.getCodeGenOpts().DebugPrefixMap)
DebugPrefixMap[KV.first] = KV.second;
- EmitFileChecksums = CGM.getCodeGenOpts().EmitCodeView ||
- CGM.getCodeGenOpts().DwarfVersion >= 5;
CreateCompileUnit();
}
@@ -367,21 +365,15 @@ Optional<llvm::DIFile::ChecksumKind>
CGDebugInfo::computeChecksum(FileID FID, SmallString<32> &Checksum) const {
Checksum.clear();
- if (!EmitFileChecksums)
+ if (!CGM.getCodeGenOpts().EmitCodeView &&
+ CGM.getCodeGenOpts().DwarfVersion < 5)
return None;
SourceManager &SM = CGM.getContext().getSourceManager();
bool Invalid;
- const SrcMgr::SLocEntry &Entry = SM.getSLocEntry(FID, &Invalid);
- if (Invalid || !Entry.isFile())
+ llvm::MemoryBuffer *MemBuffer = SM.getBuffer(FID, &Invalid);
+ if (Invalid)
return None;
- if (Entry.getFile().hasLineDirectives()) {
- // This must be a preprocessed file; its content won't match the original
- // source; therefore checksumming the text we have is pointless or wrong.
- EmitFileChecksums = false;
- return None;
- }
- llvm::MemoryBuffer *MemBuffer = SM.getBuffer(FID);
llvm::MD5 Hash;
llvm::MD5::MD5Result Result;
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=333319&r1=333318&r2=333319&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Fri May 25 15:35:59 2018
@@ -57,7 +57,6 @@ class CGDebugInfo {
CodeGenModule &CGM;
const codegenoptions::DebugInfoKind DebugKind;
bool DebugTypeExtRefs;
- mutable bool EmitFileChecksums;
llvm::DIBuilder DBuilder;
llvm::DICompileUnit *TheCU = nullptr;
ModuleMap *ClangModuleMap = nullptr;
Removed: cfe/trunk/test/CodeGen/md5-checksum-crash.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/md5-checksum-crash.c?rev=333318&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/md5-checksum-crash.c (original)
+++ cfe/trunk/test/CodeGen/md5-checksum-crash.c (removed)
@@ -1,13 +0,0 @@
-// RUN: %clang_cc1 -triple %itanium_abi_triple -debug-info-kind=limited -dwarf-version=5 %s -emit-llvm -o- | FileCheck %s
-// RUN: %clang_cc1 -triple %ms_abi_triple -gcodeview -debug-info-kind=limited %s -emit-llvm -o- | FileCheck %s
-
-// This had been crashing, no MD5 checksum for string.h.
-// Now if there are #line directives, don't bother with checksums
-// as a preprocessed file won't properly reflect the original source.
-#define __NTH fct
-void fn1() {}
-# 7 "/usr/include/string.h"
-void __NTH() {}
-// Verify no checksum attributes on these files.
-// CHECK-DAG: DIFile(filename: "{{.*}}.c", directory: "{{[^"]*}}")
-// CHECK-DAG: DIFile(filename: "{{.*}}string.h", directory: "{{[^"]*}}")
More information about the cfe-commits
mailing list