r223999 - MS ABI: Fix mangling of unsigned int template params

Will Wilson will at indefiant.com
Wed Dec 10 21:47:11 PST 2014


Author: lantictac
Date: Wed Dec 10 23:47:10 2014
New Revision: 223999

URL: http://llvm.org/viewvc/llvm-project?rev=223999&view=rev
Log:
MS ABI: Fix mangling of unsigned int template params

Modified:
    cfe/trunk/lib/AST/MicrosoftMangle.cpp
    cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=223999&r1=223998&r2=223999&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Dec 10 23:47:10 2014
@@ -1040,8 +1040,10 @@ void MicrosoftCXXNameMangler::mangleInte
   // Make sure booleans are encoded as 0/1.
   if (IsBoolean && Value.getBoolValue())
     mangleNumber(1);
-  else
+  else if (Value.isSigned())
     mangleNumber(Value.getSExtValue());
+  else
+    mangleNumber(Value.getZExtValue());
 }
 
 void MicrosoftCXXNameMangler::mangleExpression(const Expr *E) {

Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp?rev=223999&r1=223998&r2=223999&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms-templates.cpp Wed Dec 10 23:47:10 2014
@@ -24,6 +24,12 @@ class IntTemplate {
   IntTemplate() {}
 };
 
+template<unsigned param>
+class UnsignedIntTemplate {
+public:
+  UnsignedIntTemplate() {}
+};
+
 template<long long param>
 class LongLongTemplate {
  public:
@@ -133,6 +139,10 @@ void template_mangling() {
   IntTemplate<-11> neg_11;
 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QAE at XZ"
 // X64: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QEAA at XZ"
+  
+  UnsignedIntTemplate<4294967295> ffffffff;
+// CHECK: call {{.*}} @"\01??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QAE at XZ"
+// X64: call {{.*}} @"\01??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QEAA at XZ"
 
   LongLongTemplate<-9223372036854775807LL-1LL> int64_min;
 // CHECK: call {{.*}} @"\01??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QAE at XZ"





More information about the cfe-commits mailing list