<div>Thanks.</div><div><div><br></div><div><br></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "Aaron Ballman"<aaron@aaronballman.com>;</div><div><b>发送时间:</b> 2018年5月3日(星期四) 晚上7:40</div><div><b>收件人:</b> "朴素"<772847235@qq.com>;<wbr></div><div><b>抄送:</b> "cfe-commits"<cfe-commits@lists.llvm.org>; <wbr></div><div><b>主题:</b> Re: If I want to disable certain attributes, such as"swiftcall",isthere any way to do it now?</div></div><div><br></div>On Thu, May 3, 2018 at 1:25 AM, 朴素 <772847235@qq.com> wrote:<br>> hi, Aaron<br>><br>>   The reason why i not use of TargetSpecificAttr is as follows.If I plan to<br>> support a new platform, I don't want to let users use certain attributes<br>> because of hardware or simply not want to. Yes, we can use<br>> TargetSpecificAttr, but if we use TargetSpecificAttr that we need to include<br>> platforms other than unsupported platforms, but we just need to exclude that<br>> platform, using TargetSpecificAttr may not be a good idea.<br><br>Okay, that makes sense to me. Your design seems like a reasonable one.<br><br>~Aaron<br><br>><br>><br>><br>> ------------------ 原始邮件 ------------------<br>> 发件人: "Aaron Ballman"<aaron@aaronballman.com>;<br>> 发送时间: 2018年5月2日(星期三) 晚上10:05<br>> 收件人: "朴素"<772847235@qq.com>;<br>> 抄送: "cfe-commits"<cfe-commits@lists.llvm.org>;<br>> 主题: Re: If I want to disable certain attributes, such as "swiftcall",isthere<br>> any way to do it now?<br>><br>> On Wed, May 2, 2018 at 4:59 AM, 朴素 <772847235@qq.com> wrote:<br>>> Thanks.<br>>><br>>> If I remove some specific attributes, now I can think of the following<br>>> method.First of all, let me talk about my method.<br>>><br>>> 1.Define target platforms that do not support attributes.such as def<br>>> TargetPower : TargetArch<["ppc", "ppc64", "ppc64le"]>;<br>>><br>>> 2.Define TargetNotSupportedAttr class.such as class<br>>> TargetNotSupportedAttr<TargetArch target> ;<br>><br>> Why not make use of TargetSpecificAttr to mark the attributes that are<br>> specific to a target rather than marking the attributes not supported<br>> by a target?<br>><br>>> 3.Using this approach, we need to modify the<br>>> cfe-4.0.1.src/utils/TableGen/ClangAttrEmitter.cpp file.Modifying the code<br>>> in<br>>> the GenerateHasAttrSpellingStringSwitch function looks like this:<br>>><br>>> if(Attr->isSubClassOf("TargetNotSupportedAttr")) {   // add<br>>><br>>> #define GenerateTargetNotSupportedAttrChecks<br>>> GenerateTargetSpecificAttrChecks // add<br>>><br>>>         const Record *R = Attr->getValueAsDef("Target");   // add<br>>><br>>>         std::vector<std::string> Arches =<br>>> R->getValueAsListOfStrings("Arches"); // add<br>>><br>>>         GenerateTargetNotSupportedAttrChecks(R, Arches, Test, nullptr);<br>>> // add<br>>><br>>>         TestStr = !Test.empty() ? Test + " ? "  + " 0 :" +<br>>> llvm::itostr(Version) : "0"; // add<br>>><br>>>     } else if (Attr->isSubClassOf("TargetSpecificAttr"))<br>>><br>>> 4.And for classes that inherit from TargetNotSupportedAttr<> class, we<br>>> don’t<br>>> need to generate the attribute class, so add the following code in<br>>> EmitClangAttrClass<br>>><br>>> if (R->getName() != "TargetSpecificAttr" &&<br>>><br>>>               R->getName() != "TargetNotSupportedAttr” &&  //add<br>>><br>>>               SuperName.empty())<br>>><br>>>         SuperName = R->getName();<br>>><br>>><br>>> If I use this method, is it correct?<br>><br>> It seems like it would work, yes.<br>><br>> ~Aaron<br>><br>>><br>>><br>>><br>>><br>>> ------------------ 原始邮件 ------------------<br>>> 发件人: "Aaron Ballman"<aaron@aaronballman.com>;<br>>> 发送时间: 2018年4月29日(星期天) 凌晨3:07<br>>> 收件人: "朴素"<772847235@qq.com>;<br>>> 抄送: "cfe-commits"<cfe-commits@lists.llvm.org>;<br>>> 主题: Re: If I want to disable certain attributes, such as "swiftcall",<br>>> isthere any way to do it now?<br>>><br>>> On Fri, Apr 27, 2018 at 11:23 PM, 朴素 via cfe-commits<br>>> <cfe-commits@lists.llvm.org> wrote:<br>>>>    As the title says,thanks.<br>>><br>>> You could build a custom clang with specific attributes removed, but<br>>> there are no compiler flags that allow you to disable arbitrary<br>>> attributes like swiftcall.<br>>><br>>> ~Aaron<br></div>