<div dir="ltr">*nod* Thanks - let me know if you have trouble simplifying or explaining it & I'll see if fresh eyes help :)</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 28, 2017 at 4:46 PM Adrian Prantl <<a href="mailto:aprantl@apple.com">aprantl@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">It's possible that this testcase can be golfed some more. I copied it almost verbatim from the PR. I'll see what I can do. The important thing is that it needs to trigger the situation where the frontend is creating an inlined function.<div><br></div><div></div></div><div style="word-wrap:break-word"><div>-- adrian</div></div><div style="word-wrap:break-word"><div><br><div><blockquote type="cite"><div>On Aug 28, 2017, at 4:43 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br class="m_4610374212843864758Apple-interchange-newline"><div><div dir="ltr">Seems like a rather complex test case - could you explain what's going on there? (maybe in the form of a comment in the code - what path through all those classes is required to tickle this)<br><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 23, 2017 at 2:25 PM Adrian Prantl via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br>
Date: Wed Aug 23 14:24:12 2017<br>
New Revision: 311601<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=311601&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=311601&view=rev</a><br>
Log:<br>
Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be<br>
parented in function declarations.<br>
<br>
Fixes PR33997.<br>
<a href="https://bugs.llvm.org/show_bug.cgi?id=33997" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=33997</a><br>
<br>
Added:<br>
    cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=311601&r1=311600&r2=311601&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=311601&r1=311600&r2=311601&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 23 14:24:12 2017<br>
@@ -3287,7 +3287,7 @@ void CGDebugInfo::EmitInlineFunctionStar<br>
   llvm::DISubprogram *SP = nullptr;<br>
   if (FI != SPCache.end())<br>
     SP = dyn_cast_or_null<llvm::DISubprogram>(FI->second);<br>
-  if (!SP)<br>
+  if (!SP || !SP->isDefinition())<br>
     SP = getFunctionStub(GD);<br>
   FnBeginRegionCount.push_back(LexicalBlockStack.size());<br>
   LexicalBlockStack.emplace_back(SP);<br>
<br>
Added: cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp?rev=311601&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp?rev=311601&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp (added)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-inlined.cpp Wed Aug 23 14:24:12 2017<br>
@@ -0,0 +1,45 @@<br>
+// RUN: %clang_cc1 -emit-llvm -triple i686-pc-windows-msvc19.0.24213 -gcodeview -debug-info-kind=limited -std=c++14 %s -o - | FileCheck %s<br>
+// PR33997.<br>
+struct already_AddRefed {<br>
+  ~already_AddRefed();<br>
+};<br>
+struct RefPtr {<br>
+  operator int *();<br>
+};<br>
+struct ServoCssRulesStrong {<br>
+  already_AddRefed Consume();<br>
+};<br>
+struct GroupRule {<br>
+  GroupRule(already_AddRefed);<br>
+};<br>
+class ConditionRule : GroupRule {<br>
+  using GroupRule::GroupRule;<br>
+};<br>
+class CSSMediaRule : ConditionRule {<br>
+  using ConditionRule::ConditionRule;<br>
+};<br>
+class CSSMozDocumentRule : ConditionRule {<br>
+  using ConditionRule::ConditionRule;<br>
+};<br>
+class ServoDocumentRule : CSSMozDocumentRule {<br>
+  ServoDocumentRule(RefPtr);<br>
+};<br>
+class ServoMediaRule : CSSMediaRule {<br>
+  ServoMediaRule(RefPtr);<br>
+};<br>
+ServoCssRulesStrong Servo_MediaRule_GetRules(int *);<br>
+ServoCssRulesStrong Servo_DocumentRule_GetRules(int *);<br>
+ServoDocumentRule::ServoDocumentRule(RefPtr aRawRule)<br>
+    : CSSMozDocumentRule(Servo_DocumentRule_GetRules(aRawRule).Consume()) {}<br>
+<br>
+ServoMediaRule::ServoMediaRule(RefPtr aRawRule)<br>
+    : CSSMediaRule(Servo_MediaRule_GetRules(aRawRule).Consume()) {}<br>
+<br>
+// CHECK: define{{.*}}ServoMediaRule<br>
+// CHECK-NOT: {{ ret }}<br>
+// CHECK: store %class.ConditionRule* %<br>
+// CHECK-SAME: %class.ConditionRule** %<br>
+// CHECK-SAME: !dbg ![[INL:[0-9]+]]<br>
+<br>
+// CHECK: ![[INL]] = !DILocation(line: 16, scope: ![[SP:[0-9]+]], inlinedAt:<br>
+// CHECK: ![[SP]] = distinct !DISubprogram(name: "GroupRule", {{.*}}isDefinition: true<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>
</div></blockquote></div><br></div></div></blockquote></div>