]> granicus.if.org Git - clang/commitdiff
MS-ABI: Implement user defined literals
authorDavid Majnemer <david.majnemer@gmail.com>
Wed, 4 Jun 2014 16:46:26 +0000 (16:46 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Wed, 4 Jun 2014 16:46:26 +0000 (16:46 +0000)
Straightforward implementation of UDLs, it's compatible with VS "14".

This nearly completes our implementation of C++ name mangling for the
MS-ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210197 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms-cxx11.cpp

index d064b157719d2f6f01e7be56b76a114d18da01dd..d444bf099637a8b66d9d13fa064eccebd1b12efc 100644 (file)
@@ -803,11 +803,8 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
       break;
 
     case DeclarationName::CXXLiteralOperatorName: {
-      // FIXME: Was this added in VS2010? Does MS even know how to mangle this?
-      DiagnosticsEngine &Diags = Context.getDiags();
-      unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
-        "cannot mangle this literal operator yet");
-      Diags.Report(ND->getLocation(), DiagID);
+      Out << "?__K";
+      mangleSourceName(Name.getCXXLiteralIdentifier()->getName());
       break;
     }
 
index c174e48c1dea837ecadec7dbac471ac0d968a0ef..0cd23f51223c94c7d81730bae118e3ae71cdf1b2 100644 (file)
@@ -130,3 +130,6 @@ void A::foo() __restrict & {}
 void A::foo() __restrict && {}
 // CHECK-DAG: @"\01?foo@A@PR19361@@QIHAEXXZ"
 }
+
+int operator"" _deg(long double) { return 0; }
+// CHECK-DAG: @"\01??__K_deg@@YAHO@Z"