[cfe-commits] r102644 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGen/2009-10-20-GlobalDebug.c

Devang Patel dpatel at apple.com
Thu Apr 29 10:48:37 PDT 2010


Author: dpatel
Date: Thu Apr 29 12:48:37 2010
New Revision: 102644

URL: http://llvm.org/viewvc/llvm-project?rev=102644&view=rev
Log:
Use clang::VarDecl name instead of llvm::GlobalVariable name.
llvm::GLobalVariable name may not match user visibile name for function static variables.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/test/CodeGen/2009-10-20-GlobalDebug.c

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=102644&r1=102643&r2=102644&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Apr 29 12:48:37 2010
@@ -1601,7 +1601,7 @@
     T = CGM.getContext().getConstantArrayType(ET, ConstVal,
                                            ArrayType::Normal, 0);
   }
-  llvm::StringRef DeclName = Var->getName();
+  llvm::StringRef DeclName = D->getName();
   llvm::DIDescriptor DContext = 
     getContextDescriptor(dyn_cast<Decl>(D->getDeclContext()), Unit);
   DebugFactory.CreateGlobalVariable(DContext, DeclName,

Modified: cfe/trunk/test/CodeGen/2009-10-20-GlobalDebug.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/2009-10-20-GlobalDebug.c?rev=102644&r1=102643&r2=102644&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/2009-10-20-GlobalDebug.c (original)
+++ cfe/trunk/test/CodeGen/2009-10-20-GlobalDebug.c Thu Apr 29 12:48:37 2010
@@ -1,4 +1,8 @@
 // RUN: %clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
 int global;
-// CHECK: asciz "global" ## External Name
-int main() { return 0;}
+// CHECK: asciz   "global" ## External Name
+// CHECK: asciz   "localstatic"          ## External Name
+int main() { 
+  static int localstatic;
+  return 0;
+}





More information about the cfe-commits mailing list