From c96da8faa65b723899744b0fc5c23f4b286fcc02 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 22 Jan 2016 17:43:43 +0000 Subject: Module Debugging: Use a nonzero DWO id for precompiled headers. PCH files don't have a module signature and LLVM uses a nonzero DWO id as an indicator for skeleton / module CUs. This change pins the DWO id for PCH files to a known constant value. The correct long-term solution here is to implement a module signature that is an actual dterministic hash (at the moment module signatures are just random nonzero numbers) and then enable this for PCH files as well. llvm-svn: 258507 --- clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp') diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index cd17832554d..2178ec21c7a 100644 --- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -219,7 +219,11 @@ public: M->setTargetTriple(Ctx.getTargetInfo().getTriple().getTriple()); M->setDataLayout(Ctx.getTargetInfo().getDataLayoutString()); - Builder->getModuleDebugInfo()->setDwoId(Buffer->Signature); + + // 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. + uint64_t Signature = Buffer->Signature ? Buffer->Signature : ~1U; + Builder->getModuleDebugInfo()->setDwoId(Signature); // Finalize the Builder. if (Builder) -- cgit v1.2.3