From 686226b538e72c5059ab7c9a8f87eb883193b645 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51993 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 5be6872a1e..b802ce7d97 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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-70-g09d2