<div dir="ltr">Looks good - alternatively you could phrase this as a single function with a macro for the nodebug attribute - two clang+FileCheck lines, one passes -D to enable the nodebug, one passes an empty -D. Might be a more direct comparison? (& does require two clang invocations, which is a tradeoff)</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 25, 2015 at 4:11 PM, Paul Robinson <span dir="ltr"><<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I had a similar thought, but had foolishly suppressed it.  Since you had the same thought, it's probably worth paying attention to it.<br>
<span class=""><br>
<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10747&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=XWIQQTkeln6l0bVkVuPLY0j6YzbQSJ_nXAChR0NO6NA&s=HfFBAD_1ycK7bDDNGXv12LE5mzZULmf4aNYzomCe7Xk&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D10747</a><br>
<br>
Files:<br>
  test/CodeGen/attr-nodebug.c<br>
<br>
Index: test/CodeGen/attr-nodebug.c<br>
===================================================================<br>
--- test/CodeGen/attr-nodebug.c<br>
+++ test/CodeGen/attr-nodebug.c<br>
</span>@@ -1,12 +1,32 @@<br>
<span class="">-// RUN: %clang_cc1 -g -emit-llvm -o %t %s<br>
-// RUN: not grep 'call void @llvm.dbg.func.start' %t<br>
+// RUN: %clang_cc1 -g -emit-llvm -o - %s | FileCheck %s<br>
<br>
 void t1() __attribute__((nodebug));<br>
<br>
</span> void t1()<br>
 {<br>
   int a = 10;<br>
-<br>
   a++;<br>
 }<br>
<br>
+void t2()<br>
+{<br>
+  int b = 10;<br>
+  b++;<br>
+}<br>
+<br>
+// With nodebug, IR should have no llvm.dbg.* calls, or !dbg annotations.<br>
<span class="">+// CHECK-LABEL: @t1<br>
+// CHECK-NOT:   dbg<br>
+// CHECK:       }<br>
+<br>
</span>+// For sanity, check those things do occur normally.<br>
+// CHECK-LABEL: @t2<br>
+// CHECK:       call{{.*}}llvm.dbg<br>
+// CHECK:       !dbg<br>
+// CHECK:       }<br>
+<br>
+// We should see a function description for t2 but not t1.<br>
+// CHECK-NOT: DISubprogram(name: "t1"<br>
+// CHECK:     DISubprogram(name: "t2"<br>
+// CHECK-NOT: DISubprogram(name: "t1"<br>
+<br>
<br>
EMAIL PREFERENCES<br>
  <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_settings_panel_emailpreferences_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=XWIQQTkeln6l0bVkVuPLY0j6YzbQSJ_nXAChR0NO6NA&s=9knlXXN3q-gdOiNRQt5mokkpp2As2owWarf7WwN5YmY&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</blockquote></div><br></div>