[PATCH] D40929: Unblock Swift Calling Convention Mangling on Windows

Thomas Roughton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 16:01:42 PST 2017


troughton created this revision.
troughton added a project: clang.
Herald added a subscriber: cfe-commits.

Following discussion on the [[ https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20171204/006123.html | swift-dev mailing list] and on a pull request for swift-clang <https://github.com/apple/swift-clang/pull/142>, unblock support for the Swift calling convention on targets using Microsoft mangling by mangling the name as per the __cdecl calling convention.

Also in this PR, replace llvm_unreachable with an error diagnostic since this code path can be hit.


Repository:
  rC Clang

https://reviews.llvm.org/D40929

Files:
  lib/AST/MicrosoftMangle.cpp


Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -2130,10 +2130,12 @@
   // them.)

   switch (CC) {
-    default:
-      llvm_unreachable("Unsupported CC for mangling");
+      llvm::errs() << "Unsupported CC for mangling: " << CC << ".\n";
     case CC_Win64:
     case CC_X86_64SysV:
+    // NOTE: SwiftCC should have its own mangling specifier.
+    // For now, don't do anything special and treat SwiftCC like __cdecl.
+    case CC_Swift:
     case CC_C: Out << 'A'; break;
     case CC_X86Pascal: Out << 'C'; break;
     case CC_X86ThisCall: Out << 'E'; break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40929.125833.patch
Type: text/x-patch
Size: 688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171207/7200f823/attachment.bin>


More information about the cfe-commits mailing list