summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2014-11-05 19:19:04 +0000
committerFrederic Riss <friss@apple.com>2014-11-05 19:19:04 +0000
commitb1ab28c94998646a6b608a1fb75e4e72d9b288f2 (patch)
treed45eae291da1fd091ee2e35bd2bdc2376ec26061 /clang/lib/CodeGen/CGDebugInfo.cpp
parentb6e51ff1e7480c42971415e6484e5ca65dc99822 (diff)
downloadbcm5719-llvm-b1ab28c94998646a6b608a1fb75e4e72d9b288f2.tar.gz
bcm5719-llvm-b1ab28c94998646a6b608a1fb75e4e72d9b288f2.zip
[DebugInfo] Do not record artificial global initializer functions in the DeclCache.
When we are generating the global initializer functions, we call CGDebugInfo::EmitFunctionStart() with a valid decl which is describing the initialized global variable. Do not update the DeclCache with this key as it will overwrite the the cached variable DIGlobalVariable with the newly created artificial DISubprogram. One could wonder if we should put artificial subprograms in the DIE tree at all (there are vaild uses for them carrying line information though). llvm-svn: 221385
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index ea8002ab969..44428412968 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2527,7 +2527,10 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, SourceLocation Loc,
getOrCreateFunctionType(D, FnType, Unit), Fn->hasInternalLinkage(),
true /*definition*/, ScopeLine, Flags, CGM.getLangOpts().Optimize, Fn,
TParamsArray, getFunctionDeclaration(D));
- if (HasDecl)
+ // We might get here with a VarDecl in the case we're generating
+ // code for the initialization of globals. Do not record these decls
+ // as they will overwrite the actual VarDecl Decl in the cache.
+ if (HasDecl && isa<FunctionDecl>(D))
DeclCache.insert(std::make_pair(D->getCanonicalDecl(), llvm::WeakVH(SP)));
// Push the function onto the lexical block stack.
OpenPOWER on IntegriCloud