<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="">Committed the patch in r332397.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On May 7, 2018, at 5:17 PM, Akira Hatanaka <<a href="mailto:ahatanaka@apple.com" class="">ahatanaka@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br class="" 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;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class="">On Apr 25, 2018, at 2:39 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" class=""><div class=""><div class="">Thanks, this looks good to me.</div><div class=""><br class=""></div><div class="">--- a/lib/CodeGen/CGDecl.cpp</div><div class="">+++ b/lib/CodeGen/CGDecl.cpp</div><div class="">@@ -1955,8 +1955,8 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, ParamValue Arg,</div><div class="">     // Push a destructor cleanup for this parameter if the ABI requires it.</div><div class="">     // Don't push a cleanup in a thunk for a method that will also emit a</div><div class="">     // cleanup.</div><div class="">-    if (!IsScalar && !CurFuncIsThunk &&</div><div class="">-        getContext().isParamDestroyedInCallee(Ty)) {</div></div><div class="">+    if (hasAggregateEvaluationKind(Ty) && !CurFuncIsThunk &&<br class=""></div><div class="">+        Ty->getAs<RecordType>()->getDecl()->isParamDestroyedInCallee()) {</div><div class=""><br class=""></div><div class="">Is there a guarantee that "aggregate evaluation kind" implies that the type is a record type?</div><div class=""><br class=""></div></div></div></blockquote><div 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=""><br class=""></div><div 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="">Yes, I think so. If I understand the code in CodeGenFunction::getEvaluationKind correctly, Ty is an aggregate evaluation kind only if it is one of the following types:</div><div 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=""><br class=""></div><div 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="">ConstantArray</div><div 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="">IncompleteArray</div><div 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="">VariableArray</div><div 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="">Record</div><div 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="">ObjCObject</div><div 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="">ObjCInterface</div><div 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=""><br class=""></div><div 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="">And Record is the only type that can be the type of a parameter passed to a function.</div><div 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=""><br class=""></div><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class=""><div dir="ltr" class=""><div class=""><div class="">--- a/include/clang/AST/Decl.h</div><div class="">+++ b/include/clang/AST/Decl.h</div><div class="">@@ -3596,9 +3596,7 @@ private:</div><div class="">   bool NonTrivialToPrimitiveCopy : 1;</div><div class="">   bool NonTrivialToPrimitiveDestroy : 1;</div><div class=""> </div><div class="">-  /// Indicates whether this struct is destroyed in the callee. This flag is</div><div class="">-  /// meaningless when Microsoft ABI is used since parameters are always</div><div class="">-  /// destroyed in the callee.</div><div class="">+  /// Indicates whether this struct is destroyed in the callee.</div><div class="">   ///</div><div class="">   /// Please note that MSVC won't merge adjacent bitfields if they don't have</div><div class="">   /// the same type.</div></div><div class=""><br class=""></div><div class="">Unrelated to this change, but please note that MSVC won't merge adjacent bitfields if they don't have the same type. You should change all the bit-fields in this run of bit-fields to have the same type (maybe unsigned) so they actually get packed together when compiling with MSVC.</div></div><div class="gmail_extra"><br class=""></div></div></blockquote><div 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=""><br class=""></div><div 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="">I didn’t think using different types would be a problem as I was thinking the bool variables would be merged into an 8-bit block of data (there are eight bool variables) and the two bitfield variables declared as uint8_t that follow the boolean variables would be merged into another 8-bit block. But I agree with you that we should change the type of the variables to unsigned to make it clearer that all bit-field variables declared in the class are packed even when it is compiled with MSVC.</div><div 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=""><br class=""></div><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class=""><div class="gmail_extra"><div class="gmail_quote">On 10 April 2018 at 14: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 class="" style="word-wrap: break-word; line-break: after-white-space;"><br class=""><div class=""><div class=""><div class="h5"><br class=""><blockquote type="cite" class=""><div class="">On Apr 6, 2018, at 9:34 AM, Akira Hatanaka <<a href="mailto:ahatanaka@apple.com" target="_blank" class="">ahatanaka@apple.com</a>> wrote:</div><br class="m_1114189100479675556Apple-interchange-newline"><div class=""><div class="" 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;"><br class="m_1114189100479675556Apple-interchange-newline"><br class=""><blockquote type="cite" class=""><div class="">On Apr 4, 2018, at 2:15 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="m_1114189100479675556Apple-interchange-newline"><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote">On 4 April 2018 at 11:57, Akira Hatanaka via cfe-commits<span class="m_1114189100479675556Apple-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="m_1114189100479675556Apple-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 class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class=""><div class="m_1114189100479675556h5"><blockquote type="cite" class=""><div class="">On Apr 4, 2018, at 10:55 AM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="m_1114189100479675556m_-7519891156417877842Apple-interchange-newline"><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote">On 3 April 2018 at 21:58, Akira Hatanaka via cfe-commits<span class="m_1114189100479675556m_-7519891156417877842Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists<wbr class="">.llvm.org</a>></span><span class="m_1114189100479675556m_-7519891156417877842Apple-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 class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class=""><div class="m_1114189100479675556m_-7519891156417877842h5"><blockquote type="cite" class=""><div class="">On Apr 3, 2018, at 7:56 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068Apple-interchange-newline"><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote">On 3 April 2018 at 13:07, Akira Hatanaka via cfe-commits<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists<wbr class="">.llvm.org</a>></span><span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068Apple-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 class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><br class=""><div class=""><div class=""><div class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-h5"><br class=""><blockquote type="cite" class=""><div class="">On Apr 1, 2018, at 6:00 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" target="_blank" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-interchange-newline"><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote">On 28 March 2018 at 14:13, Akira Hatanaka via cfe-commits<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists<wbr class="">.llvm.org</a>></span><span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-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: Wed Mar 28 14:13:14 2018<br class="">New Revision: 328731<br class=""><br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=328731&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project?rev=328731&view=rev</a><br class="">Log:<br class="">[ObjC++] Make parameter passing and function return compatible with ObjC<br class=""><br class="">ObjC and ObjC++ pass non-trivial structs in a way that is incompatible<br class="">with each other. For example:<br class=""><br class="">typedef struct {<br class=""> <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>id f0;<br class=""> <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>__weak id f1;<br class="">} S;<br class=""><br class="">// this code is compiled in c++.<br class="">extern "C" {<br class=""> <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>void foo(S s);<br class="">}<br class=""><br class="">void caller() {<br class=""> <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>// the caller passes the parameter indirectly and destructs it.<br class=""> <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>foo(S());<br class="">}<br class=""><br class="">// this function is compiled in c.<br class="">// 'a' is passed directly and is destructed in the callee.<br class="">void foo(S a) {<br class="">}<br class=""><br class="">This patch fixes the incompatibility by passing and returning structs<br class="">with __strong or weak fields using the C ABI in C++ mode. __strong and<br class="">__weak fields in a struct do not cause the struct to be destructed in<br class="">the caller and __strong fields do not cause the struct to be passed<br class="">indirectly.<br class=""><br class="">Also, this patch fixes the microsoft ABI bug mentioned here:<br class=""><br class=""><a href="https://reviews.llvm.org/D41039?id=128767#inline-364710" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/D4103<wbr class="">9?id=128767#inline-364710</a><br class=""><br class=""><a class="">rdar://problem/38887866</a><br class=""><br class="">Differential Revision:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="https://reviews.llvm.org/D44908" rel="noreferrer" target="_blank" class="">https://reviews.llvm<wbr class="">.org/D44908</a><br class=""><br class="">Added:<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/test/CodeGenObjCXX<wbr class="">/<a href="http://objc-struct-cxx-abi.mm/" rel="noreferrer" target="_blank" class="">objc-struct-cxx-abi.mm</a><br class="">     <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>- copied, changed from r328730, cfe/trunk/test/CodeGenObjCXX/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">t<wbr class="">rivial_abi.mm</a><br class="">Removed:<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/test/CodeGenObjCXX<wbr class="">/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">trivial_abi.mm</a><br class="">Modified:<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/AST/<wbr class="">Decl.h<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/AST/<wbr class="">DeclCXX.h<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/AST/<wbr class="">Type.h<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/Basi<wbr class="">c/LangOptions.def<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/Basi<wbr class="">c/LangOptions.h<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/Basi<wbr class="">c/TargetInfo.h<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/include/clang/Fron<wbr class="">tend/CodeGenOptions.def<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/AST/ASTContext<wbr class="">.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/AST/Decl.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/AST/DeclCXX.cp<wbr class="">p<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/AST/Type.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Basic/TargetIn<wbr class="">fo.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Basic/Targets/<wbr class="">X86.h<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/CGCall<wbr class="">.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/Itaniu<wbr class="">mCXXABI.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/Micros<wbr class="">oftCXXABI.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/CodeGen/Target<wbr class="">Info.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Frontend/Compi<wbr class="">lerInvocation.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Sema/SemaDecl.<wbr class="">cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Sema/SemaDeclC<wbr class="">XX.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Serialization/<wbr class="">ASTReaderDecl.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Serialization/<wbr class="">ASTWriter.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/lib/Serialization/<wbr class="">ASTWriterDecl.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/test/CodeGenCXX/mi<wbr class="">crosoft-abi-sret-and-byval.cpp<br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/test/CodeGenObjCXX<wbr class="">/<a href="http://arc-special-member-functions.mm/" rel="noreferrer" target="_blank" class="">arc-special-member-functions.<wbr class="">mm</a><br class="">   <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>cfe/trunk/test/CodeGenObjCXX<wbr class="">/<a href="http://property-dot-copy-elision.mm/" rel="noreferrer" target="_blank" class="">property-dot-copy-elision.mm</a><br class=""><br class="">Modified: cfe/trunk/include/clang/AST/De<wbr class="">cl.h<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/AST/Decl.h?rev=328731&r1=<wbr class="">328730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/AST/De<wbr class="">cl.h (original)<br class="">+++ cfe/trunk/include/clang/AST/De<wbr class="">cl.h Wed Mar 28 14:13:14 2018<br class="">@@ -3559,6 +3559,11 @@ class RecordDecl : public TagDecl {<br class="">   /// pass an object of this class.<br class="">   bool CanPassInRegisters : 1;<br class=""><br class="">+  /// Indicates whether this struct is destroyed in the callee. This flag is<br class="">+  /// meaningless when Microsoft ABI is used since parameters are always<br class="">+  /// destroyed in the callee.<br class="">+  bool ParamDestroyedInCallee : 1;<br class="">+<br class=""> protected:<br class="">   RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,<br class="">             <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>SourceLocation StartLoc, SourceLocation IdLoc,<br class="">@@ -3654,6 +3659,14 @@ public:<br class="">     CanPassInRegisters = CanPass;<br class="">   }<br class=""><br class="">+  bool isParamDestroyedInCallee() const {<br class="">+    return ParamDestroyedInCallee;<br class="">+  }<br class="">+<br class="">+  void setParamDestroyedInCallee(bool V) {<br class="">+    ParamDestroyedInCallee = V;<br class="">+  }<br class="">+<br class="">   /// \brief Determines whether this declaration represents the<br class="">   /// injected class name.<br class="">   ///<br class=""><br class="">Modified: cfe/trunk/include/clang/AST/De<wbr class="">clCXX.h<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/AST/DeclCXX.h?rev=328731&<wbr class="">r1=328730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/AST/De<wbr class="">clCXX.h (original)<br class="">+++ cfe/trunk/include/clang/AST/De<wbr class="">clCXX.h Wed Mar 28 14:13:14 2018<br class="">@@ -1468,13 +1468,6 @@ public:<br class="">     return data().HasIrrelevantDestructor<wbr class="">;<br class="">   }<br class=""><br class="">-  /// Determine whether the triviality for the purpose of calls for this class<br class="">-  /// is overridden to be trivial because this class or the type of one of its<br class="">-  /// subobjects has attribute "trivial_abi".<br class="">-  bool hasTrivialABIOverride() const {<br class="">-    return canPassInRegisters() && hasNonTrivialDestructor();<br class="">-  }<br class="">-<br class="">   /// \brief Determine whether this class has a non-literal or/ volatile type<br class="">   /// non-static data member or base class.<br class="">   bool hasNonLiteralTypeFieldsOrBases<wbr class="">() const {<br class=""><br class="">Modified: cfe/trunk/include/clang/AST/Ty<wbr class="">pe.h<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/AST/Type.h?rev=328731&r1=<wbr class="">328730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/AST/Ty<wbr class="">pe.h (original)<br class="">+++ cfe/trunk/include/clang/AST/Ty<wbr class="">pe.h Wed Mar 28 14:13:14 2018<br class="">@@ -808,11 +808,6 @@ public:<br class="">   /// Return true if this is a trivially copyable type (C++0x [basic.types]p9)<br class="">   bool isTriviallyCopyableType(const ASTContext &Context) const;<br class=""><br class="">-  /// Determine whether this is a class whose triviality for the purpose of<br class="">-  /// calls is overridden to be trivial because the class or the type of one of<br class="">-  /// its subobjects has attribute "trivial_abi".<br class="">-  bool hasTrivialABIOverride() const;<br class="">-<br class="">   // Don't promise in the API that anything besides 'const' can be<br class="">   // easily added.<br class=""><br class=""><br class="">Modified: cfe/trunk/include/clang/Basic/<wbr class="">LangOptions.def<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/Basic/LangOptions.def?rev<wbr class="">=328731&r1=328730&r2=328731&vi<wbr class="">ew=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/Basic/<wbr class="">LangOptions.def (original)<br class="">+++ cfe/trunk/include/clang/Basic/<wbr class="">LangOptions.def Wed Mar 28 14:13:14 2018<br class="">@@ -284,6 +284,10 @@ LANGOPT(XRayAlwaysEmitCustomEv<wbr class="">ents, 1, 0<br class=""> BENIGN_LANGOPT(AllowEditorPla<wbr class="">ceholders, 1, 0,<br class="">               <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>"allow editor placeholders in source")<br class=""><br class="">+ENUM_LANGOPT(ClangABICompat, ClangABI, 4, ClangABI::Latest,<br class="">+             "version of Clang that we should attempt to be ABI-compatible "<br class="">+             "with")<br class="">+<br class=""> #undef LANGOPT<br class=""> #undef COMPATIBLE_LANGOPT<br class=""> #undef BENIGN_LANGOPT<br class=""><br class="">Modified: cfe/trunk/include/clang/Basic/<wbr class="">LangOptions.h<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/Basic/LangOptions.h?rev=3<wbr class="">28731&r1=328730&r2=328731&view<wbr class="">=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/Basic/<wbr class="">LangOptions.h (original)<br class="">+++ cfe/trunk/include/clang/Basic/<wbr class="">LangOptions.h Wed Mar 28 14:13:14 2018<br class="">@@ -102,6 +102,23 @@ public:<br class="">     MSVC2015 = 19<br class="">   };<br class=""><br class="">+  /// Clang versions with different platform ABI conformance.<br class="">+  enum class ClangABI {<br class="">+    /// Attempt to be ABI-compatible with code generated by Clang 3.8.x<br class="">+    /// (SVN r257626). This causes <1 x long long> to be passed in an<br class="">+    /// integer register instead of an SSE register on x64_64.<br class="">+    Ver3_8,<br class="">+<br class="">+    /// Attempt to be ABI-compatible with code generated by Clang 4.0.x<br class="">+    /// (SVN r291814). This causes move operations to be ignored when<br class="">+    /// determining whether a class type can be passed or returned directly.<br class="">+    Ver4,<br class="">+<br class="">+    /// Conform to the underlying platform's C and C++ ABIs as closely<br class="">+    /// as we can.<br class="">+    Latest<br class="">+  };<br class="">+<br class="">   enum FPContractModeKind {<br class="">     // Form fused FP ops only where result will not be affected.<br class="">     FPC_Off,<br class=""><br class="">Modified: cfe/trunk/include/clang/Basic/<wbr class="">TargetInfo.h<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/Basic/TargetInfo.h?rev=32<wbr class="">8731&r1=328730&r2=328731&view=<wbr class="">diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/Basic/<wbr class="">TargetInfo.h (original)<br class="">+++ cfe/trunk/include/clang/Basic/<wbr class="">TargetInfo.h Wed Mar 28 14:13:14 2018<br class="">@@ -1053,6 +1053,14 @@ public:<br class="">     }<br class="">   }<br class=""><br class="">+  enum CallingConvKind {<br class="">+    CCK_Default,<br class="">+    CCK_ClangABI4OrPS4,<br class="">+    CCK_MicrosoftX86_64<br class="">+  };<br class="">+<br class="">+  virtual CallingConvKind getCallingConvKind(bool ClangABICompat4) const;<br class="">+<br class="">   /// Controls if __builtin_longjmp / __builtin_setjmp can be lowered to<br class="">   /// llvm.eh.sjlj.longjmp / llvm.eh.sjlj.setjmp.<br class="">   virtual bool hasSjLjLowering() const {<br class=""><br class="">Modified: cfe/trunk/include/clang/Fronte<wbr class="">nd/CodeGenOptions.def<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/include/c<wbr class="">lang/Frontend/CodeGenOptions.d<wbr class="">ef?rev=328731&r1=328730&r2=328<wbr class="">731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/include/clang/Fronte<wbr class="">nd/CodeGenOptions.def (original)<br class="">+++ cfe/trunk/include/clang/Fronte<wbr class="">nd/CodeGenOptions.def Wed Mar 28 14:13:14 2018<br class="">@@ -138,9 +138,6 @@ ENUM_CODEGENOPT(ObjCDispatchMe<wbr class="">thod, ObjC<br class=""> CODEGENOPT(OmitLeafFramePoint<wbr class="">er , 1, 0) ///< Set when -momit-leaf-frame-pointer is<br class="">                                         ///< enabled.<br class=""><br class="">-/// A version of Clang that we should attempt to be ABI-compatible with.<br class="">-ENUM_CODEGENOPT(ClangABICompa<wbr class="">t, ClangABI, 4, ClangABI::Latest)<br class="">-<br class=""> VALUE_CODEGENOPT(Optimization<wbr class="">Level, 2, 0) ///< The -O[0-3] option specified.<br class=""> VALUE_CODEGENOPT(OptimizeSize<wbr class="">, 2, 0) ///< If -Os (==1) or -Oz (==2) is specified.<br class=""><br class=""><br class="">Modified: cfe/trunk/lib/AST/ASTContext.c<wbr class="">pp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/AST/A<wbr class="">STContext.cpp?rev=328731&r1=32<wbr class="">8730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/AST/ASTContext.c<wbr class="">pp (original)<br class="">+++ cfe/trunk/lib/AST/ASTContext.c<wbr class="">pp Wed Mar 28 14:13:14 2018<br class="">@@ -2643,9 +2643,11 @@ void ASTContext::adjustExceptionSpe<wbr class="">c(<br class=""> }<br class=""><br class=""> bool ASTContext::isParamDestroyedIn<wbr class="">Callee(QualType T) const {<br class="">-  return getTargetInfo().getCXXABI().ar<wbr class="">eArgsDestroyedLeftToRightInCal<wbr class="">lee() ||<br class="">-         T.hasTrivialABIOverride() ||<br class="">-         T.isDestructedType() == QualType::DK_nontrivial_c_stru<wbr class="">ct;<br class="">+  if (getTargetInfo().getCXXABI().a<wbr class="">reArgsDestroyedLeftToRightInCa<wbr class="">llee())<br class="">+    return true;<br class="">+  if (const auto *RT = T->getBaseElementTypeUnsafe()-<wbr class="">>getAs<RecordType>())<br class="">+    return RT->getDecl()->isParamDestroye<wbr class="">dInCallee();<br class="">+  return false;<br class=""> }<br class=""><br class=""> /// getComplexType - Return the uniqued reference to the type for a complex<br class=""><br class="">Modified: cfe/trunk/lib/AST/Decl.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/AST/D<wbr class="">ecl.cpp?rev=328731&r1=328730&r<wbr class="">2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/AST/Decl.cpp (original)<br class="">+++ cfe/trunk/lib/AST/Decl.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -3951,7 +3951,7 @@ RecordDecl::RecordDecl(Kind DK, TagKind<br class="">       LoadedFieldsFromExternalStora<wbr class="">ge(false),<br class="">       NonTrivialToPrimitiveDefaultI<wbr class="">nitialize(false),<br class="">       NonTrivialToPrimitiveCopy(fal<wbr class="">se), NonTrivialToPrimitiveDestroy(f<wbr class="">alse),<br class="">-      CanPassInRegisters(true) {<br class="">+      CanPassInRegisters(true), ParamDestroyedInCallee(false) {<br class="">   assert(classof(static_cast<De<wbr class="">cl*>(this)) && "Invalid Kind!");<br class=""> }<br class=""><br class=""><br class="">Modified: cfe/trunk/lib/AST/DeclCXX.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/AST/D<wbr class="">eclCXX.cpp?rev=328731&r1=32873<wbr class="">0&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/AST/DeclCXX.cpp (original)<br class="">+++ cfe/trunk/lib/AST/DeclCXX.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -801,7 +801,17 @@ void CXXRecordDecl::addedMember(Dec<wbr class="">l *D)<br class="">         struct DefinitionData &Data = data();<br class="">         Data.PlainOldData = false;<br class="">         Data.HasTrivialSpecialMembers = 0;<br class="">-        Data.HasTrivialSpecialMembersF<wbr class="">orCall = 0;<br class="">+<br class="">+        // __strong or __weak fields do not make special functions non-trivial<br class="">+        // for the purpose of calls.<br class="">+        Qualifiers::ObjCLifetime LT = T.getQualifiers().getObjCLifet<wbr class="">ime();<br class="">+        if (LT != Qualifiers::OCL_Strong && LT != Qualifiers::OCL_Weak)<br class="">+          data().HasTrivialSpecialMember<wbr class="">sForCall = 0;<br class="">+<br class="">+        // Structs with __weak fields should never be passed directly.<br class="">+        if (LT == Qualifiers::OCL_Weak)<br class="">+          setCanPassInRegisters(false);<br class="">+<br class="">         Data.HasIrrelevantDestructor = false;<br class="">       } else if (!Context.getLangOpts().ObjCAu<wbr class="">toRefCount) {<br class="">         setHasObjectMember(true);<br class=""><br class="">Modified: cfe/trunk/lib/AST/Type.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/AST/T<wbr class="">ype.cpp?rev=328731&r1=328730&r<wbr class="">2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/AST/Type.cpp (original)<br class="">+++ cfe/trunk/lib/AST/Type.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -2195,12 +2195,6 @@ bool QualType::isTriviallyCopyableT<wbr class="">ype(c<br class="">   return false;<br class=""> }<br class=""><br class="">-bool QualType::hasTrivialABIOverrid<wbr class="">e() const {<br class="">-  if (const auto *RD = getTypePtr()->getAsCXXRecordDe<wbr class="">cl())<br class="">-    return RD->hasTrivialABIOverride();<br class="">-  return false;<br class="">-}<br class="">-<br class=""> bool QualType::isNonWeakInMRRWithOb<wbr class="">jCWeak(const ASTContext &Context) const {<br class="">   return !Context.getLangOpts().ObjCAut<wbr class="">oRefCount &&<br class="">         <span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span>Context.getLangOpts().ObjCWe<wbr class="">ak &&<br class=""><br class="">Modified: cfe/trunk/lib/Basic/TargetInfo<wbr class="">.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Basic<wbr class="">/TargetInfo.cpp?rev=328731&r1=<wbr class="">328730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Basic/TargetInfo<wbr class="">.cpp (original)<br class="">+++ cfe/trunk/lib/Basic/TargetInfo<wbr class="">.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -357,6 +357,14 @@ bool TargetInfo::initFeatureMap(<br class="">   return true;<br class=""> }<br class=""><br class="">+TargetInfo::CallingConvKind<br class="">+TargetInfo::getCallingConvKin<wbr class="">d(bool ClangABICompat4) const {<br class="">+  if (getCXXABI() != TargetCXXABI::Microsoft &&<br class="">+      (ClangABICompat4 || getTriple().getOS() == llvm::Triple::PS4))<br class="">+    return CCK_ClangABI4OrPS4;<br class="">+  return CCK_Default;<br class="">+}<br class="">+<br class=""> LangAS TargetInfo::getOpenCLTypeAddrS<wbr class="">pace(OpenCLTypeKind TK) const {<br class="">   switch (TK) {<br class="">   case OCLTK_Image:<br class=""><br class="">Modified: cfe/trunk/lib/Basic/Targets/X8<wbr class="">6.h<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.h?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Basic<wbr class="">/Targets/X86.h?rev=328731&r1=3<wbr class="">28730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Basic/Targets/X8<wbr class="">6.h (original)<br class="">+++ cfe/trunk/lib/Basic/Targets/X8<wbr class="">6.h Wed Mar 28 14:13:14 2018<br class="">@@ -728,6 +728,11 @@ public:<br class="">     Builder.defineMacro("_M_X64", "100");<br class="">     Builder.defineMacro("_M_AMD64<wbr class="">", "100");<br class="">   }<br class="">+<br class="">+  TargetInfo::CallingConvKind<br class="">+  getCallingConvKind(bool ClangABICompat4) const override {<br class="">+    return CCK_MicrosoftX86_64;<br class="">+  }<br class=""> };<br class=""><br class=""> // x86-64 MinGW target<br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/CGCall.c<wbr class="">pp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/CodeG<wbr class="">en/CGCall.cpp?rev=328731&r1=32<wbr class="">8730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/CodeGen/CGCall.c<wbr class="">pp (original)<br class="">+++ cfe/trunk/lib/CodeGen/CGCall.c<wbr class="">pp Wed Mar 28 14:13:14 2018<br class="">@@ -3540,24 +3540,13 @@ void CodeGenFunction::EmitCallArg(C<wbr class="">allAr<br class="">     else<br class="">       Slot = CreateAggTemp(type, "agg.tmp");<br class=""><br class="">-    bool DestroyedInCallee = true, NeedsEHCleanup = true;<br class="">-    if (const auto *RD = type->getAsCXXRecordDecl()) {<br class="">-      DestroyedInCallee =<br class="">-          RD && RD->hasNonTrivialDestructor() &&<br class="">-          (CGM.getCXXABI().getRecordArgA<wbr class="">BI(RD) != CGCXXABI::RAA_Default ||<br class="">-           RD->hasTrivialABIOverride());<br class="">-    } else {<br class="">-      NeedsEHCleanup = needsEHCleanup(type.isDestruct<wbr class="">edType());<br class="">-    }<br class="">-<br class="">-    if (DestroyedInCallee)<br class="">-      Slot.setExternallyDestructed()<wbr class="">;<br class="">+    Slot.setExternallyDestructed()<wbr class="">;<br class=""><br class="">     EmitAggExpr(E, Slot);<br class="">     RValue RV = Slot.asRValue();<br class="">     args.add(RV, type);<br class=""><br class="">-    if (DestroyedInCallee && NeedsEHCleanup) {<br class="">+    if (type->getAsCXXRecordDecl() || needsEHCleanup(type.isDestruct<wbr class="">edType())) {<br class="">       // Create a no-op GEP between the placeholder and the cleanup so we can<br class="">       // RAUW it successfully.  It also serves as a marker of the first<br class="">       // instruction where the cleanup is active.<br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/ItaniumC<wbr class="">XXABI.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/CodeG<wbr class="">en/ItaniumCXXABI.cpp?rev=32873<wbr class="">1&r1=328730&r2=328731&view=dif<wbr class="">f</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/CodeGen/ItaniumC<wbr class="">XXABI.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/ItaniumC<wbr class="">XXABI.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -63,13 +63,6 @@ public:<br class="">   bool classifyReturnType(CGFunctionI<wbr class="">nfo &FI) const override;<br class=""><br class="">   bool passClassIndirect(const CXXRecordDecl *RD) const {<br class="">-    // Clang <= 4 used the pre-C++11 rule, which ignores move operations.<br class="">-    // The PS4 platform ABI follows the behavior of Clang 3.2.<br class="">-    if (CGM.getCodeGenOpts().getClang<wbr class="">ABICompat() <=<br class="">-            CodeGenOptions::ClangABI::Ver4 ||<br class="">-        CGM.getTriple().getOS() == llvm::Triple::PS4)<br class="">-      return RD->hasNonTrivialDestructorFor<wbr class="">Call() ||<br class="">-             RD->hasNonTrivialCopyConstruc<wbr class="">torForCall();<br class="">     return !canCopyArgument(RD);<br class="">   }<br class=""><br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/Microsof<wbr class="">tCXXABI.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/CodeG<wbr class="">en/MicrosoftCXXABI.cpp?rev=328<wbr class="">731&r1=328730&r2=328731&view=d<wbr class="">iff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/CodeGen/Microsof<wbr class="">tCXXABI.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/Microsof<wbr class="">tCXXABI.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -829,60 +829,7 @@ MicrosoftCXXABI::getRecordArgA<wbr class="">BI(const C<br class="">     return RAA_Default;<br class=""><br class="">   case llvm::Triple::x86_64:<br class="">-    bool CopyCtorIsTrivial = false, CopyCtorIsTrivialForCall = false;<br class="">-    bool DtorIsTrivialForCall = false;<br class="">-<br class="">-    // If a class has at least one non-deleted, trivial copy constructor, it<br class="">-    // is passed according to the C ABI. Otherwise, it is passed indirectly.<br class="">-    //<br class="">-    // Note: This permits classes with non-trivial copy or move ctors to be<br class="">-    // passed in registers, so long as they *also* have a trivial copy ctor,<br class="">-    // which is non-conforming.<br class="">-    if (RD->needsImplicitCopyConstruc<wbr class="">tor()) {<br class="">-      if (!RD->defaultedCopyConstructor<wbr class="">IsDeleted()) {<br class="">-        if (RD->hasTrivialCopyConstructor<wbr class="">())<br class="">-          CopyCtorIsTrivial = true;<br class="">-        if (RD->hasTrivialCopyConstructor<wbr class="">ForCall())<br class="">-          CopyCtorIsTrivialForCall = true;<br class="">-      }<br class="">-    } else {<br class="">-      for (const CXXConstructorDecl *CD : RD->ctors()) {<br class="">-        if (CD->isCopyConstructor() && !CD->isDeleted()) {<br class="">-          if (CD->isTrivial())<br class="">-            CopyCtorIsTrivial = true;<br class="">-          if (CD->isTrivialForCall())<br class="">-            CopyCtorIsTrivialForCall = true;<br class="">-        }<br class="">-      }<br class="">-    }<br class="">-<br class="">-    if (RD->needsImplicitDestructor()<wbr class="">) {<br class="">-      if (!RD->defaultedDestructorIsDel<wbr class="">eted() &&<br class="">-          RD->hasTrivialDestructorForCal<wbr class="">l())<br class="">-        DtorIsTrivialForCall = true;<br class="">-    } else if (const auto *D = RD->getDestructor()) {<br class="">-      if (!D->isDeleted() && D->isTrivialForCall())<br class="">-        DtorIsTrivialForCall = true;<br class="">-    }<br class="">-<br class="">-    // If the copy ctor and dtor are both trivial-for-calls, pass direct.<br class="">-    if (CopyCtorIsTrivialForCall && DtorIsTrivialForCall)<br class="">-      return RAA_Default;<br class="">-<br class="">-    // If a class has a destructor, we'd really like to pass it indirectly<br class="">-    // because it allows us to elide copies.  Unfortunately, MSVC makes that<br class="">-    // impossible for small types, which it will pass in a single register or<br class="">-    // stack slot. Most objects with dtors are large-ish, so handle that early.<br class="">-    // We can't call out all large objects as being indirect because there are<br class="">-    // multiple x64 calling conventions and the C++ ABI code shouldn't dictate<br class="">-    // how we pass large POD types.<br class="">-<br class="">-    // Note: This permits small classes with nontrivial destructors to be<br class="">-    // passed in registers, which is non-conforming.<br class="">-    if (CopyCtorIsTrivial &&<br class="">-        getContext().getTypeSize(RD->g<wbr class="">etTypeForDecl()) <= 64)<br class="">-      return RAA_Default;<br class="">-    return RAA_Indirect;<br class="">+    return !canCopyArgument(RD) ? RAA_Indirect : RAA_Default;<br class="">   }<br class=""><br class="">   llvm_unreachable("invalid enum");<br class=""><br class="">Modified: cfe/trunk/lib/CodeGen/TargetIn<wbr class="">fo.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/CodeG<wbr class="">en/TargetInfo.cpp?rev=328731&r<wbr class="">1=328730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/CodeGen/TargetIn<wbr class="">fo.cpp (original)<br class="">+++ cfe/trunk/lib/CodeGen/TargetIn<wbr class="">fo.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -2131,8 +2131,8 @@ class X86_64ABIInfo : public SwiftABIInf<br class="">   /// classify it as INTEGER (for compatibility with older clang compilers).<br class="">   bool classifyIntegerMMXAsSSE() const {<br class="">     // Clang <= 3.8 did not do this.<br class="">-    if (getCodeGenOpts().getClangABIC<wbr class="">ompat() <=<br class="">-        CodeGenOptions::ClangABI::Ver3<wbr class="">_8)<br class="">+    if (getContext().getLangOpts().ge<wbr class="">tClangABICompat() <=<br class="">+        LangOptions::ClangABI::Ver3_8)<br class="">       return false;<br class=""><br class="">     const llvm::Triple &Triple = getTarget().getTriple();<br class=""><br class="">Modified: cfe/trunk/lib/Frontend/Compile<wbr class="">rInvocation.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Front<wbr class="">end/CompilerInvocation.cpp?rev<wbr class="">=328731&r1=328730&r2=328731&vi<wbr class="">ew=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Frontend/Compile<wbr class="">rInvocation.cpp (original)<br class="">+++ cfe/trunk/lib/Frontend/Compile<wbr class="">rInvocation.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -633,33 +633,6 @@ static bool ParseCodeGenArgs(CodeGenOpti<br class="">   if (!Opts.ProfileInstrumentUsePat<wbr class="">h.empty())<br class="">     setPGOUseInstrumentor(Opts, Opts.ProfileInstrumentUsePath)<wbr class="">;<br class=""><br class="">-  if (Arg *A = Args.getLastArg(OPT_fclang_abi<wbr class="">_compat_EQ)) {<br class="">-    Opts.setClangABICompat(CodeGen<wbr class="">Options::ClangABI::Latest);<br class="">-<br class="">-    StringRef Ver = A->getValue();<br class="">-    std::pair<StringRef, StringRef> VerParts = Ver.split('.');<br class="">-    unsigned Major, Minor = 0;<br class="">-<br class="">-    // Check the version number is valid: either 3.x (0 <= x <= 9) or<br class="">-    // y or y.0 (4 <= y <= current version).<br class="">-    if (!VerParts.first.startswith("0<wbr class="">") &&<br class="">-        !VerParts.first.getAsInteger(1<wbr class="">0, Major) &&<br class="">-        3 <= Major && Major <= CLANG_VERSION_MAJOR &&<br class="">-        (Major == 3 ? VerParts.second.size() == 1 &&<br class="">-                      !VerParts.second.getAsInteger(<wbr class="">10, Minor)<br class="">-                    : VerParts.first.size() == Ver.size() ||<br class="">-                      VerParts.second == "0")) {<br class="">-      // Got a valid version number.<br class="">-      if (Major == 3 && Minor <= 8)<br class="">-        Opts.setClangABICompat(CodeGen<wbr class="">Options::ClangABI::Ver3_8);<br class="">-      else if (Major <= 4)<br class="">-        Opts.setClangABICompat(CodeGen<wbr class="">Options::ClangABI::Ver4);<br class="">-    } else if (Ver != "latest") {<br class="">-      Diags.Report(diag::err_drv_inv<wbr class="">alid_value)<br class="">-          << A->getAsString(Args) << A->getValue();<br class="">-    }<br class="">-  }<br class="">-<br class="">   Opts.CoverageMapping =<br class="">       Args.hasFlag(OPT_fcoverage_ma<wbr class="">pping, OPT_fno_coverage_mapping, false);<br class="">   Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_<wbr class="">mapping);<br class="">@@ -2670,6 +2643,33 @@ static void ParseLangArgs(LangOptions &O<br class=""><br class="">   // -fallow-editor-placeholders<br class="">   Opts.AllowEditorPlaceholders = Args.hasArg(OPT_fallow_editor_<wbr class="">placeholders);<br class="">+<br class="">+  if (Arg *A = Args.getLastArg(OPT_fclang_abi<wbr class="">_compat_EQ)) {<br class="">+    Opts.setClangABICompat(LangOpt<wbr class="">ions::ClangABI::Latest);<br class="">+<br class="">+    StringRef Ver = A->getValue();<br class="">+    std::pair<StringRef, StringRef> VerParts = Ver.split('.');<br class="">+    unsigned Major, Minor = 0;<br class="">+<br class="">+    // Check the version number is valid: either 3.x (0 <= x <= 9) or<br class="">+    // y or y.0 (4 <= y <= current version).<br class="">+    if (!VerParts.first.startswith("0<wbr class="">") &&<br class="">+        !VerParts.first.getAsInteger(1<wbr class="">0, Major) &&<br class="">+        3 <= Major && Major <= CLANG_VERSION_MAJOR &&<br class="">+        (Major == 3 ? VerParts.second.size() == 1 &&<br class="">+                      !VerParts.second.getAsInteger(<wbr class="">10, Minor)<br class="">+                    : VerParts.first.size() == Ver.size() ||<br class="">+                      VerParts.second == "0")) {<br class="">+      // Got a valid version number.<br class="">+      if (Major == 3 && Minor <= 8)<br class="">+        Opts.setClangABICompat(LangOpt<wbr class="">ions::ClangABI::Ver3_8);<br class="">+      else if (Major <= 4)<br class="">+        Opts.setClangABICompat(LangOpt<wbr class="">ions::ClangABI::Ver4);<br class="">+    } else if (Ver != "latest") {<br class="">+      Diags.Report(diag::err_drv_inv<wbr class="">alid_value)<br class="">+          << A->getAsString(Args) << A->getValue();<br class="">+    }<br class="">+  }<br class=""> }<br class=""><br class=""> static bool isStrictlyPreprocessorAction(f<wbr class="">rontend::ActionKind Action) {<br class=""><br class="">Modified: cfe/trunk/lib/Sema/SemaDecl.cp<wbr class="">p<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Sema/<wbr class="">SemaDecl.cpp?rev=328731&r1=328<wbr class="">730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Sema/SemaDecl.cp<wbr class="">p (original)<br class="">+++ cfe/trunk/lib/Sema/SemaDecl.cp<wbr class="">p Wed Mar 28 14:13:14 2018<br class="">@@ -15461,8 +15461,10 @@ void Sema::ActOnFields(Scope *S, SourceL<br class="">       QualType::PrimitiveCopyKind PCK = FT.isNonTrivialToPrimitiveCopy<wbr class="">();<br class="">       if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)<br class="">         Record->setNonTrivialToPrimit<wbr class="">iveCopy(true);<br class="">-      if (FT.isDestructedType())<br class="">+      if (FT.isDestructedType()) {<br class="">         Record->setNonTrivialToPrimit<wbr class="">iveDestroy(true);<br class="">+        Record->setParamDestroyedInCal<wbr class="">lee(true);<br class="">+      }<br class="">       if (!FT.canPassInRegisters())<br class="">         Record->setCanPassInRegisters<wbr class="">(false);<br class="">     }<br class=""><br class="">Modified: cfe/trunk/lib/Sema/SemaDeclCXX<wbr class="">.cpp<br class="">URL:<span class="m_1114189100479675556m_-7519891156417877842m_-3422063603182055068gmail-m_-3123202202555592205Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Sema/<wbr class="">SemaDeclCXX.cpp?rev=328731&r1=<wbr class="">328730&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Sema/SemaDeclCXX<wbr class="">.cpp (original)<br class="">+++ cfe/trunk/lib/Sema/SemaDeclCXX<wbr class="">.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -5791,12 +5791,21 @@ static void DefineImplicitSpecialMember(<br class="">   }<br class=""> }<br class=""><br class="">-/// Determine whether a type is permitted to be passed or returned in<br class="">-/// registers, per C++ [class.temporary]p3.<br class="">-static bool computeCanPassInRegisters(Sema &S, CXXRecordDecl *D) {<br class="">+/// Determine whether a type would be destructed in the callee if it had a<br class="">+/// non-trivial destructor. The rules here are based on C++ [class.temporary]p3,<br class="">+/// which determines whether a struct can be passed to or returned from<br class="">+/// functions in registers.<br class="">+static bool paramCanBeDestroyedInCallee(Se<wbr class="">ma &S, CXXRecordDecl *D,<br class="">+                                        TargetInfo::CallingConvKind CCK) {<br class="">   if (D->isDependentType() || D->isInvalidDecl())<br class="">     return false;<br class=""><br class="">+  // Clang <= 4 used the pre-C++11 rule, which ignores move operations.<br class="">+  // The PS4 platform ABI follows the behavior of Clang 3.2.<br class="">+  if (CCK == TargetInfo::CCK_ClangABI4OrPS4<wbr class="">)<br class="">+    return !D->hasNonTrivialDestructorFor<wbr class="">Call() &&<br class="">+           !D->hasNonTrivialCopyConstruc<wbr class="">torForCall();<br class="">+<br class="">   // Per C++ [class.temporary]p3, the relevant condition is:<br class="">   //   each copy constructor, move constructor, and destructor of X is<br class="">   //   either trivial or deleted, and X has at least one non-deleted copy<br class="">@@ -5838,6 +5847,77 @@ static bool computeCanPassInRegisters(Se<br class="">   return HasNonDeletedCopyOrMove;<br class=""> }<br class=""><br class="">+static bool computeCanPassInRegister(bool DestroyedInCallee,<br class="">+                                     const CXXRecordDecl *RD,<br class="">+                                     TargetInfo::CallingConvKind CCK,<br class="">+                                     Sema &S) {<br class="">+  if (RD->isDependentType() || RD->isInvalidDecl())<br class="">+    return true;<br class="">+<br class="">+  // The param cannot be passed in registers if CanPassInRegisters is already<br class="">+  // set to false.<br class="">+  if (!RD->canPassInRegisters())<br class="">+    return false;<br class="">+<br class="">+  if (CCK != TargetInfo::CCK_MicrosoftX86_6<wbr class="">4)<br class="">+    return DestroyedInCallee;<br class="">+<br class="">+  bool CopyCtorIsTrivial = false, CopyCtorIsTrivialForCall = false;<br class="">+  bool DtorIsTrivialForCall = false;<br class="">+<br class="">+  // If a class has at least one non-deleted, trivial copy constructor, it<br class="">+  // is passed according to the C ABI. Otherwise, it is passed indirectly.<br class="">+  //<br class="">+  // Note: This permits classes with non-trivial copy or move ctors to be<br class="">+  // passed in registers, so long as they *also* have a trivial copy ctor,<br class="">+  // which is non-conforming.<br class="">+  if (RD->needsImplicitCopyConstruc<wbr class="">tor()) {<br class="">+    if (!RD->defaultedCopyConstructor<wbr class="">IsDeleted()) {<br class="">+      if (RD->hasTrivialCopyConstructor<wbr class="">())<br class="">+        CopyCtorIsTrivial = true;<br class="">+      if (RD->hasTrivialCopyConstructor<wbr class="">ForCall())<br class="">+        CopyCtorIsTrivialForCall = true;<br class="">+    }<br class="">+  } else {<br class="">+    for (const CXXConstructorDecl *CD : RD->ctors()) {<br class="">+      if (CD->isCopyConstructor() && !CD->isDeleted()) {<br class="">+        if (CD->isTrivial())<br class="">+          CopyCtorIsTrivial = true;<br class="">+        if (CD->isTrivialForCall())<br class="">+          CopyCtorIsTrivialForCall = true;<br class="">+      }<br class="">+    }<br class="">+  }<br class="">+<br class="">+  if (RD->needsImplicitDestructor()<wbr class="">) {<br class="">+    if (!RD->defaultedDestructorIsDel<wbr class="">eted() &&<br class="">+        RD->hasTrivialDestructorForCal<wbr class="">l())<br class="">+      DtorIsTrivialForCall = true;<br class="">+  } else if (const auto *D = RD->getDestructor()) {<br class="">+    if (!D->isDeleted() && D->isTrivialForCall())<br class="">+      DtorIsTrivialForCall = true;<br class="">+  }<br class="">+<br class="">+  // If the copy ctor and dtor are both trivial-for-calls, pass direct.<br class="">+  if (CopyCtorIsTrivialForCall && DtorIsTrivialForCall)<br class="">+    return true;<br class="">+<br class="">+  // If a class has a destructor, we'd really like to pass it indirectly<br class="">+  // because it allows us to elide copies.  Unfortunately, MSVC makes that<br class="">+  // impossible for small types, which it will pass in a single register or<br class="">+  // stack slot. Most objects with dtors are large-ish, so handle that early.<br class="">+  // We can't call out all large objects as being indirect because there are<br class="">+  // multiple x64 calling conventions and the C++ ABI code shouldn't dictate<br class="">+  // how we pass large POD types.<br class="">+<br class="">+  // Note: This permits small classes with nontrivial destructors to be<br class="">+  // passed in registers, which is non-conforming.<br class="">+  if (CopyCtorIsTrivial &&<br class="">+      S.getASTContext().getTypeSize(<wbr class="">RD->getTypeForDecl()) <= 64)<br class="">+    return true;<br class="">+  return false;<br class="">+}<br class="">+<br class=""> /// \brief Perform semantic checks on a class definition that has been<br class=""> /// completing, introducing implicitly-declared members, checking for<br class=""> /// abstract types, etc.<br class="">@@ -6001,7 +6081,17 @@ void Sema::CheckCompletedCXXClass(C<wbr class="">XXRec<br class=""><br class="">   checkClassLevelDLLAttribute(R<wbr class="">ecord);<br class=""><br class="">-  Record->setCanPassInRegisters(<wbr class="">computeCanPassInRegisters(*thi<wbr class="">s, Record));<br class="">+  bool ClangABICompat4 =<br class="">+      Context.getLangOpts().getClang<wbr class="">ABICompat() <= LangOptions::ClangABI::Ver4;<br class="">+  TargetInfo::CallingConvKind CCK =<br class="">+      Context.getTargetInfo().getCal<wbr class="">lingConvKind(ClangABICompat4);<br class="">+  bool DestroyedInCallee = paramCanBeDestroyedInCallee(*t<wbr class="">his, Record, CCK);<br class="">+<br class="">+  if (Record->hasNonTrivialDestruct<wbr class="">or())<br class="">+    Record->setParamDestroyedInCal<wbr class="">lee(DestroyedInCallee);<br class="">+<br class="">+  Record->setCanPassInRegisters(<br class="">+      computeCanPassInRegister(Destr<wbr class="">oyedInCallee, Record, CCK, *this));<br class=""> }<br class=""></blockquote><div class=""><br class=""></div><div class="">The naming you're using here doesn't make any sense to me.</div><div class=""><br class=""></div><div class="">"paramCanBeDestroyedInCallee" is computing whether the class is allowed to be passed in registers (per the language rules), not whether it's destroyed in callee (which is based on whether we're using the MS ABI, which sometimes destroys parameters in the callee).</div><div class="">"computeCanPassInRegister" appears to be computing whether the parameter *should* be passed in registers (per the quirks of the ABI), not whether it can be passed in registers. (Also I'm not sure why you converted the name from plural to singular -- we really do mean zero or more registers here, not exactly one.)</div><div class=""><br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div></div></div><div class="">Does this patch make more sense to you?</div></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, thanks, but canPassInRegisters is still documented as computing the standard notion of "can be passed in registers" but is actually now computing an ABI-specific notion of "should be passed in registers" (which is the same except in the MSABI case where we pass some things in registers even when we're not actually allowed to); please update the comments to match, and consider renaming it to just "passInRegisters".</div></div></div></div></div></blockquote></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">On reflection, I think the current name is better, since this doesn't govern whether the type is actually passed in registers, merely whether it's passable in registers (per the ABI rules), where we assume that types that are passable in registers but not actually passed in registers still behave as if they were passed in registers (in particular, the cleanups happen in the callee, and they may be subject to memcpy along the way).</div><div class=""> </div><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 class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class=""><div class="m_1114189100479675556m_-7519891156417877842h5"><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote"><div class="">I'm also not clear why you need to store a bit for "param destroyed in callee", since it seems to always be equivalent to hasNonTrivialDestructor() && passInRegisters(). Are there cases where paramDestroyedInCallee() is intentionally different from that?</div><div class=""> <br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div></div></div><div class="">Yes, struct ’S’ in the summary of<span class="m_1114189100479675556m_-7519891156417877842Apple-converted-space"> </span><a href="https://reviews.llvm.org/D44908" target="_blank" class="">https://reviews.llvm.org/D4<wbr class="">4908</a> is destructed in the callee and passed indirectly, so “hasNonTrivialDestructor() && passInRegisters()” would return false while paramDestroyedInCallee() returns true. We want to have it destructed in the callee so that the struct can be passed from C++ code to C code.</div></div></div></blockquote><div class=""><br class=""></div><div class="">That seems like the wrong way to model that type to me. The type from D44908 should have a non-trivial destructor, because destroying an instance of it needs to run code (otherwise you'll cause all sorts of havoc, for instance if such a type is held in a standard library container the __weak cleanups won't run).</div><div class=""><br class=""></div><div class="">If we want to say that it's passed in registers *despite having a non-trivial destructor* and destroy it in the callee, for compatibility with C types containing __weak / __strong fields, then that seems fine to me, but we should not claim that the type has a trivial destructor when it does not.</div></div></div></div></div></blockquote><div class=""><br class=""></div></div></div><div class="">I didn’t intend to claim that the type has a trivial destructor, because struct ’S’ does have and need a non-trivial destructor. Just to clarify, 'hasNonTrivialDestructor() && canPassInRegisters()' returns false for struct ’S’ because canPassInRegisters() returns false, not because hasNonTrivialDestructor() returns false (it doesn’t).</div><div class=""><br class=""></div><div class="">Does that clarify what I said?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Ah, yes, my apologies for the misunderstanding. That makes sense.</div><div class=""><br class=""></div><div class="">I like your suggested patch, but I'd still like to see the comments updated to match (particularly RecordDecl::CanPassInRegisters and the canPassInRegisters function).</div><div class=""><br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div>I’ll send a new patch with updated comments.</div><div class="" 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;"><br class=""></div></div></blockquote><div class=""><br class=""></div></div></div>Here is the new patch.</div><div class=""><br class=""></div><div class=""></div></div><br class=""><div class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="" 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;"><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote"><div class="">Have you considered taking the target's "destroyed right to left in callee" flag into account when computing ParamDestroyedInCallee, rather than deferring that until ASTContext::<wbr class="">isParamDestroyedInCallee? If this is going to be an ABI-dependent flag anyway (because it depends on CanPassInRegisters, which is ABI-dependent), it would make some sense for it to always reflect the ABI's rule.</div><div class=""><br class=""></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class=""><div class="">I think I ran into problems when I tried to take into account what 'TargetCXXABI::<wbr class="">areArgsDestroyedLeftToRightInC<wbr class="">allee()’  returns to set ParamDestroyedInCallee and use the flag in IRGen instead of calling ASTContext::<wbr class="">isParamDestroyedInCallee. There were a few ObjC test cases that started failing, if I remember correctly. But I think we should always set the correct value to RecordDecl::<wbr class="">ParamDestroyedInCallee taking into account what TargetCXXABI::<wbr class="">areArgsDestroyedLeftToRightInC<wbr class="">allee() returns, even though we still have to call ASTContext::<wbr class="">isParamDestroyedInCallee.</div><div class=""><br class=""></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">It turns out some of the microsoft CodeGen tests were failing because I wasn’t setting Record::ParamDestroyedInCallee when the RecordDecl didn’t have a non-trivial destructor. RecordDecl::<wbr class="">ParamDestroyedInCallee has to be set to true when TargetCXXABI::<wbr class="">areArgsDestroyedLeftToRightInC<wbr class="">allee() returns true, regardless of whether the struct has a destructor.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="" 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;"><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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;"><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 class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class=""><div class="m_-6472094517105758356h5"><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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;"><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 class="" style="word-wrap: break-word; line-break: after-white-space;"><div class=""><div class="m_-6472094517105758356m_-7519891156417877842h5"><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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;"><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 class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div dir="auto" class="" style="word-wrap: break-word;"><div class=""><div class=""><div class=""><div class="">The static function canPassInRegisters computes whether the record can be passed in registers depending on which of the three ABIs (clang-abi-compat=4.0, 64-bit microsoft, and Itanium C++ ABI) we are using. The function returns the correct answer except when ARC is enabled and the record has a __weak field, which is why CXXRecordDecl::canPassInRegist<wbr class="">ers() has to be called too to check the presence of __weak fields when computing the value for flag RecordDecl::CanPassInRegisters<wbr class="">.  I discovered there is a bug which causes a struct containing another struct with __weak fields to be passed directly, but I think that can be fixed in a separate patch.</div><div class=""><br class=""></div><div class="">Sema::CheckCompletedCXXClass also computes the value for flag RecordDecl::ParamDestroyedInCa<wbr class="">llee (note that this flag is meaningless when Microsoft ABI is used). This is how it works when a struct has __weak or __strong fields:</div><div class=""><br class=""></div><div class="">1. In CXXRecordDecl::addedMember, pretend that __weak or __strong fields do not make special functions non-trivial for the purpose of calls.</div><div class="">2. If canPassInRegisters returns true, use the C ABI to pass the record, which destructs records in the callee and passes records with __weak fields indirectly (records having __strong fields but no __weak fields are not forced to be passed indirectly). If it returns false, use the C++ ABI, which destructs the record in the caller and passes it indirectly.</div><div class="">3. Since we cannot count on canPassInRegisters to tell whether a record can be passed directly in the presence of a __weak field, CXXRecordDecl::addedMember calls setCanPassInRegisters(false) so that we know the record cannot be passed directly.</div><div class=""><br class=""></div><div class="">hasTrivialABIOverride (which computes "canPassInRegisters() && hasNonTrivialDestructor()") used to determine whether a struct is destructed in the callee, but the function can no longer be used since structs with __weak fields are always passed indirectly.</div><div class=""><br class=""></div></div></div></div><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" 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;"><div class="gmail_extra"><div class="gmail_quote"><div class="">Please can you fix these names?</div><div class=""> </div><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;"> /// Look up the special member function that would be called by a special<br class=""><br class="">Modified: cfe/trunk/lib/Serialization/AS<wbr class="">TReaderDecl.cpp<br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Seria<wbr class="">lization/ASTReaderDecl.cpp?rev<wbr class="">=328731&r1=328730&r2=328731&vi<wbr class="">ew=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Serialization/AS<wbr class="">TReaderDecl.cpp (original)<br class="">+++ cfe/trunk/lib/Serialization/AS<wbr class="">TReaderDecl.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -743,6 +743,7 @@ ASTDeclReader::VisitRecordDecl<wbr class="">Impl(Recor<br class="">   RD->setNonTrivialToPrimitiveC<wbr class="">opy(Record.readInt());<br class="">   RD->setNonTrivialToPrimitiveD<wbr class="">estroy(Record.readInt());<br class="">   RD->setCanPassInRegisters(Rec<wbr class="">ord.readInt());<br class="">+  RD->setParamDestroyedInCallee(<wbr class="">Record.readInt());<br class="">   return Redecl;<br class=""> }<br class=""><br class="">@@ -4109,6 +4110,7 @@ void ASTDeclReader::UpdateDecl(Decl *D,<br class="">           OldDD && (OldDD->Definition != RD ||<br class="">                     !Reader.PendingFakeDefinition<wbr class="">Data.count(OldDD));<br class="">       RD->setCanPassInRegisters(Rec<wbr class="">ord.readInt());<br class="">+      RD->setParamDestroyedInCallee(<wbr class="">Record.readInt());<br class="">       ReadCXXRecordDefinition(RD, /*Update*/true);<br class=""><br class="">       // Visible update is handled separately.<br class=""><br class="">Modified: cfe/trunk/lib/Serialization/AS<wbr class="">TWriter.cpp<br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Seria<wbr class="">lization/ASTWriter.cpp?rev=328<wbr class="">731&r1=328730&r2=328731&view=d<wbr class="">iff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Serialization/AS<wbr class="">TWriter.cpp (original)<br class="">+++ cfe/trunk/lib/Serialization/AS<wbr class="">TWriter.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -5194,6 +5194,7 @@ void ASTWriter::WriteDeclUpdatesBlo<wbr class="">cks(R<br class="">         auto *RD = cast<CXXRecordDecl>(D);<br class="">         UpdatedDeclContexts.insert(RD<wbr class="">->getPrimaryContext());<br class="">         Record.push_back(RD->canPassI<wbr class="">nRegisters());<br class="">+        Record.push_back(RD->isParamDe<wbr class="">stroyedInCallee());<br class="">         Record.AddCXXDefinitionData(R<wbr class="">D);<br class="">         Record.AddOffset(WriteDeclCon<wbr class="">textLexicalBlock(<br class="">             *Context, const_cast<CXXRecordDecl *>(RD)));<br class=""><br class="">Modified: cfe/trunk/lib/Serialization/AS<wbr class="">TWriterDecl.cpp<br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/lib/Seria<wbr class="">lization/ASTWriterDecl.cpp?rev<wbr class="">=328731&r1=328730&r2=328731&vi<wbr class="">ew=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/lib/Serialization/AS<wbr class="">TWriterDecl.cpp (original)<br class="">+++ cfe/trunk/lib/Serialization/AS<wbr class="">TWriterDecl.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -470,6 +470,7 @@ void ASTDeclWriter::VisitRecordDecl<wbr class="">(Reco<br class="">   Record.push_back(D->isNonTriv<wbr class="">ialToPrimitiveCopy());<br class="">   Record.push_back(D->isNonTriv<wbr class="">ialToPrimitiveDestroy());<br class="">   Record.push_back(D->canPassIn<wbr class="">Registers());<br class="">+  Record.push_back(D->isParamDes<wbr class="">troyedInCallee());<br class=""><br class="">   if (D->getDeclContext() == D->getLexicalDeclContext() &&<br class="">       !D->hasAttrs() &&<br class="">@@ -1912,6 +1913,8 @@ void ASTWriter::WriteDeclAbbrevs() {<br class="">   // isNonTrivialToPrimitiveDestroy<br class="">   Abv->Add(BitCodeAbbrevOp(BitC<wbr class="">odeAbbrevOp::Fixed, 1));<br class="">   Abv->Add(BitCodeAbbrevOp(BitC<wbr class="">odeAbbrevOp::Fixed, 1)); // canPassInRegisters<br class="">+  // isParamDestroyedInCallee<br class="">+  Abv->Add(BitCodeAbbrevOp(BitCo<wbr class="">deAbbrevOp::Fixed, 1));<br class=""><br class="">   // DC<br class="">   Abv->Add(BitCodeAbbrevOp(BitC<wbr class="">odeAbbrevOp::VBR, 6));   // LexicalOffset<br class=""><br class="">Modified: cfe/trunk/test/CodeGenCXX/micr<wbr class="">osoft-abi-sret-and-byval.cpp<br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/test/Code<wbr class="">GenCXX/microsoft-abi-sret-and-<wbr class="">byval.cpp?rev=328731&r1=328730<wbr class="">&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/test/CodeGenCXX/micr<wbr class="">osoft-abi-sret-and-byval.cpp (original)<br class="">+++ cfe/trunk/test/CodeGenCXX/micr<wbr class="">osoft-abi-sret-and-byval.cpp Wed Mar 28 14:13:14 2018<br class="">@@ -172,12 +172,9 @@ void small_arg_with_dtor(SmallWithD<wbr class="">tor s<br class=""> void call_small_arg_with_dtor() {<br class="">   small_arg_with_dtor(SmallWith<wbr class="">Dtor());<br class=""> }<br class="">-// The temporary is copied, so it's destroyed in the caller as well as the<br class="">-// callee.<br class=""> // WIN64-LABEL: define dso_local void @"?call_small_arg_with_dtor@@Y<wbr class="">AXXZ"()<br class=""> // WIN64:   call %struct.SmallWithDtor* @"??0SmallWithDtor@@QEAA@XZ"<br class=""> // WIN64:   call void @"?small_arg_with_dtor@@YAXUSm<wbr class="">allWithDtor@@@Z"(i32 %{{.*}})<br class="">-// WIN64:   call void @"??1SmallWithDtor@@QEAA@XZ"<br class=""> // WIN64:   ret void<br class=""><br class=""> // Test that references aren't destroyed in the callee.<br class=""><br class="">Modified: cfe/trunk/test/CodeGenObjCXX/<a href="http://arc-special-member-functions.mm/" rel="noreferrer" target="_blank" class="">a<wbr class="">rc-special-member-functions.mm</a><br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-special-member-functions.mm?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/test/Code<wbr class="">GenObjCXX/arc-special-member-f<wbr class="">unctions.mm?rev=328731&r1=3287<wbr class="">30&r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/test/CodeGenObjCXX/<a href="http://arc-special-member-functions.mm/" rel="noreferrer" target="_blank" class="">a<wbr class="">rc-special-member-functions.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"><wbr class=""> </span>(original)<br class="">+++ cfe/trunk/test/CodeGenObjCXX/<a href="http://arc-special-member-functions.mm/" rel="noreferrer" target="_blank" class="">a<wbr class="">rc-special-member-functions.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"><wbr class=""> </span>Wed Mar 28 14:13:14 2018<br class="">@@ -31,6 +31,8 @@ void test_ObjCMember_copy_construct<wbr class="">_dest<br class=""> void test_ObjCMember_copy_assign(Ob<wbr class="">jCMember m1, ObjCMember m2) {<br class="">   // CHECK: {{call.*_ZN10ObjCMemberaSERKS_<wbr class="">}}<br class="">   m1 = m2;<br class="">+  // CHECK-NEXT: call void @_ZN10ObjCMemberD1Ev(<br class="">+  // CHECK-NEXT: call void @_ZN10ObjCMemberD1Ev(<br class="">   // CHECK-NEXT: ret void<br class=""> }<br class=""><br class="">@@ -58,6 +60,8 @@ void test_ObjCArrayMember_copy_cons<wbr class="">truct<br class=""> void test_ObjCArrayMember_copy_assi<wbr class="">gn(ObjCArrayMember m1, ObjCArrayMember m2) {<br class="">   // CHECK: {{call.*@_ZN15ObjCArrayMembera<wbr class="">SERKS_}}<br class="">   m1 = m2;<br class="">+  // CHECK-NEXT: call void @_ZN15ObjCArrayMemberD1Ev(<br class="">+  // CHECK-NEXT: call void @_ZN15ObjCArrayMemberD1Ev(<br class="">   // CHECK-NEXT: ret void<br class=""> }<br class=""><br class="">@@ -79,7 +83,8 @@ void test_ObjCBlockMember_default_c<wbr class="">onstr<br class=""> void test_ObjCBlockMember_copy_cons<wbr class="">truct_destruct(ObjCBlockMember m1) {<br class="">   // CHECK: call void @_ZN15ObjCBlockMemberC1ERKS_<br class="">   ObjCBlockMember m2 = m1;<br class="">-  // CHECK-NEXT: call void @_ZN15ObjCBlockMemberD1Ev<br class="">+  // CHECK-NEXT: call void @_ZN15ObjCBlockMemberD1Ev(<br class="">+  // CHECK-NEXT: call void @_ZN15ObjCBlockMemberD1Ev(<br class="">   // CHECK-NEXT: ret void<br class=""> }<br class=""><br class="">@@ -87,6 +92,8 @@ void test_ObjCBlockMember_copy_cons<wbr class="">truct<br class=""> void test_ObjCBlockMember_copy_assi<wbr class="">gn(ObjCBlockMember m1, ObjCBlockMember m2) {<br class="">   // CHECK: {{call.*_ZN15ObjCBlockMemberaS<wbr class="">ERKS_}}<br class="">   m1 = m2;<br class="">+  // CHECK-NEXT: call void @_ZN15ObjCBlockMemberD1Ev(<br class="">+  // CHECK-NEXT: call void @_ZN15ObjCBlockMemberD1Ev(<br class="">   // CHECK-NEXT: ret void<br class=""> }<br class=""><br class=""><br class="">Copied: cfe/trunk/test/CodeGenObjCXX/<a href="http://objc-struct-cxx-abi.mm/" rel="noreferrer" target="_blank" class="">o<wbr class="">bjc-struct-cxx-abi.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>(from r328730, cfe/trunk/test/CodeGenObjCXX/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">t<wbr class="">rivial_abi.mm</a>)<br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/objc-struct-cxx-abi.mm?p2=cfe/trunk/test/CodeGenObjCXX/objc-struct-cxx-abi.mm&p1=cfe/trunk/test/CodeGenObjCXX/trivial_abi.mm&r1=328730&r2=328731&rev=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/test/Code<wbr class="">GenObjCXX/objc-struct-cxx-abi.<wbr class="">mm?p2=cfe/trunk/test/CodeGenOb<wbr class="">jCXX/objc-struct-cxx-abi.mm&p1<wbr class="">=cfe/trunk/test/CodeGenObjCXX/<wbr class="">trivial_abi.mm&r1=328730&r2=32<wbr class="">8731&rev=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/test/CodeGenObjCXX/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">t<wbr class="">rivial_abi.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>(original)<br class="">+++ cfe/trunk/test/CodeGenObjCXX/<a href="http://objc-struct-cxx-abi.mm/" rel="noreferrer" target="_blank" class="">o<wbr class="">bjc-struct-cxx-abi.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>Wed Mar 28 14:13:14 2018<br class="">@@ -1,27 +1,60 @@<br class=""> // RUN: %clang_cc1 -triple arm64-apple-ios11 -std=c++11 -fobjc-arc  -fobjc-weak -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s<br class=""> // RUN: %clang_cc1 -triple arm64-apple-ios11 -std=c++11 -fobjc-arc  -fobjc-weak -fobjc-runtime-has-weak -fclang-abi-compat=4.0 -emit-llvm -o - %s | FileCheck %s<br class="">+// RUN: %clang_cc1 -triple arm64-apple-ios11 -std=c++11 -fobjc-arc  -fobjc-weak -fobjc-runtime-has-weak -emit-llvm -o - -DTRIVIALABI %s | FileCheck %s<br class="">+// RUN: %clang_cc1 -triple arm64-apple-ios11 -std=c++11 -fobjc-arc  -fobjc-weak -fobjc-runtime-has-weak -fclang-abi-compat=4.0 -emit-llvm -o - -DTRIVIALABI %s | FileCheck %s<br class="">+<br class="">+// Check that structs consisting solely of __strong or __weak pointer fields are<br class="">+// destructed in the callee function and structs consisting solely of __strong<br class="">+// pointer fields are passed directly.<br class=""><br class=""> // CHECK: %[[STRUCT_STRONGWEAK:.*]] = type { i8*, i8* }<br class=""> // CHECK: %[[STRUCT_STRONG:.*]] = type { i8* }<br class=""> // CHECK: %[[STRUCT_S:.*]] = type { i8* }<br class="">+// CHECK: %[[STRUCT_CONTAINSNONTRIVIAL:.<wbr class="">*]] = type { %{{.*}}, i8* }<br class=""><br class="">+#ifdef TRIVIALABI<br class=""> struct __attribute__((trivial_abi)) StrongWeak {<br class="">+#else<br class="">+struct StrongWeak {<br class="">+#endif<br class="">   id fstrong;<br class="">   __weak id fweak;<br class=""> };<br class=""><br class="">+#ifdef TRIVIALABI<br class=""> struct __attribute__((trivial_abi)) Strong {<br class="">+#else<br class="">+struct Strong {<br class="">+#endif<br class="">   id fstrong;<br class=""> };<br class=""><br class=""> template<class T><br class="">+#ifdef TRIVIALABI<br class=""> struct __attribute__((trivial_abi)) S {<br class="">+#else<br class="">+struct S {<br class="">+#endif<br class="">   T a;<br class=""> };<br class=""><br class="">+struct NonTrivial {<br class="">+  NonTrivial();<br class="">+  NonTrivial(const NonTrivial &);<br class="">+  ~NonTrivial();<br class="">+  int *a;<br class="">+};<br class="">+<br class="">+// This struct is not passed directly nor destructed in the callee because f0<br class="">+// has type NonTrivial.<br class="">+struct ContainsNonTrivial {<br class="">+  NonTrivial f0;<br class="">+  id f1;<br class="">+};<br class="">+<br class=""> // CHECK: define void @_Z19testParamStrongWeak10Stro<wbr class="">ngWeak(%[[STRUCT_STRONGWEAK]]* %{{.*}})<br class="">-// CHECK-NOT: call<br class="">-// CHECK: ret void<br class="">+// CHECK: call %struct.StrongWeak* @_ZN10StrongWeakD1Ev(<br class="">+// CHECK-NEXT: ret void<br class=""><br class=""> void testParamStrongWeak(StrongWeak a) {<br class=""> }<br class="">@@ -33,7 +66,7 @@ void testParamStrongWeak(StrongWeak a) {<br class=""> // CHECK: %[[V0:.*]] = load %[[STRUCT_STRONGWEAK]]*, %[[STRUCT_STRONGWEAK]]** %[[A_ADDR]], align 8<br class=""> // CHECK: %[[CALL:.*]] = call %[[STRUCT_STRONGWEAK]]* @_ZN10StrongWeakC1ERKS_(%[[STR<wbr class="">UCT_STRONGWEAK]]* %[[AGG_TMP]], %[[STRUCT_STRONGWEAK]]* dereferenceable(16) %[[V0]])<br class=""> // CHECK: call void @_Z19testParamStrongWeak10Stro<wbr class="">ngWeak(%[[STRUCT_STRONGWEAK]]* %[[AGG_TMP]])<br class="">-// CHECK: %[[CALL1:.*]] = call %[[STRUCT_STRONGWEAK]]* @_ZN10StrongWeakD1Ev(%[[STRUCT<wbr class="">_STRONGWEAK]]* %[[AGG_TMP]])<br class="">+// CHECK-NOT: call<br class=""> // CHECK: ret void<br class=""><br class=""> void testCallStrongWeak(StrongWeak *a) {<br class="">@@ -96,8 +129,23 @@ Strong testReturnStrong(Strong *a) {<br class=""> }<br class=""><br class=""> // CHECK: define void @_Z21testParamWeakTemplate1SIU<wbr class="">6__weakP11objc_objectE(%[[STRU<wbr class="">CT_S]]* %{{.*}})<br class="">+// CHECK: call %struct.S* @_ZN1SIU6__weakP11objc_objectE<wbr class="">D1Ev(<br class="">+// CHECK-NEXT: ret void<br class="">+<br class="">+void testParamWeakTemplate(S<__weak id> a) {<br class="">+}<br class="">+<br class="">+// CHECK: define void @_Z27testParamContainsNonTrivi<wbr class="">al18ContainsNonTrivial(%[[STRU<wbr class="">CT_CONTAINSNONTRIVIAL]]* %{{.*}})<br class=""> // CHECK-NOT: call<br class=""> // CHECK: ret void<br class=""><br class="">-void testParamWeakTemplate(S<__weak id> a) {<br class="">+void testParamContainsNonTrivial(Co<wbr class="">ntainsNonTrivial a) {<br class="">+}<br class="">+<br class="">+// CHECK: define void @_Z26testCallContainsNonTrivia<wbr class="">lP18ContainsNonTrivial(<br class="">+// CHECK: call void @_Z27testParamContainsNonTrivi<wbr class="">al18ContainsNonTrivial(%[[STRU<wbr class="">CT_CONTAINSNONTRIVIAL]]* %{{.*}})<br class="">+// CHECK: call %struct.ContainsNonTrivial* @_ZN18ContainsNonTrivialD1Ev(%<wbr class="">[[STRUCT_CONTAINSNONTRIVIAL]]* %{{.*}})<br class="">+<br class="">+void testCallContainsNonTrivial(Con<wbr class="">tainsNonTrivial *a) {<br class="">+  testParamContainsNonTrivial(*a<wbr class="">);<br class=""> }<br class=""><br class="">Modified: cfe/trunk/test/CodeGenObjCXX/<a href="http://property-dot-copy-elision.mm/" rel="noreferrer" target="_blank" class="">p<wbr class="">roperty-dot-copy-elision.mm</a><br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-dot-copy-elision.mm?rev=328731&r1=328730&r2=328731&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/test/Code<wbr class="">GenObjCXX/property-dot-copy-el<wbr class="">ision.mm?rev=328731&r1=328730&<wbr class="">r2=328731&view=diff</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/test/CodeGenObjCXX/<a href="http://property-dot-copy-elision.mm/" rel="noreferrer" target="_blank" class="">p<wbr class="">roperty-dot-copy-elision.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>(o<wbr class="">riginal)<br class="">+++ cfe/trunk/test/CodeGenObjCXX/<a href="http://property-dot-copy-elision.mm/" rel="noreferrer" target="_blank" class="">p<wbr class="">roperty-dot-copy-elision.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>We<wbr class="">d Mar 28 14:13:14 2018<br class="">@@ -1,11 +1,13 @@<br class=""> // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -std=c++1z -fobjc-arc -o - %s | FileCheck %s<br class=""><br class=""> struct S0 {<br class="">+  ~S0();<br class="">   id f;<br class=""> };<br class=""><br class=""> struct S1 {<br class="">   S1();<br class="">+  ~S1();<br class="">   S1(S0);<br class="">   id f;<br class=""> };<br class=""><br class="">Removed: cfe/trunk/test/CodeGenObjCXX/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">t<wbr class="">rivial_abi.mm</a><br class="">URL:<span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/trivial_abi.mm?rev=328730&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/ll<wbr class="">vm-project/cfe/trunk/test/Code<wbr class="">GenObjCXX/trivial_abi.mm?rev=3<wbr class="">28730&view=auto</a><br class="">==============================<wbr class="">==============================<wbr class="">==================<br class="">--- cfe/trunk/test/CodeGenObjCXX/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">t<wbr class="">rivial_abi.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>(original)<br class="">+++ cfe/trunk/test/CodeGenObjCXX/<a href="http://trivial_abi.mm/" rel="noreferrer" target="_blank" class="">t<wbr class="">rivial_abi.mm</a><span class="m_-6472094517105758356m_-7519891156417877842m_-3422063603182055068gmail-m_-8093432400557341289Apple-converted-space"> </span>(removed)<br class="">@@ -1,103 +0,0 @@<br class="">-// RUN: %clang_cc1 -triple arm64-apple-ios11 -std=c++11 -fobjc-arc  -fobjc-weak -fobjc-runtime-has-weak -emit-llvm -o - %s | FileCheck %s<br class="">-// RUN: %clang_cc1 -triple arm64-apple-ios11 -std=c++11 -fobjc-arc  -fobjc-weak -fobjc-runtime-has-weak -fclang-abi-compat=4.0 -emit-llvm -o - %s | FileCheck %s<br class="">-<br class="">-// CHECK: %[[STRUCT_STRONGWEAK:.*]] = type { i8*, i8* }<br class="">-// CHECK: %[[STRUCT_STRONG:.*]] = type { i8* }<br class="">-// CHECK: %[[STRUCT_S:.*]] = type { i8* }<br class="">-<br class="">-struct __attribute__((trivial_abi)) StrongWeak {<br class="">-  id fstrong;<br class="">-  __weak id fweak;<br class="">-};<br class="">-<br class="">-struct __attribute__((trivial_abi)) Strong {<br class="">-  id fstrong;<br class="">-};<br class="">-<br class="">-template<class T><br class="">-struct __attribute__((trivial_abi)) S {<br class="">-  T a;<br class="">-};<br class="">-<br class="">-// CHECK: define void @_Z19testParamStrongWeak10Stro<wbr class="">ngWeak(%[[STRUCT_STRONGWEAK]]* %{{.*}})<br class="">-// CHECK-NOT: call<br class="">-// CHECK: ret void<br class="">-<br class="">-void testParamStrongWeak(StrongWeak a) {<br class="">-}<br class="">-<br class="">-// CHECK: define void @_Z18testCallStrongWeakP10Stro<wbr class="">ngWeak(%[[STRUCT_STRONGWEAK]]* %[[A:.*]])<br class="">-// CHECK: %[[A_ADDR:.*]] = alloca %[[STRUCT_STRONGWEAK]]*, align 8<br class="">-// CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_STRONGWEAK]], align 8<br class="">-// CHECK: store %[[STRUCT_STRONGWEAK]]* %[[A]], %[[STRUCT_STRONGWEAK]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[V0:.*]] = load %[[STRUCT_STRONGWEAK]]*, %[[STRUCT_STRONGWEAK]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[CALL:.*]] = call %[[STRUCT_STRONGWEAK]]* @_ZN10StrongWeakC1ERKS_(%[[STR<wbr class="">UCT_STRONGWEAK]]* %[[AGG_TMP]], %[[STRUCT_STRONGWEAK]]* dereferenceable(16) %[[V0]])<br class="">-// CHECK: call void @_Z19testParamStrongWeak10Stro<wbr class="">ngWeak(%[[STRUCT_STRONGWEAK]]* %[[AGG_TMP]])<br class="">-// CHECK: %[[CALL1:.*]] = call %[[STRUCT_STRONGWEAK]]* @_ZN10StrongWeakD1Ev(%[[STRUCT<wbr class="">_STRONGWEAK]]* %[[AGG_TMP]])<br class="">-// CHECK: ret void<br class="">-<br class="">-void testCallStrongWeak(StrongWeak *a) {<br class="">-  testParamStrongWeak(*a);<br class="">-}<br class="">-<br class="">-// CHECK: define void @_Z20testReturnStrongWeakP10St<wbr class="">rongWeak(%[[STRUCT_STRONGWEAK:<wbr class="">.*]]* noalias sret %[[AGG_RESULT:.*]], %[[STRUCT_STRONGWEAK]]* %[[A:.*]])<br class="">-// CHECK: %[[A_ADDR:.*]] = alloca %[[STRUCT_STRONGWEAK]]*, align 8<br class="">-// CHECK: store %[[STRUCT_STRONGWEAK]]* %[[A]], %[[STRUCT_STRONGWEAK]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[V0:.*]] = load %[[STRUCT_STRONGWEAK]]*, %[[STRUCT_STRONGWEAK]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[CALL:.*]] = call %[[STRUCT_STRONGWEAK]]* @_ZN10StrongWeakC1ERKS_(%[[STR<wbr class="">UCT_STRONGWEAK]]* %[[AGG_RESULT]], %[[STRUCT_STRONGWEAK]]* dereferenceable(16) %[[V0]])<br class="">-// CHECK: ret void<br class="">-<br class="">-StrongWeak testReturnStrongWeak(StrongWea<wbr class="">k *a) {<br class="">-  return *a;<br class="">-}<br class="">-<br class="">-// CHECK: define void @_Z15testParamStrong6Strong(i6<wbr class="">4 %[[A_COERCE:.*]])<br class="">-// CHECK: %[[A:.*]] = alloca %[[STRUCT_STRONG]], align 8<br class="">-// CHECK: %[[COERCE_DIVE:.*]] = getelementptr inbounds %[[STRUCT_STRONG]], %[[STRUCT_STRONG]]* %[[A]], i32 0, i32 0<br class="">-// CHECK: %[[COERCE_VAL_IP:.*]] = inttoptr i64 %[[A_COERCE]] to i8*<br class="">-// CHECK: store i8* %[[COERCE_VAL_IP]], i8** %[[COERCE_DIVE]], align 8<br class="">-// CHECK: %[[CALL:.*]] = call %[[STRUCT_STRONG]]* @_ZN6StrongD1Ev(%[[STRUCT_STRO<wbr class="">NG]]* %[[A]])<br class="">-// CHECK: ret void<br class="">-<br class="">-// CHECK: define linkonce_odr %[[STRUCT_STRONG]]* @_ZN6StrongD1Ev(<br class="">-<br class="">-void testParamStrong(Strong a) {<br class="">-}<br class="">-<br class="">-// CHECK: define void @_Z14testCallStrongP6Strong(%[<wbr class="">[STRUCT_STRONG]]* %[[A:.*]])<br class="">-// CHECK: %[[A_ADDR:.*]] = alloca %[[STRUCT_STRONG]]*, align 8<br class="">-// CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_STRONG]], align 8<br class="">-// CHECK: store %[[STRUCT_STRONG]]* %[[A]], %[[STRUCT_STRONG]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[V0:.*]] = load %[[STRUCT_STRONG]]*, %[[STRUCT_STRONG]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[CALL:.*]] = call %[[STRUCT_STRONG]]* @_ZN6StrongC1ERKS_(%[[STRUCT_S<wbr class="">TRONG]]* %[[AGG_TMP]], %[[STRUCT_STRONG]]* dereferenceable(8) %[[V0]])<br class="">-// CHECK: %[[COERCE_DIVE:.*]] = getelementptr inbounds %[[STRUCT_STRONG]], %[[STRUCT_STRONG]]* %[[AGG_TMP]], i32 0, i32 0<br class="">-// CHECK: %[[V1:.*]] = load i8*, i8** %[[COERCE_DIVE]], align 8<br class="">-// CHECK: %[[COERCE_VAL_PI:.*]] = ptrtoint i8* %[[V1]] to i64<br class="">-// CHECK: call void @_Z15testParamStrong6Strong(i6<wbr class="">4 %[[COERCE_VAL_PI]])<br class="">-// CHECK: ret void<br class="">-<br class="">-void testCallStrong(Strong *a) {<br class="">-  testParamStrong(*a);<br class="">-}<br class="">-<br class="">-// CHECK: define i64 @_Z16testReturnStrongP6Strong(<wbr class="">%[[STRUCT_STRONG]]* %[[A:.*]])<br class="">-// CHECK: %[[RETVAL:.*]] = alloca %[[STRUCT_STRONG]], align 8<br class="">-// CHECK: %[[A_ADDR:.*]] = alloca %[[STRUCT_STRONG]]*, align 8<br class="">-// CHECK: store %[[STRUCT_STRONG]]* %[[A]], %[[STRUCT_STRONG]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[V0:.*]] = load %[[STRUCT_STRONG]]*, %[[STRUCT_STRONG]]** %[[A_ADDR]], align 8<br class="">-// CHECK: %[[CALL:.*]] = call %[[STRUCT_STRONG]]* @_ZN6StrongC1ERKS_(%[[STRUCT_S<wbr class="">TRONG]]* %[[RETVAL]], %[[STRUCT_STRONG]]* dereferenceable(8) %[[V0]])<br class="">-// CHECK: %[[COERCE_DIVE:.*]] = getelementptr inbounds %[[STRUCT_STRONG]], %[[STRUCT_STRONG]]* %[[RETVAL]], i32 0, i32 0<br class="">-// CHECK: %[[V1:.*]] = load i8*, i8** %[[COERCE_DIVE]], align 8<br class="">-// CHECK: %[[COERCE_VAL_PI:.*]] = ptrtoint i8* %[[V1]] to i64<br class="">-// CHECK: ret i64 %[[COERCE_VAL_PI]]<br class="">-<br class="">-Strong testReturnStrong(Strong *a) {<br class="">-  return *a;<br class="">-}<br class="">-<br class="">-// CHECK: define void @_Z21testParamWeakTemplate1SIU<wbr class="">6__weakP11objc_objectE(%[[STRU<wbr class="">CT_S]]* %{{.*}})<br class="">-// CHECK-NOT: call<br class="">-// CHECK: ret void<br class="">-<br class="">-void testParamWeakTemplate(S<__weak id> a) {<br class="">-}<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></blockquote></div></div></div></div></blockquote></div><br class=""></div></div></div></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><br class=""></div></div></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" 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></blockquote></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></blockquote></div></blockquote></div><br class=""></body></html>