<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 4, 2018, at 5:38 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div class="gmail_extra"><div class="gmail_quote">On 4 April 2018 at 16:57, Akira Hatanaka via cfe-commits<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><span class="gmail-"><blockquote type="cite" class=""><div class="">On Apr 4, 2018, at 4:47 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="gmail-m_-6053479395256423563Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div class="gmail_extra"><div class="gmail_quote">On 4 April 2018 at 16:24, Akira Hatanaka via cfe-commits<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@<wbr class="">lists.llvm.org</a>></span><span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><span class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Apr 4, 2018, at 3:38 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="gmail-m_-6053479395256423563m_3142434014750245271Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">Hi Akira,</div><div class="gmail_quote"><br class=""></div><div class="gmail_quote">This change has broken the C++ versions of these type traits for classes with volatile members. Such classes are required to claim to be trivial per C++ DR 2094 (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094" target="_blank" class="">http://www.open-std.org/jtc1/<wbr class="">sc22/wg21/docs/cwg_defects.htm<wbr class="">l#2094</a>) but return false from isNonTrivialToPrimitiveCopy().</div><div class="gmail_quote"><br class=""></div></div></div></div></blockquote><br class=""></div></span><div class="">Oh that’s right. The function returns false when isNonTrivialToPrimitiveCopy() returns PCK_VolatileTrivial. That is wrong.</div></div></blockquote><div class=""><br class=""></div><div class="">Do you have a fix that's going to land soon? This has caused a regression for us, so I'd like to revert if it's not going to be fixed imminently.</div></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">Yes, I plan to fix this soon, but feel free to revert it if you need to.</div></div></div></blockquote><div class=""><br class=""></div><div class=""> Reverted in r329247 for now.</div></div></div></div></div></blockquote><div><br class=""></div>Sorry, I wasn’t able to fix it soon enough, I reapplied the patch with a fix in r329289. Let me know if it’s still causing a regression.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><div class=""><div class="gmail-h5"><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><span class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">Also, exposing these __has_* traits more widely seems like a backwards step to me: these traits are deprecated, near-useless, and we're trying to remove them. No code should be using them under any circumstances; the __is_* traits should be used instead.</div><div class="gmail_quote"><br class=""></div></div></div></div></blockquote><div class=""><br class=""></div></span><div class="">The __is_* traits (is_trivially_copy_constructib<wbr class="">le, etc.) are templates defined in libcxx, so it seems that we can’t use them when compiling in C mode. Is it OK to add their definitions to TokenKinds.def as non-C++ keywords?</div><div class=""><div class="gmail-m_-6053479395256423563h5"><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On 27 March 2018 at 17:12, Akira Hatanaka via cfe-commits<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@<wbr class="">lists.llvm.org</a>></span><span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Author: ahatanak<br class="">Date: Tue Mar 27 17:12:08 2018<br class="">New Revision: 328680<br class=""><br class="">URL:<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=328680&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/<wbr class="">llvm-project?rev=328680&view=<wbr class="">rev</a><br class="">Log:<br class="">[ObjC] Make C++ triviality type traits available to non-trivial C<br class="">structs.<br class=""><br class="">r326307 and r327870 made changes that allowed using non-trivial C<br class="">structs with fields qualified with __strong or __weak. This commit makes<br class="">the following C++ triviality type traits available to non-trivial C<br class="">structs:<br class=""><br class="">__has_trivial_assign<br class="">__has_trivial_move_assign<br class="">__has_trivial_copy<br class="">__has_trivial_move_constructor<br class="">__has_trivial_constructor<br class="">__has_trivial_destructor<br class=""><br class=""><a class="">rdar://problem/33599681</a><br class=""><br class="">Differential Revision:<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="https://reviews.llvm.org/D44913" rel="noreferrer" target="_blank" class="">https://reviews.<wbr class="">llvm.org/D44913</a><br class=""><br class="">Added:<br class=""> <span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>cfe/trunk/test/SemaObjC/non-<wbr class="">trivial-struct-traits.m<br class="">Modified:<br class=""> <span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>cfe/trunk/include/clang/<wbr class="">Basic/TokenKinds.def<br class=""> <span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>cfe/trunk/lib/Sema/<wbr class="">SemaExprCXX.cpp<br class=""><br class="">Modified: cfe/trunk/include/clang/Basic/<wbr class="">TokenKinds.def<br class="">URL:<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=328680&r1=328679&r2=328680&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/<wbr class="">llvm-project/cfe/trunk/<wbr class="">include/clang/Basic/<wbr class="">TokenKinds.def?rev=328680&r1=<wbr class="">328679&r2=328680&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/Basic/<wbr class="">TokenKinds.def (original)<br class="">+++ cfe/trunk/include/clang/Basic/<wbr class="">TokenKinds.def Tue Mar 27 17:12:08 2018<br class="">@@ -433,12 +433,12 @@ TYPE_TRAIT_1(__has_nothrow_ass<wbr class="">ign, HasNo<br class=""> TYPE_TRAIT_1(__has_nothrow_mo<wbr class="">ve_assign, HasNothrowMoveAssign, KEYCXX)<br class=""> TYPE_TRAIT_1(__has_nothrow_co<wbr class="">py, HasNothrowCopy, KEYCXX)<br class=""> TYPE_TRAIT_1(__has_nothrow_co<wbr class="">nstructor, HasNothrowConstructor, KEYCXX)<br class="">-TYPE_TRAIT_1(__has_trivial_as<wbr class="">sign, HasTrivialAssign, KEYCXX)<br class="">-TYPE_TRAIT_1(__has_trivial_mo<wbr class="">ve_assign, HasTrivialMoveAssign, KEYCXX)<br class="">-TYPE_TRAIT_1(__has_trivial_co<wbr class="">py, HasTrivialCopy, KEYCXX)<br class="">-TYPE_TRAIT_1(__has_trivial_co<wbr class="">nstructor, HasTrivialDefaultConstructor, KEYCXX)<br class="">-TYPE_TRAIT_1(__has_trivial_mo<wbr class="">ve_constructor, HasTrivialMoveConstructor, KEYCXX)<br class="">-TYPE_TRAIT_1(__has_trivial_de<wbr class="">structor, HasTrivialDestructor, KEYCXX)<br class="">+TYPE_TRAIT_1(__has_trivial_as<wbr class="">sign, HasTrivialAssign, KEYALL)<br class="">+TYPE_TRAIT_1(__has_trivial_mo<wbr class="">ve_assign, HasTrivialMoveAssign, KEYALL)<br class="">+TYPE_TRAIT_1(__has_trivial_co<wbr class="">py, HasTrivialCopy, KEYALL)<br class="">+TYPE_TRAIT_1(__has_trivial_co<wbr class="">nstructor, HasTrivialDefaultConstructor, KEYALL)<br class="">+TYPE_TRAIT_1(__has_trivial_mo<wbr class="">ve_constructor, HasTrivialMoveConstructor, KEYALL)<br class="">+TYPE_TRAIT_1(__has_trivial_de<wbr class="">structor, HasTrivialDestructor, KEYALL)<br class=""> TYPE_TRAIT_1(__has_virtual_de<wbr class="">structor, HasVirtualDestructor, KEYCXX)<br class=""> TYPE_TRAIT_1(__is_abstract, IsAbstract, KEYCXX)<br class=""> TYPE_TRAIT_1(__is_aggregate, IsAggregate, KEYCXX)<br class=""><br class="">Modified: cfe/trunk/lib/Sema/SemaExprCXX<wbr class="">.cpp<br class="">URL:<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=328680&r1=328679&r2=328680&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/<wbr class="">llvm-project/cfe/trunk/lib/<wbr class="">Sema/SemaExprCXX.cpp?rev=<wbr class="">328680&r1=328679&r2=328680&<wbr class="">view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Sema/SemaExprCXX<wbr class="">.cpp (original)<br class="">+++ cfe/trunk/lib/Sema/SemaExprCXX<wbr class="">.cpp Tue Mar 27 17:12:08 2018<br class="">@@ -4513,6 +4513,8 @@ static bool EvaluateUnaryTypeTrait(Sema<br class=""> // does not correctly compute triviality in the presence of multiple special<br class=""> // members of the same kind. Revisit this once the g++ bug is fixed.<br class=""> case UTT_HasTrivialDefaultConstruct<wbr class="">or:<br class="">+ if (T.isNonTrivialToPrimitiveDefa<wbr class="">ultInitialize())<br class="">+ return false;<br class=""> //<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html" rel="noreferrer" target="_blank" class="">http://gcc.gnu.org/<wbr class="">onlinedocs/gcc/Type-Traits.<wbr class="">html</a>:<br class=""> // If __is_pod (type) is true then the trait is true, else if type is<br class=""> // a cv class or union type (or array thereof) with a trivial default<br class="">@@ -4524,6 +4526,8 @@ static bool EvaluateUnaryTypeTrait(Sema<br class=""> <span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>!RD-><wbr class="">hasNonTrivialDefaultConstructo<wbr class="">r();<br class=""> return false;<br class=""> case UTT_HasTrivialMoveConstructor:<br class="">+ if (T.isNonTrivialToPrimitiveDest<wbr class="">ructiveMove())<br class="">+ return false;<br class=""> // This trait is implemented by MSVC 2012 and needed to parse the<br class=""> // standard library headers. Specifically this is used as the logic<br class=""> // behind std::is_trivially_move_constru<wbr class="">ctible (20.9.4.3).<br class="">@@ -4533,6 +4537,8 @@ static bool EvaluateUnaryTypeTrait(Sema<br class=""> return RD->hasTrivialMoveConstructor(<wbr class="">) && !RD->hasNonTrivialMoveConstruc<wbr class="">tor();<br class=""> return false;<br class=""> case UTT_HasTrivialCopy:<br class="">+ if (T.isNonTrivialToPrimitiveCopy<wbr class="">())<br class="">+ return false;<br class=""> //<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html" rel="noreferrer" target="_blank" class="">http://gcc.gnu.org/<wbr class="">onlinedocs/gcc/Type-Traits.<wbr class="">html</a>:<br class=""> // If __is_pod (type) is true or type is a reference type then<br class=""> // the trait is true, else if type is a cv class or union type<br class="">@@ -4545,6 +4551,8 @@ static bool EvaluateUnaryTypeTrait(Sema<br class=""> <span class="gmail-m_-6053479395256423563Apple-converted-space"> </span>!RD-><wbr class="">hasNonTrivialCopyConstructor()<wbr class="">;<br class=""> return false;<br class=""> case UTT_HasTrivialMoveAssign:<br class="">+ if (T.isNonTrivialToPrimitiveDest<wbr class="">ructiveMove())<br class="">+ return false;<br class=""> // This trait is implemented by MSVC 2012 and needed to parse the<br class=""> // standard library headers. Specifically it is used as the logic<br class=""> // behind std::is_trivially_move_assigna<wbr class="">ble (20.9.4.3)<br class="">@@ -4554,6 +4562,8 @@ static bool EvaluateUnaryTypeTrait(Sema<br class=""> return RD->hasTrivialMoveAssignment() && !RD->hasNonTrivialMoveAssignme<wbr class="">nt();<br class=""> return false;<br class=""> case UTT_HasTrivialAssign:<br class="">+ if (T.isNonTrivialToPrimitiveCopy<wbr class="">())<br class="">+ return false;<br class=""> //<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html" rel="noreferrer" target="_blank" class="">http://gcc.gnu.org/<wbr class="">onlinedocs/gcc/Type-Traits.<wbr class="">html</a>:<br class=""> // If type is const qualified or is a reference type then the<br class=""> // trait is false. Otherwise if __is_pod (type) is true then the<br class="">@@ -4624,6 +4634,8 @@ static bool EvaluateUnaryTypeTrait(Sema<br class=""> return true;<br class=""><br class=""> case UTT_HasTrivialDestructor:<br class="">+ if (T.isDestructedType() == QualType::DK_nontrivial_c_stru<wbr class="">ct)<br class="">+ return false;<br class=""> //<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Traits.html" rel="noreferrer" target="_blank" class="">http://gcc.gnu.org/<wbr class="">onlinedocs/gcc/Type-Traits.<wbr class="">html</a><br class=""> // If __is_pod (type) is true or type is a reference type<br class=""> // then the trait is true, else if type is a cv class or union<br class=""><br class="">Added: cfe/trunk/test/SemaObjC/non-tr<wbr class="">ivial-struct-traits.m<br class="">URL:<span class="gmail-m_-6053479395256423563Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/non-trivial-struct-traits.m?rev=328680&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/<wbr class="">llvm-project/cfe/trunk/test/<wbr class="">SemaObjC/non-trivial-struct-<wbr class="">traits.m?rev=328680&view=auto</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/test/SemaObjC/non-tr<wbr class="">ivial-struct-traits.m (added)<br class="">+++ cfe/trunk/test/SemaObjC/non-tr<wbr class="">ivial-struct-traits.m Tue Mar 27 17:12:08 2018<br class="">@@ -0,0 +1,25 @@<br class="">+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify %s<br class="">+<br class="">+// expected-no-diagnostics<br class="">+<br class="">+struct Trivial {<br class="">+ int x;<br class="">+};<br class="">+<br class="">+struct NonTrivial {<br class="">+ id x;<br class="">+};<br class="">+<br class="">+int trivial_assign[__has_trivial_a<wbr class="">ssign(struct Trivial) ? 1 : -1];<br class="">+int trivial_move_assign[__has_triv<wbr class="">ial_move_assign(struct Trivial) ? 1 : -1];<br class="">+int trivial_copy_constructor[__has<wbr class="">_trivial_copy(struct Trivial) ? 1 : -1];<br class="">+int trivial_move_constructor[__has<wbr class="">_trivial_move_constructor(stru<wbr class="">ct Trivial) ? 1 : -1];<br class="">+int trivial_constructor[__has_triv<wbr class="">ial_constructor(struct Trivial) ? 1 : -1];<br class="">+int trivial_destructor[__has_trivi<wbr class="">al_destructor(struct Trivial) ? 1 : -1];<br class="">+<br class="">+int non_trivial_assign[__has_trivi<wbr class="">al_assign(struct NonTrivial) ? -1 : 1];<br class="">+int non_trivial_move_assign[__has_<wbr class="">trivial_move_assign(struct NonTrivial) ? -1 : 1];<br class="">+int non_trivial_copy_constructor[_<wbr class="">_has_trivial_copy(struct NonTrivial) ? -1 : 1];<br class="">+int non_trivial_move_constructor[_<wbr class="">_has_trivial_move_constructor(<wbr class="">struct NonTrivial) ? -1 : 1];<br class="">+int non_trivial_constructor[__has_<wbr class="">trivial_constructor(struct NonTrivial) ? -1 : 1];<br class="">+int non_trivial_destructor[__has_t<wbr class="">rivial_destructor(struct NonTrivial) ? -1 : 1];<br class=""><br class=""><br class="">______________________________<wbr class="">_________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/cfe-commits</a><br class=""></blockquote></div><br class=""></div></div></div></blockquote></div></div></div><br class=""></div><br class="">______________________________<wbr class="">_________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/cfe-commits</a></blockquote></div></div></div></div></blockquote></div></div></div><br class=""></div><br class="">______________________________<wbr class="">_________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/cfe-commits</a></blockquote></div></div></div></div></blockquote></div><br class=""></body></html>