[cfe-commits] r103745 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Thu May 13 16:52:37 PDT 2010


Author: dpatel
Date: Thu May 13 18:52:37 2010
New Revision: 103745

URL: http://llvm.org/viewvc/llvm-project?rev=103745&view=rev
Log:
Fix context in class static variable's debugging information entry.
This fixes bunch of failures in gdb testsuite.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=103745&r1=103744&r2=103745&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu May 13 18:52:37 2010
@@ -64,7 +64,14 @@
   // 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 @@
                                            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);
 }





More information about the cfe-commits mailing list