Emit debug information for global and static variables when -g is specified.
llvm-svn: 51993
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 5be6872..b802ce7 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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