r354633 - Use _Q as MS ABI mangling for char8_t.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 21 15:04:35 PST 2019


Author: rsmith
Date: Thu Feb 21 15:04:35 2019
New Revision: 354633

URL: http://llvm.org/viewvc/llvm-project?rev=354633&view=rev
Log:
Use _Q as MS ABI mangling for char8_t.

Thanks to Yuriy Solodkyy for letting us know the mangling here.

Modified:
    cfe/trunk/lib/AST/MicrosoftMangle.cpp
    cfe/trunk/test/CodeGenCXX/char8_t.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=354633&r1=354632&r2=354633&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu Feb 21 15:04:35 2019
@@ -1937,8 +1937,9 @@ void MicrosoftCXXNameMangler::mangleType
   //                 ::= _M # unsigned __int128
   //                 ::= _N # bool
   //                     _O # <array in parameter>
-  //                 ::= _T # __float80 (Intel)
+  //                 ::= _Q # char8_t
   //                 ::= _S # char16_t
+  //                 ::= _T # __float80 (Intel)
   //                 ::= _U # char32_t
   //                 ::= _W # wchar_t
   //                 ::= _Z # __float80 (Digital Mars)
@@ -1999,6 +2000,9 @@ void MicrosoftCXXNameMangler::mangleType
   case BuiltinType::Bool:
     Out << "_N";
     break;
+  case BuiltinType::Char8:
+    Out << "_Q";
+    break;
   case BuiltinType::Char16:
     Out << "_S";
     break;
@@ -2094,7 +2098,6 @@ void MicrosoftCXXNameMangler::mangleType
   case BuiltinType::SatUShortFract:
   case BuiltinType::SatUFract:
   case BuiltinType::SatULongFract:
-  case BuiltinType::Char8:
   case BuiltinType::Float128: {
     DiagnosticsEngine &Diags = Context.getDiags();
     unsigned DiagID = Diags.getCustomDiagID(

Modified: cfe/trunk/test/CodeGenCXX/char8_t.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/char8_t.cpp?rev=354633&r1=354632&r2=354633&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/char8_t.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/char8_t.cpp Thu Feb 21 15:04:35 2019
@@ -1,9 +1,11 @@
-// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-linux %s -o - | FileCheck %s
-// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-windows %s -o - -verify
+// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-linux %s -o - | FileCheck %s --check-prefix=ITANIUM
+// RUN: %clang_cc1 -std=c++17 -emit-llvm -fchar8_t -triple x86_64-windows %s -o - | FileCheck %s --check-prefix=MSABI
 
-// CHECK: define void @_Z1fDu(
-void f(char8_t c) {} // expected-error {{cannot mangle this built-in char8_t type yet}}
+// ITANIUM: define void @_Z1fDu(
+// MSABI: define {{.*}}void @"?f@@YAX_Q at Z"(
+void f(char8_t c) {}
 
-// CHECK: define weak_odr void @_Z1gIiEvDTplplcvT__ELA4_KDuELDu114EE
+// ITANIUM: define weak_odr void @_Z1gIiEvDTplplcvT__ELA4_KDuELDu114EE(
+// MSABI: define weak_odr {{.*}}void @"??$g at H@@YAXPEB_Q at Z"(
 template<typename T> void g(decltype(T() + u8"foo" + u8'r')) {}
 template void g<int>(const char8_t*);




More information about the cfe-commits mailing list