diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-11-09 00:42:03 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-11-09 00:42:03 +0000 |
commit | 338ef7a82c720b73faf64b31605aa2709b0cf14a (patch) | |
tree | bb74c6b600ab7fabebdbe3b64300353895883b4a /clang/lib/CodeGen | |
parent | a50bc7fddb321214e16babe0a4e1964422c81454 (diff) | |
download | bcm5719-llvm-338ef7a82c720b73faf64b31605aa2709b0cf14a.tar.gz bcm5719-llvm-338ef7a82c720b73faf64b31605aa2709b0cf14a.zip |
Emit debug info for global constants whose address is taken exactly once.
Add a check to the DeclCache before emitting debug info for a
GlobalVariable a second time and just attach the previsously created one to it.
<rdar://problem/26721101>
llvm-svn: 286322
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index b17d2482a78..c4e7ffdd54e 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -3675,6 +3675,13 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, assert(DebugKind >= codegenoptions::LimitedDebugInfo); if (D->hasAttr<NoDebugAttr>()) return; + + // If we already created a DIGlobalVariable for this declaration, just attach + // it to the llvm::GlobalVariable. + auto Cached = DeclCache.find(D->getCanonicalDecl()); + if (Cached != DeclCache.end()) + return Var->addDebugInfo(cast<llvm::DIGlobalVariable>(Cached->second)); + // Create global variable debug descriptor. llvm::DIFile *Unit = nullptr; llvm::DIScope *DContext = nullptr; |