[PATCH] Tighten diagnostics for calling conventions on variadic functions

Hans Wennborg hans at chromium.org
Wed Oct 9 11:13:44 PDT 2013



================
Comment at: lib/Sema/SemaType.cpp:4546
@@ +4545,3 @@
+  // Diagnose use of X86 stdcall/fastcall/thiscall on variadic functions.
+  if (CC == CC_X86StdCall || CC == CC_X86FastCall || CC == CC_X86ThisCall) {
+    const FunctionProtoType *FnP = dyn_cast<FunctionProtoType>(fn);
----------------
Reid Kleckner wrote:
> This should be a helper like callingConventionIsCalleeCleanup() in clang/Basic/Specifiers.h, and then this whole diagnostic makes a lot more sense.
SGTM.

I've also changed the code use a whitelist for which CCs we allow with a warning, rather than just blacklisting thiscall.


http://llvm-reviews.chandlerc.com/D1870



More information about the cfe-commits mailing list