Skip to content

Commit c1dd5df

Browse files
committed
Revert "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"
This reverts commit a4c3ed4. The test is curiously failing with a plain exit code 1 on Fuchsia.
1 parent 8eded24 commit c1dd5df

File tree

6 files changed

+8
-44
lines changed

6 files changed

+8
-44
lines changed

clang/include/clang/Basic/Module.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,6 @@ struct ASTFileSignature : std::array<uint8_t, 20> {
6262

6363
explicit operator bool() const { return *this != BaseT({{0}}); }
6464

65-
/// Returns the value truncated to the size of an uint64_t.
66-
uint64_t truncatedValue() const {
67-
uint64_t Value = 0;
68-
static_assert(sizeof(*this) >= sizeof(uint64_t), "No need to truncate.");
69-
for (unsigned I = 0; I < sizeof(uint64_t); ++I)
70-
Value |= static_cast<uint64_t>((*this)[I]) << (I * 8);
71-
return Value;
72-
}
73-
7465
static ASTFileSignature create(StringRef Bytes) {
7566
return create(Bytes.bytes_begin(), Bytes.bytes_end());
7667
}

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,11 +2545,12 @@ llvm::DIModule *CGDebugInfo::getOrCreateModuleRef(ASTSourceDescriptor Mod,
25452545
// We use the lower 64 bits for debug info.
25462546

25472547
uint64_t Signature = 0;
2548-
if (const auto &ModSig = Mod.getSignature())
2549-
Signature = ModSig.truncatedValue();
2550-
else
2548+
if (const auto &ModSig = Mod.getSignature()) {
2549+
for (unsigned I = 0; I != sizeof(Signature); ++I)
2550+
Signature |= (uint64_t)ModSig[I] << (I * 8);
2551+
} else {
25512552
Signature = ~1ULL;
2552-
2553+
}
25532554
llvm::DIBuilder DIB(CGM.getModule());
25542555
SmallString<0> PCM;
25552556
if (!llvm::sys::path::is_absolute(Mod.getASTFile()))

clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ class PCHContainerGenerator : public ASTConsumer {
250250
// PCH files don't have a signature field in the control block,
251251
// but LLVM detects DWO CUs by looking for a non-zero DWO id.
252252
// We use the lower 64 bits for debug info.
253-
254253
uint64_t Signature =
255-
Buffer->Signature ? Buffer->Signature.truncatedValue() : ~1ULL;
256-
254+
Buffer->Signature
255+
? (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
256+
: ~1ULL;
257257
Builder->getModuleDebugInfo()->setDwoId(Signature);
258258

259259
// Finalize the Builder.

clang/test/Modules/Inputs/DebugDwoId.h

Lines changed: 0 additions & 4 deletions
This file was deleted.

clang/test/Modules/Inputs/module.map

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,6 @@ module DebugObjCImport {
357357
}
358358
}
359359

360-
module DebugDwoId {
361-
header "DebugDwoId.h"
362-
}
363-
364360
module ImportNameInDir {
365361
header "ImportNameInDir.h"
366362
export *

clang/test/Modules/ModuleDebugInfoDwoId.cpp

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)