<div dir="ltr">This test needs a triple, it's failing locally for me due to the Itanium-style names (<span style="font-family:arial,sans-serif;font-size:13px">@_ZN1CD1Ev). -triple %itanium_abi_triple is the usual fix.</span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 10:57 AM, 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: Wed Jun 25 12:57:34 2014<br>
New Revision: 211722<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=211722&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=211722&view=rev</a><br>
Log:<br>
PR20038: DebugInfo: Call sites without DebugLocs for temporary dtors after a conditional<br>
<br>
With && at the top level of an expression, the last thing done when<br>
emitting the expression was an unconditional jump to the cleanup block.<br>
To reduce the amount of stepping, the DebugLoc is omitted from the<br>
unconditional jump. This is done by clearing the IRBuilder's<br>
"CurrentDebugLocation"*. If this is not set to some non-empty value<br>
before the cleanup block is emitted, the cleanups don't get a location<br>
either. If a call without a location is emitted in a function with debug<br>
info, and that call is then inlined - bad things happen. (without a<br>
location for the call site, the inliner would just leave the inlined<br>
DebugLocs as they were - pointing to roots in the original function, not<br>
inlined into the current function)<br>
<br>
Follow up commit to LLVM will ensure that breaking the invariants of the<br>
DebugLoc chains by having chains that don't lead to the current function<br>
will fail assertions, so we shouldn't accidentally slip any of these<br>
cases in anymore. Those assertions may reveal further cases that need to<br>
be fixed in clang, though I've tried to test heavily to avoid that.<br>
<br>
* See r128471, r128513 for the code that clears the<br>
  CurrentDebugLocation. Simply removing this code or moving the code<br>
  into IRBuilder to apply to all unconditional branches would regress<br>
  desired behavior, unfortunately.<br>
<br>
Added:<br>
    cfe/trunk/test/CodeGenCXX/PR20038.cpp<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=211722&r1=211721&r2=211722&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=211722&r1=211721&r2=211722&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jun 25 12:57:34 2014<br>
@@ -358,7 +358,10 @@ public:<br>
   Value *VisitExprWithCleanups(ExprWithCleanups *E) {<br>
     CGF.enterFullExpression(E);<br>
     CodeGenFunction::RunCleanupsScope Scope(CGF);<br>
-    return Visit(E->getSubExpr());<br>
+    auto *V = Visit(E->getSubExpr());<br>
+    if (CGDebugInfo *DI = CGF.getDebugInfo())<br>
+      DI->EmitLocation(Builder, E->getLocEnd(), false);<br>
+    return V;<br>
   }<br>
   Value *VisitCXXNewExpr(const CXXNewExpr *E) {<br>
     return CGF.EmitCXXNewExpr(E);<br>
<br>
Added: cfe/trunk/test/CodeGenCXX/PR20038.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR20038.cpp?rev=211722&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/PR20038.cpp?rev=211722&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/PR20038.cpp (added)<br>
+++ cfe/trunk/test/CodeGenCXX/PR20038.cpp Wed Jun 25 12:57:34 2014<br>
@@ -0,0 +1,11 @@<br>
+// RUN: %clang_cc1 -g -emit-llvm %s -o - | FileCheck %s<br>
+<br>
+struct C {<br>
+  ~C();<br>
+};<br>
+extern bool b;<br>
+// CHECK: call void @_ZN1CD1Ev({{.*}}), !dbg [[DTOR_CALL_LOC:![0-9]*]]<br>
+// CHECK: [[FUN4:.*]] = {{.*}}; [ DW_TAG_subprogram ] {{.*}} [def] [fun4]<br>
+// CHECK: [[DTOR_CALL_LOC]] = metadata !{i32 [[@LINE+2]], i32 0, metadata [[FUN4_BLOCK:.*]], null}<br>
+// CHECK: [[FUN4_BLOCK]] = metadata !{{{[^,]*}}, {{[^,]*}}, metadata [[FUN4]],<br>
+void fun4() { b && (C(), 1); }<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>