From 158143ad54821178b5202c82c41f6926ba0ef24e Mon Sep 17 00:00:00 2001 From: Sanjiv Gupta Date: Thu, 5 Jun 2008 08:59:10 +0000 Subject: Emit debug information for global and static variables when -g is specified. llvm-svn: 51993 --- clang/lib/CodeGen/CodeGenModule.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5be6872a1ec..b802ce7d97c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -739,6 +739,14 @@ void CodeGenModule::EmitGlobalVarInit(const VarDecl *D) { break; } } + + // Emit global variable debug information. + CGDebugInfo *DI = getDebugInfo(); + if(DI) { + if(D->getLocation().isValid()) + DI->setLocation(D->getLocation()); + DI->EmitGlobalVariable(GV, D); + } } /// EmitGlobalVarDeclarator - Emit all the global vars attached to the specified -- cgit v1.2.3