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-21 15:05:02 +0200
commita4c3ed42ba5625af54254584d762ebf96cc06942 (patch)
tree2659994cf43a543de3e57f50c9eb64c44dd09353 /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
parent88818491b9dea64ec65c92ce5652bc45bef337a4 (diff)
downloadllvm-a4c3ed42ba5625af54254584d762ebf96cc06942.zip
llvm-a4c3ed42ba5625af54254584d762ebf96cc06942.tar.gz
llvm-a4c3ed42ba5625af54254584d762ebf96cc06942.tar.bz2
Correctly emit dwoIDs after ASTFileSignature refactoring (D81347)
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.