summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDeclCXX.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-07-24 01:40:49 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-07-24 01:40:49 +0000
commit085970736f7e7c12bf592da908db5d31c09aa8c9 (patch)
tree6c7d28ce696870c7198652627d6e69d11ced7df4 /clang/lib/CodeGen/CGDeclCXX.cpp
parentcfb4517cc0df43b61d3dff5f2286d568f25804a5 (diff)
downloadbcm5719-llvm-085970736f7e7c12bf592da908db5d31c09aa8c9.tar.gz
bcm5719-llvm-085970736f7e7c12bf592da908db5d31c09aa8c9.zip
Emit debug info for dynamic initializers. Permit __attribute__((nodebug)) on
variables that have static storage duration, it removes debug info on the emitted initializer function but not all debug info about this variable. llvm-svn: 160659
Diffstat (limited to 'clang/lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGDeclCXX.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index 893628e08a8..492b95ad155 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -321,9 +321,12 @@ void CodeGenFunction::GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
const VarDecl *D,
llvm::GlobalVariable *Addr,
bool PerformInit) {
- StartFunction(GlobalDecl(), getContext().VoidTy, Fn,
+ if (CGM.getModuleDebugInfo() && !D->hasAttr<NoDebugAttr>())
+ DebugInfo = CGM.getModuleDebugInfo();
+
+ StartFunction(GlobalDecl(D), getContext().VoidTy, Fn,
getTypes().arrangeNullaryFunction(),
- FunctionArgList(), SourceLocation());
+ FunctionArgList(), D->getInit()->getExprLoc());
// Use guarded initialization if the global variable is weak. This
// occurs for, e.g., instantiated static data members and
OpenPOWER on IntegriCloud