<div dir="ltr">Hi Hans,<br><br>I believe this is the missing piece to fix PR22257 for the 3.6 release. Could you try pulling this onto the release branch? (the test case probably won't apply cleanly, but hopefully the main patch does) & possibly verify the PR22257 reproduction (I've verified it as best I can, but would be good to have something more authoritative).<br><br>- David<br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 17, 2015 at 4:12 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Sat Jan 17 18:12:58 2015<br>
New Revision: 226382<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=226382&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=226382&view=rev</a><br>
Log:<br>
DebugInfo: Correct the debug location of non-static data member initializers<br>
<br>
This was causing some trouble for otherwise dead code removed in r225085<br>
(reverted in r225361). The location being set for function arguments was<br>
leaking out to the call which wasn't setting its own location (so a<br>
quality bug turned into a crasher with r225085). Fix this so r225085 can<br>
be recommitted.<br>
<br>
Modified:<br>
    cfe/trunk/lib/AST/DeclCXX.cpp<br>
    cfe/trunk/lib/CodeGen/CGClass.cpp<br>
    cfe/trunk/test/CodeGenCXX/debug-info-line.cpp<br>
<br>
Modified: cfe/trunk/lib/AST/DeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=226382&r1=226381&r2=226382&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=226382&r1=226381&r2=226382&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/AST/DeclCXX.cpp Sat Jan 17 18:12:58 2015<br>
@@ -1693,12 +1693,12 @@ const Type *CXXCtorInitializer::getBaseC<br>
 }<br>
<br>
 SourceLocation CXXCtorInitializer::getSourceLocation() const {<br>
-  if (isAnyMemberInitializer())<br>
-    return getMemberLocation();<br>
-<br>
   if (isInClassMemberInitializer())<br>
     return getAnyMember()->getLocation();<br>
<br>
+  if (isAnyMemberInitializer())<br>
+    return getMemberLocation();<br>
+<br>
   if (TypeSourceInfo *TSInfo = Initializee.get<TypeSourceInfo*>())<br>
     return TSInfo->getTypeLoc().getLocalSourceRange().getBegin();<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=226382&r1=226381&r2=226382&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=226382&r1=226381&r2=226382&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Sat Jan 17 18:12:58 2015<br>
@@ -544,7 +544,7 @@ static void EmitMemberInitializer(CodeGe<br>
                                   CXXCtorInitializer *MemberInit,<br>
                                   const CXXConstructorDecl *Constructor,<br>
                                   FunctionArgList &Args) {<br>
-  ApplyDebugLocation Loc(CGF, MemberInit->getMemberLocation());<br>
+  ApplyDebugLocation Loc(CGF, MemberInit->getSourceLocation());<br>
   assert(MemberInit->isAnyMemberInitializer() &&<br>
          "Must have member initializer!");<br>
   assert(MemberInit->getInit() && "Must have initializer!");<br>
@@ -598,7 +598,6 @@ static void EmitMemberInitializer(CodeGe<br>
   ArrayRef<VarDecl *> ArrayIndexes;<br>
   if (MemberInit->getNumArrayIndices())<br>
     ArrayIndexes = MemberInit->getArrayIndexes();<br>
-  ApplyDebugLocation DL(CGF, MemberInit->getMemberLocation());<br>
   CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes);<br>
 }<br>
<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/debug-info-line.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=226382&r1=226381&r2=226382&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-line.cpp?rev=226382&r1=226381&r2=226382&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-line.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-line.cpp Sat Jan 17 18:12:58 2015<br>
@@ -173,12 +173,12 @@ struct f14 {<br>
 // CHECK-LABEL: define<br>
 // CHECK-LABEL: define<br>
 // CHECK-LABEL: define<br>
+struct {<br>
 // CHECK: call {{.*}}, !dbg [[DBG_F14_CTOR_CALL:![0-9]*]]<br>
-// FIXME: The ctor call should be attributed to the line of the NSDMI, not the<br>
-// start of this declaration.<br>
 #line 1600<br>
-struct {<br>
-  f14 v = 1;<br>
+  f14 v<br>
+      =<br>
+      1;<br>
 } f14_inst;<br>
<br>
 // CHECK-LABEL: define<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>