aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-08-21 14:21:21 +0200
committerRaphael Isemann <teemperor@gmail.com>2020-08-24 14:52:53 +0200
commit105151ca5669a0536fb5bb1bc02bd3279cdbbfda (patch)
tree1db783d34d7c06dd4247920a86675ea3e122d2b4 /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
parent577f8b157a03055821341146ed0617e3b103fdaf (diff)
downloadllvm-105151ca5669a0536fb5bb1bc02bd3279cdbbfda.zip
llvm-105151ca5669a0536fb5bb1bc02bd3279cdbbfda.tar.gz
llvm-105151ca5669a0536fb5bb1bc02bd3279cdbbfda.tar.bz2
Reland "Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)"
The orignal patch with the missing 'REQUIRES: asserts' as there is a debug-only flag used in the test. Original summary: D81347 changes the ASTFileSignature to be an array of 20 uint8_t instead of 5 uint32_t. However, it didn't update the code in ObjectFilePCHContainerOperations that creates the dwoID in the module from the ASTFileSignature (`Buffer->Signature` being the array subclass that is now `std::array<uint8_t, 20>` instead of `std::array<uint32_t, 5>`). ``` uint64_t Signature = [..] (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0] ``` This code works with the old ASTFileSignature (where two uint32_t are enough to fill the uint64_t), but after the patch this only took two bytes from the ASTFileSignature and only partly filled the Signature uint64_t. This caused that the dwoID in the module ref and the dwoID in the actual module no longer match (which in turns causes that LLDB keeps warning about the dwoID's not matching when debugging -gmodules-compiled binaries). This patch just unifies the logic for turning the ASTFileSignature into an uint64_t which makes the dwoID match again (and should prevent issues like that in the future). Reviewed By: aprantl, dang Differential Revision: https://reviews.llvm.org/D84013
Diffstat (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r--clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index 0c7e5f4..04bd668 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -250,10 +250,10 @@ public:
// 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
- ? (uint64_t)Buffer->Signature[1] << 32 | Buffer->Signature[0]
- : ~1ULL;
+ Buffer->Signature ? Buffer->Signature.truncatedValue() : ~1ULL;
+
Builder->getModuleDebugInfo()->setDwoId(Signature);
// Finalize the Builder.