From 78d1a10e13a1abfd4830bccf2a97b2993da1ed5c Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 24 Jul 2012 01:40:49 +0000 Subject: 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 --- lib/CodeGen/CGDeclCXX.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen') 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()) + 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 -- cgit v1.2.3-70-g09d2