summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-04-29 17:48:37 +0000
committerDevang Patel <dpatel@apple.com>2010-04-29 17:48:37 +0000
commitdfcd0661a1a45976e2f23d14dadc2d3411e4ef2c (patch)
tree6a87c1fb04e090ecd373f4960a9b7553015df225 /clang
parent3b9ad93a353d7d571b3df847a516825ede0fd4e2 (diff)
downloadbcm5719-llvm-dfcd0661a1a45976e2f23d14dadc2d3411e4ef2c.tar.gz
bcm5719-llvm-dfcd0661a1a45976e2f23d14dadc2d3411e4ef2c.zip
Use clang::VarDecl name instead of llvm::GlobalVariable name.
llvm::GLobalVariable name may not match user visibile name for function static variables. llvm-svn: 102644
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp2
-rw-r--r--clang/test/CodeGen/2009-10-20-GlobalDebug.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 4991c0ff022..4963e73fe46 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1601,7 +1601,7 @@ void CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable *Var,
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,
diff --git a/clang/test/CodeGen/2009-10-20-GlobalDebug.c b/clang/test/CodeGen/2009-10-20-GlobalDebug.c
index 99be46996ed..1db37de4bb2 100644
--- a/clang/test/CodeGen/2009-10-20-GlobalDebug.c
+++ b/clang/test/CodeGen/2009-10-20-GlobalDebug.c
@@ -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;
+}
OpenPOWER on IntegriCloud