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.

llvm-svn: 210197

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

index d064b15..d444bf0 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 c174e48..0cd23f5 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"