Skip to content

Commit

Permalink
Revert "Reland "Correctly emit dwoIDs after ASTFileSignature refactor…
Browse files Browse the repository at this point in the history
…ing (D81347)""

This reverts commit ada2e8e. Still breaking
on Fuchsia (and also Fedora) with exit code 1, so back to investigating.
  • Loading branch information
Teemperor committed Aug 24, 2020
1 parent 4ce176b commit 2b3074c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 46 deletions.
9 changes: 0 additions & 9 deletions clang/include/clang/Basic/Module.h
Expand Up @@ -62,15 +62,6 @@ struct ASTFileSignature : std::array<uint8_t, 20> {

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

/// Returns the value truncated to the size of an uint64_t.
uint64_t truncatedValue() const {
uint64_t Value = 0;
static_assert(sizeof(*this) >= sizeof(uint64_t), "No need to truncate.");
for (unsigned I = 0; I < sizeof(uint64_t); ++I)
Value |= static_cast<uint64_t>((*this)[I]) << (I * 8);
return Value;
}

static ASTFileSignature create(StringRef Bytes) {
return create(Bytes.bytes_begin(), Bytes.bytes_end());
}
Expand Down
9 changes: 5 additions & 4 deletions clang/lib/CodeGen/CGDebugInfo.cpp
Expand Up @@ -2545,11 +2545,12 @@ llvm::DIModule *CGDebugInfo::getOrCreateModuleRef(ASTSourceDescriptor Mod,
// We use the lower 64 bits for debug info.

uint64_t Signature = 0;
if (const auto &ModSig = Mod.getSignature())
Signature = ModSig.truncatedValue();
else
if (const auto &ModSig = Mod.getSignature()) {
for (unsigned I = 0; I != sizeof(Signature); ++I)
Signature |= (uint64_t)ModSig[I] << (I * 8);
} else {
Signature = ~1ULL;

}
llvm::DIBuilder DIB(CGM.getModule());
SmallString<0> PCM;
if (!llvm::sys::path::is_absolute(Mod.getASTFile()))
Expand Down
6 changes: 3 additions & 3 deletions clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
Expand Up @@ -250,10 +250,10 @@ class PCHContainerGenerator : public ASTConsumer {
// PCH files don't have a signature field in the control block,
// but LLVM detects DWO CUs by looking for a non-zero DWO id.
// We use the lower 64 bits for debug info.

uint64_t Signature =
Buffer->Signature ? Buffer->Signature.truncatedValue() : ~1ULL;

Buffer->Signature
? (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
: ~1ULL;
Builder->getModuleDebugInfo()->setDwoId(Signature);

// Finalize the Builder.
Expand Down
4 changes: 0 additions & 4 deletions clang/test/Modules/Inputs/DebugDwoId.h

This file was deleted.

4 changes: 0 additions & 4 deletions clang/test/Modules/Inputs/module.map
Expand Up @@ -357,10 +357,6 @@ module DebugObjCImport {
}
}

module DebugDwoId {
header "DebugDwoId.h"
}

module ImportNameInDir {
header "ImportNameInDir.h"
export *
Expand Down
22 changes: 0 additions & 22 deletions clang/test/Modules/ModuleDebugInfoDwoId.cpp

This file was deleted.

0 comments on commit 2b3074c

Please sign in to comment.