summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-11-21 00:20:58 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-11-21 00:20:58 +0000
commitaf08085c8632504106b8a9604fee12702399b549 (patch)
treed8569c34be0a745b24a9a58ec2d50c5260f0a846 /clang/lib/CodeGen/CGDebugInfo.cpp
parentc57059059d7f0047024b971e4f75418cdee9b761 (diff)
downloadbcm5719-llvm-af08085c8632504106b8a9604fee12702399b549.tar.gz
bcm5719-llvm-af08085c8632504106b8a9604fee12702399b549.zip
DebugInfo: Fix another case of r222377 when we do have a definition of the variable, but we might not be emitting it (such as templates)
llvm-svn: 222485
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 9506cef31d2..e91b6fdf298 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3275,23 +3275,19 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD,
if (isa<FunctionDecl>(VD->getDeclContext()))
return;
VD = cast<ValueDecl>(VD->getCanonicalDecl());
- llvm::DIDescriptor DContext =
- getContextDescriptor(dyn_cast<Decl>(VD->getDeclContext()));
auto *VarD = cast<VarDecl>(VD);
-
- // If this is only a declaration, it might be the declaration of a static
- // variable with an initializer - we still want to ensure that's emitted, but
- // merely calling getContextDescriptor above has already ensured that. Since
- // there's no definition to emit, there's no further work to do.
- if (!VarD->hasDefinition()) {
+ if (VarD->isStaticDataMember()) {
+ auto *RD = cast<RecordDecl>(VarD->getDeclContext());
+ getContextDescriptor(RD);
// Ensure that the type is retained even though it's otherwise unreferenced.
RetainedTypes.push_back(
- CGM.getContext()
- .getRecordType(cast<RecordDecl>(VD->getDeclContext()))
- .getAsOpaquePtr());
+ CGM.getContext().getRecordType(RD).getAsOpaquePtr());
return;
}
+ llvm::DIDescriptor DContext =
+ getContextDescriptor(dyn_cast<Decl>(VD->getDeclContext()));
+
auto pair = DeclCache.insert(std::make_pair(VD, llvm::WeakVH()));
if (!pair.second)
return;
OpenPOWER on IntegriCloud