[PATCH] Emit diagnostic on illegal calling convention

Alexander Zinenko ftynse at gmail.com
Fri Mar 22 16:22:37 PDT 2013


Hi John, João!

This patch adds a diagnostic if the following declarations have illegal
calling conventions:
* pointer to function, reference to function, pointer to member function
variable (or function attribute) declaration;
* function declaration;
* typedef declaration.

It was proposed in PR13457 discussion (
http://llvm.org/bugs/show_bug.cgi?id=13457#c22).

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.

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.

Please review!

--
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130323/b38b75cf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: callconv.patch
Type: application/octet-stream
Size: 15872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130323/b38b75cf/attachment.obj>


More information about the cfe-commits mailing list