[PATCH] D64780: Disallow most calling convention attributes on PS4.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 16 13:24:30 PDT 2019


rnk added a comment.

Some suggestions, you don't have to take all of them.



================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2961
+def error_cconv_unsupported : Error<
+  "%0 calling convention not supported %select{"
+  // Use CallingConventionIgnoredReason Enum to specify these.
----------------
This duplication merely to say "not supported" instead of "ignored" seems unfortunate. We could reasonable change "ignored" to "unsupported" and then you could use the warn_cconv_ignored.Text accessor to share the text.


================
Comment at: include/clang/Basic/TargetInfo.h:1271
     CCCR_Ignore,
+    CCCR_Error,
   };
----------------
I feel like perhaps a cleaner way of implementing this would be to have the driver pass down -Werror=unknown-calling-conv (sp) on PS4. That would also allow users to tell clang to ignore their CC annotations by disabling the warning, which could be useful when porting a codebase widely annotated with __stdcall, for example.


================
Comment at: lib/Basic/Targets/X86.h:646-647
   CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+    if (getTriple().isPS4()) 
+       return (CC == CC_C) ? CCCR_OK : CCCR_Error;
     switch (CC) {
----------------
For better separation of concerns, I would suggest putting this in PS4OSTargetInfo::checkCallingConvention, so that the main x64 code doesn't have to consider that OS-specific concern.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64780/new/

https://reviews.llvm.org/D64780





More information about the cfe-commits mailing list