<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 28, 2013, at 10:57 AM, Alexander Zinenko <<a href="mailto:ftynse@gmail.com">ftynse@gmail.com</a>> wrote:</div><blockquote type="cite"><div class="gmail_extra"><div class="gmail_quote">On 23 March 2013 01:22, Alexander Zinenko <span dir="ltr"><<a href="mailto:ftynse@gmail.com" target="_blank">ftynse@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi John, Joćo!</div><div><br></div><div>This patch adds a diagnostic if the following declarations have illegal calling conventions:</div>
<div>* pointer to function, reference to function, pointer to member function variable (or function attribute) declaration;</div>
<div>* function declaration;</div><div>* typedef declaration.</div><div><br></div><div>It was proposed in PR13457 discussion (<a href="http://llvm.org/bugs/show_bug.cgi?id=13457#c22" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=13457#c22</a>).</div>
<div><br></div>We already have such error for variadic functions declared with CC_X86Fastcall that is emitted from SemaType. But microsoft ABI has different allowed CCs depending on whether it is a member function and it can't be determined given FunctionType only (AFAIK, standard doesn't differentiate between free function and member function types). So this checking has to be done on declarations.<div>
<br></div><div>With this patch, allowed calling conventions are ABI-specific. Therefore if we teach affected ABIs to disallow fastcall on variadic functions, we can remove the previous diagnostic.</div><div><br>
</div><div>Please review!</div><div><br></div><div>--</div><div>Alex</div></div>
</blockquote></div><br></div>
<span><callconv.patch></span></blockquote></div><br><div>I would only pass a flag distinguishing non-static member functions vs. everything else.</div><div><br></div><div><div>+ if (T->isFunctionProtoType())</div><div>+ ProtoType = T->getAs<FunctionProtoType>();</div><div>+ else if (T->isFunctionPointerType())</div><div>+ ProtoType = T->getPointeeType()->getAs<FunctionProtoType>();</div><div>+ else if (T->isReferenceType()) {</div><div>+ QualType RefType = T->getAs<ReferenceType>()->getPointeeType();</div><div>+ ProtoType = RefType->getAs<FunctionProtoType>();</div><div>+ } else if (T->isMemberFunctionPointerType()) {</div><div>+ QualType PointerType = T->getAs<MemberPointerType>()->getPointeeType();</div></div><div><br></div><div>Test the result of getAs<>, please.</div><div><br></div><div>John.</div></body></html>