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
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 5be6872..b802ce7 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -739,6 +739,14 @@
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