diff options
author | Devang Patel <dpatel@apple.com> | 2010-05-13 23:52:37 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-05-13 23:52:37 +0000 |
commit | 8b90a7804b15b0d203650df123fb236b86da8cc0 (patch) | |
tree | cc3fead996c2a394396a80e54312593e1588a7f1 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 1297fd72b1a3d7985c5c5e3e3a09b8acb2696358 (diff) |
Fix context in class static variable's debugging information entry.
This fixes bunch of failures in gdb testsuite.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 3076487539..019779bd05 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -64,7 +64,14 @@ llvm::DIDescriptor CGDebugInfo::getContextDescriptor(const Decl *Context, // Check namespace. if (const NamespaceDecl *NSDecl = dyn_cast<NamespaceDecl>(Context)) return llvm::DIDescriptor(getOrCreateNameSpace(NSDecl, CompileUnit)); - + + if (const RecordDecl *RDecl = dyn_cast<RecordDecl>(Context)) { + if (!RDecl->isDependentType()) { + llvm::DIType Ty = getOrCreateType(CGM.getContext().getTypeDeclType(RDecl), + llvm::DIFile(CompileUnit)); + return llvm::DIDescriptor(Ty); + } + } return CompileUnit; } @@ -1567,11 +1574,13 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var, ArrayType::Normal, 0); } llvm::StringRef DeclName = D->getName(); + llvm::StringRef LinkageName; + if (D->getDeclContext() && isa<FunctionDecl>(D->getDeclContext())) + LinkageName = Var->getName(); llvm::DIDescriptor DContext = getContextDescriptor(dyn_cast<Decl>(D->getDeclContext()), Unit); - DebugFactory.CreateGlobalVariable(DContext, DeclName, - DeclName, llvm::StringRef(), Unit, LineNo, - getOrCreateType(T, Unit), + DebugFactory.CreateGlobalVariable(DContext, DeclName, DeclName, LinkageName, + Unit, LineNo, getOrCreateType(T, Unit), Var->hasInternalLinkage(), true/*definition*/, Var); } |