diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-07-24 01:40:49 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-07-24 01:40:49 +0000 |
commit | 78d1a10e13a1abfd4830bccf2a97b2993da1ed5c (patch) | |
tree | 1cdf9d8bfd0887ab21721de66e769ddba67fb233 /lib/CodeGen | |
parent | f50b6fe092091a700cee7a708d509ae7c49709f6 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGDeclCXX.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index 893628e08a..492b95ad15 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/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 |