<div>
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neue'; color: #454545; min-height: 14.0px}
</style>
<p class="p1">Thanks.</p>
<p class="p1">If I remove some specific attributes, now I can think of the following method.First of all, let me talk about my method.</p>
<p class="p1">1.Define target platforms that do not support attributes.such as def TargetPower : TargetArch<["ppc", "ppc64", "ppc64le"]>;</p>
<p class="p1">2.Define TargetNotSupportedAttr class.such as class TargetNotSupportedAttr<TargetArch target> ;</p>
<p class="p1">3.Using this approach, we need to modify the cfe-4.0.1.src/utils/TableGen/ClangAttrEmitter.cpp file.Modifying the code in the GenerateHasAttrSpellingStringSwitch function looks like this:</p>
<p class="p1">if(Attr->isSubClassOf("TargetNotSupportedAttr")) { <span class="Apple-converted-space"> </span>// add<span class="Apple-converted-space"> </span></p>
<p class="p1">#define GenerateTargetNotSupportedAttrChecks GenerateTargetSpecificAttrChecks // add</p>
<p class="p1"><span class="Apple-converted-space"> </span>const Record *R = Attr->getValueAsDef("Target"); <span class="Apple-converted-space"> </span>// add</p>
<p class="p1"><span class="Apple-converted-space"> </span>std::vector<std::string> Arches = R->getValueAsListOfStrings("Arches"); // add</p>
<p class="p1"><span class="Apple-converted-space"> </span>GenerateTargetNotSupportedAttrChecks(R, Arches, Test, nullptr); <span class="Apple-converted-space"> </span>// add<span class="Apple-converted-space"> </span></p>
<p class="p1"><span class="Apple-converted-space"> </span>TestStr = !Test.empty() ? Test + " ? "<span class="Apple-converted-space"> </span>+ " 0 :" + llvm::itostr(Version) : "0"; // add<span class="Apple-converted-space"> </span></p>
<p class="p1"><span class="Apple-converted-space"> </span>} else if (Attr->isSubClassOf("TargetSpecificAttr"))</p>
<p class="p1">4.And for classes that inherit from TargetNotSupportedAttr<> class, we don’t need to generate the attribute class, so add the following code in EmitClangAttrClass</p>
<p class="p1">if (R->getName() != "TargetSpecificAttr" &&</p>
<p class="p1"><span class="Apple-converted-space"> </span>R->getName() != "TargetNotSupportedAttr” &&<span class="Apple-converted-space"> </span>//add</p>
<p class="p1"><span class="Apple-converted-space"> </span>SuperName.empty())</p>
<p class="p1"><span class="Apple-converted-space"> </span>SuperName = R->getName();</p>
<p class="p2"><br></p>
<p class="p1">If I use this method, is it correct?</p><br></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年4月29日(星期天) 凌晨3:07</div><div><b>收件人:</b> "朴素"<772847235@qq.com>; </div><div><b >抄送:</b> "cfe-commits"<cfe-commits@lists.llvm.org>; </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 Fri, Apr 27, 2018 at 11:23 PM, 朴素 via cfe-commits<br><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@<wbr>lists.llvm.o<wbr>rg</a>> 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><style type="text/css">.qmbox style, .qmbox script, .qmbox head, .qmbox link, .qmbox meta {display: none !important;}</style>