From: David Blaikie Date: Wed, 19 Jun 2013 21:53:53 +0000 (+0000) Subject: Debug Info: PR14763/r183329 - specify that non-trivial pass-by-value parameters are... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=41c9baed95a1e7974e6cccf7b4120fd1866ff125;p=clang Debug Info: PR14763/r183329 - specify that non-trivial pass-by-value parameters are stored indirectly This is to fix the location information for such parameters to refer to the object accessible through the pointer rather than to the pointer parameter itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184367 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 563faa4f78..8240c0846d 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -2622,6 +2622,9 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, // otherwise it is 'self' or 'this'. if (isa(VD) && ArgNo == 1) Flags |= llvm::DIDescriptor::FlagObjectPointer; + if (llvm::Argument *Arg = dyn_cast(Storage)) + if (Arg->getType()->isPointerTy() && !Arg->hasByValAttr() && !VD->getType()->isPointerType()) + Flags |= llvm::DIDescriptor::FlagIndirectVariable; llvm::MDNode *Scope = LexicalBlockStack.back(); diff --git a/test/CodeGenCXX/debug-info.cpp b/test/CodeGenCXX/debug-info.cpp index 9413575b86..2d1b5185be 100644 --- a/test/CodeGenCXX/debug-info.cpp +++ b/test/CodeGenCXX/debug-info.cpp @@ -92,7 +92,7 @@ incomplete (*x)[3]; } // For some reason the argument for PR14763 ended up all the way down here -// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [f] +// CHECK: = metadata !{i32 {{[0-9]*}}, metadata [[FUNC]], {{.*}}, metadata [[FOO]], i32 8192, i32 0} ; [ DW_TAG_arg_variable ] [f] namespace pr16214 { struct a {