]> granicus.if.org Git - clang/commitdiff
MS ABI: Fix mangling of unsigned int template params
authorWill Wilson <will@indefiant.com>
Thu, 11 Dec 2014 05:47:10 +0000 (05:47 +0000)
committerWill Wilson <will@indefiant.com>
Thu, 11 Dec 2014 05:47:10 +0000 (05:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223999 91177308-0d34-0410-b5e6-96231b3b80d8

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

index bc7e87a66a5717245dbd1cac56108607291c7e35..ca7e5cedef56c7c28affd363e2e3db90483985fc 100644 (file)
@@ -1040,8 +1040,10 @@ void MicrosoftCXXNameMangler::mangleIntegerLiteral(const llvm::APSInt &Value,
   // 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) {
index 31fda2046c4bc39ecaadf1c6d788b9ceabf88078..46ab251af14f8373c74a41419c0c80f58d305452 100644 (file)
@@ -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@XZ"
 // X64: call {{.*}} @"\01??0?$IntTemplate@$0?L@@@QEAA@XZ"
+  
+  UnsignedIntTemplate<4294967295> ffffffff;
+// CHECK: call {{.*}} @"\01??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QAE@XZ"
+// X64: call {{.*}} @"\01??0?$UnsignedIntTemplate@$0PPPPPPPP@@@QEAA@XZ"
 
   LongLongTemplate<-9223372036854775807LL-1LL> int64_min;
 // CHECK: call {{.*}} @"\01??0?$LongLongTemplate@$0?IAAAAAAAAAAAAAAA@@@QAE@XZ"