<div dir="ltr">Thanks, r239176.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 5, 2015 at 11:13 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Jun 5, 2015 at 2:03 PM, David Majnemer <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>> wrote:<br>
> Author: majnemer<br>
> Date: Fri Jun  5 13:03:58 2015<br>
> New Revision: 239170<br>
><br>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D239170-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=b6t5Aw1xI6g_pkhVWHmzS1AkM_jPCU4rmAa0zsVbB5I&s=n2izh7E-fWElS7gBMHxHHl4_yxR5Mj0yLoIoUJKRS5U&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=239170&view=rev</a><br>
> Log:<br>
> [AST] There is no message for C++1z-style static_assert<br>
><br>
> We would crash in the DeclPrinter trying to pretty-print the<br>
> static_assert message.  C++1z-style assertions don't have a message so<br>
> we would crash.<br>
><br>
> This fixes PR23756.<br>
><br>
> Modified:<br>
>     cfe/trunk/lib/AST/DeclPrinter.cpp<br>
>     cfe/trunk/lib/Headers/Intrin.h<br>
>     cfe/trunk/test/SemaCXX/static-assert.cpp<br>
><br>
> Modified: cfe/trunk/lib/AST/DeclPrinter.cpp<br>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_AST_DeclPrinter.cpp-3Frev-3D239170-26r1-3D239169-26r2-3D239170-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=b6t5Aw1xI6g_pkhVWHmzS1AkM_jPCU4rmAa0zsVbB5I&s=6jR1k1Z1NXTDvDVDArfvE9j6nDC9ztK5AnTHwUGj4Z0&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=239170&r1=239169&r2=239170&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/AST/DeclPrinter.cpp (original)<br>
> +++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Jun  5 13:03:58 2015<br>
> @@ -733,8 +733,10 @@ void DeclPrinter::VisitImportDecl(Import<br>
>  void DeclPrinter::VisitStaticAssertDecl(StaticAssertDecl *D) {<br>
>    Out << "static_assert(";<br>
>    D->getAssertExpr()->printPretty(Out, nullptr, Policy, Indentation);<br>
> -  Out << ", ";<br>
> -  D->getMessage()->printPretty(Out, nullptr, Policy, Indentation);<br>
> +  if (StringLiteral *SL = D->getMessage()) {<br>
> +    Out << ", ";<br>
> +    SL->printPretty(Out, nullptr, Policy, Indentation);<br>
> +  }<br>
>    Out << ")";<br>
>  }<br>
><br>
><br>
> Modified: cfe/trunk/lib/Headers/Intrin.h<br>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_lib_Headers_Intrin.h-3Frev-3D239170-26r1-3D239169-26r2-3D239170-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=b6t5Aw1xI6g_pkhVWHmzS1AkM_jPCU4rmAa0zsVbB5I&s=-OE2GA43llhbEuQIWJahlRBIRLp4Tn0_MdRDpHz32_4&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=239170&r1=239169&r2=239170&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Headers/Intrin.h (original)<br>
> +++ cfe/trunk/lib/Headers/Intrin.h Fri Jun  5 13:03:58 2015<br>
> @@ -546,13 +546,8 @@ _bittestandset(long *a, long b) {<br>
>  #if defined(__i386__) || defined(__x86_64__)<br>
>  static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__))<br>
>  _interlockedbittestandset(long volatile *__BitBase, long __BitPos) {<br>
> -  unsigned char __Res;<br>
> -  __asm__ ("xor %0, %0\n"<br>
> -           "lock bts %2, %1\n"<br>
> -           "setc %0\n"<br>
> -           : "=r" (__Res), "+m"(*__BitBase)<br>
> -           : "Ir"(__BitPos));<br>
> -  return __Res;<br>
> +  long __OldVal = __atomic_fetch_or(__BitBase, 1 << __BitPos, 5);<br>
> +  return (__OldVal >> __BitPos) & 1;<br>
>  }<br>
<br>
</div></div>Was this an intended part of your changes?<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
>  #endif<br>
>  #ifdef __x86_64__<br>
><br>
> Modified: cfe/trunk/test/SemaCXX/static-assert.cpp<br>
> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_cfe_trunk_test_SemaCXX_static-2Dassert.cpp-3Frev-3D239170-26r1-3D239169-26r2-3D239170-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=BSqEv9KvKMW_Ob8SyngJ70KdZISM_ASROnREeq0cCxk&m=b6t5Aw1xI6g_pkhVWHmzS1AkM_jPCU4rmAa0zsVbB5I&s=alSdp7aZs5b-90BUXmPL7uLEF3RCg_OnZZ3We9jVow8&e=" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/static-assert.cpp?rev=239170&r1=239169&r2=239170&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/test/SemaCXX/static-assert.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/static-assert.cpp Fri Jun  5 13:03:58 2015<br>
> @@ -51,3 +51,12 @@ StaticAssertProtected<X> sap2; // expect<br>
><br>
>  static_assert(true); // expected-warning {{C++1z extension}}<br>
>  static_assert(false); // expected-error-re {{failed{{$}}}} expected-warning {{extension}}<br>
> +<br>
> +void PR23756() {<br>
> +  struct { // expected-note 2 {{no known conversion from}}<br>
> +  } _ = decltype(            // expected-error {{no viable conversion}}<br>
> +      ({                     // expected-warning {{no effect in an unevaluated context}}<br>
> +        static_assert(true); // expected-warning {{C++1z extension}}<br>
> +        1;<br>
> +      })){};<br>
> +}<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>
</div></div></blockquote></div><br></div>