[mingw] Don't mangle thiscall like fastcall etc
GCC does not mangle it when it is not explicit in the source. The
mangler as currently written cannot differentiate between explicit and
implicit calling conventions, so we can't match GCC. Explicit thiscall
conventions are rare, so mangle as if the convention was implicit to be
as ABI compatible as possible.
Also fixes some tests using %itanium_abi_triple in some configurations
as a side effect.
Fixes PR40107.
llvm-svn: 349872
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
index 8231ebe..98c843d 100644
--- a/clang/lib/AST/ItaniumMangle.cpp
+++ b/clang/lib/AST/ItaniumMangle.cpp
@@ -2662,12 +2662,18 @@
// FIXME: we should be mangling all of the above.
return "";
+ case CC_X86ThisCall:
+ // FIXME: To match mingw GCC, thiscall should only be mangled in when it is
+ // used explicitly. At this point, we don't have that much information in
+ // the AST, since clang tends to bake the convention into the canonical
+ // function type. thiscall only rarely used explicitly, so don't mangle it
+ // for now.
+ return "";
+
case CC_X86StdCall:
return "stdcall";
case CC_X86FastCall:
return "fastcall";
- case CC_X86ThisCall:
- return "thiscall";
case CC_X86_64SysV:
return "sysv_abi";
case CC_Win64: