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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits