diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2008-06-05 08:59:10 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2008-06-05 08:59:10 +0000 |
commit | 158143ad54821178b5202c82c41f6926ba0ef24e (patch) | |
tree | bd0f38247bbb04068a53055fbb0573657eb8aa3f /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | e0c5adc158ab869c04113682c34d60bd890d6962 (diff) | |
download | bcm5719-llvm-158143ad54821178b5202c82c41f6926ba0ef24e.tar.gz bcm5719-llvm-158143ad54821178b5202c82c41f6926ba0ef24e.zip |
Emit debug information for global and static variables when -g is specified.
llvm-svn: 51993
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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 |