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
This commit is contained in:
Devang Patel 2010-04-29 17:48:37 +00:00
parent 3b9ad93a35
commit dfcd0661a1
2 changed files with 7 additions and 3 deletions

View File

@ -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,

View File

@ -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;
}