Skip to content

Commit 5956648

Browse files
committed
Revert "Reapply "[DebugInfo] Alternate (more efficient) MD5 fix""
This reverts commit 2e4d2d8. Invalid checksums detected here: https://lab.llvm.org/buildbot/#/builders/37/builds/24465
1 parent a623689 commit 5956648

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,12 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
391391
SourceManager &SM = CGM.getContext().getSourceManager();
392392
StringRef FileName;
393393
FileID FID;
394-
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
395394

396395
if (Loc.isInvalid()) {
397396
// The DIFile used by the CU is distinct from the main source file. Call
398397
// createFile() below for canonicalization if the source file was specified
399398
// with an absolute path.
400399
FileName = TheCU->getFile()->getFilename();
401-
CSInfo = TheCU->getFile()->getChecksum();
402400
} else {
403401
PresumedLoc PLoc = SM.getPresumedLoc(Loc);
404402
FileName = PLoc.getFilename();
@@ -419,13 +417,13 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
419417
return cast<llvm::DIFile>(V);
420418
}
421419

422-
if (!CSInfo) {
423-
SmallString<64> Checksum;
424-
std::optional<llvm::DIFile::ChecksumKind> CSKind =
420+
SmallString<64> Checksum;
421+
422+
std::optional<llvm::DIFile::ChecksumKind> CSKind =
425423
computeChecksum(FID, Checksum);
426-
if (CSKind)
427-
CSInfo.emplace(*CSKind, Checksum);
428-
}
424+
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
425+
if (CSKind)
426+
CSInfo.emplace(*CSKind, Checksum);
429427
return createFile(FileName, CSInfo, getSource(SM, SM.getFileID(Loc)));
430428
}
431429

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class CGDebugInfo {
148148
llvm::BumpPtrAllocator DebugInfoNames;
149149
StringRef CWDName;
150150

151-
llvm::DenseMap<const char *, llvm::TrackingMDRef> DIFileCache;
151+
llvm::StringMap<llvm::TrackingMDRef> DIFileCache;
152152
llvm::DenseMap<const FunctionDecl *, llvm::TrackingMDRef> SPCache;
153153
/// Cache declarations relevant to DW_TAG_imported_declarations (C++
154154
/// using declarations and global alias variables) that aren't covered

clang/test/CodeGenCXX/debug-info-function-context.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-pc-linux-gnu %s \
2-
// RUN: -dwarf-version=5 -main-file-name debug-info-function-context.cpp -o - | FileCheck %s
2+
// RUN: -dwarf-version=5 -main-file-name %s -o - | FileCheck %s
33

44
struct C {
55
void member_function();
@@ -31,8 +31,8 @@ int global_initialized_variable = C::static_member_function();
3131

3232
// The first DIFile is for the CU, the second is what everything else uses.
3333
// We're using DWARF v5 so both should have MD5 checksums.
34-
// CHECK: !DIFile(filename: "{{.*}}context.cpp",{{.*}} checksumkind: CSK_MD5, checksum: [[CKSUM:".*"]]
35-
// CHECK: ![[FILE:[0-9]+]] = !DIFile(filename: "{{.*}}context.cpp",{{.*}} checksumkind: CSK_MD5, checksum: [[CKSUM]]
34+
// CHECK: !DIFile(filename: "{{.*}}context.cpp",{{.*}} checksumkind: CSK_MD5
35+
// CHECK: ![[FILE:[0-9]+]] = !DIFile(filename: "{{.*}}context.cpp",{{.*}} checksumkind: CSK_MD5
3636
// CHECK: ![[C:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C",
3737
// CHECK: ![[NS:.*]] = !DINamespace(name: "ns"
3838
// CHECK: !DISubprogram(name: "member_function",{{.*}} scope: ![[C]],{{.*}} DISPFlagDefinition

0 commit comments

Comments
 (0)