diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 28e28489681..4e0cc3f8574 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1740,11 +1740,14 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod, bool IsRootModule = M ? !M->Parent : true; if (CreateSkeletonCU && IsRootModule) { + // PCH files don't have a signature field in the control block, + // but LLVM detects skeleton CUs by looking for a non-zero DWO id. + uint64_t Signature = Mod.getSignature() ? Mod.getSignature() : ~1U; llvm::DIBuilder DIB(CGM.getModule()); DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.getModuleName(), Mod.getPath(), TheCU->getProducer(), true, StringRef(), 0, Mod.getASTFile(), - llvm::DIBuilder::FullDebug, Mod.getSignature()); + llvm::DIBuilder::FullDebug, Signature); DIB.finalize(); } llvm::DIModule *Parent = 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) |