From: Will Wilson Date: Thu, 11 Dec 2014 05:47:10 +0000 (+0000) Subject: MS ABI: Fix mangling of unsigned int template params X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1942cb3102eb8846269a866e59f7e6f7b1114915;p=clang MS ABI: Fix mangling of unsigned int template params git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@223999 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index bc7e87a66a..ca7e5cedef 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -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) { diff --git a/test/CodeGenCXX/mangle-ms-templates.cpp b/test/CodeGenCXX/mangle-ms-templates.cpp index 31fda2046c..46ab251af1 100644 --- a/test/CodeGenCXX/mangle-ms-templates.cpp +++ b/test/CodeGenCXX/mangle-ms-templates.cpp @@ -24,6 +24,12 @@ class IntTemplate { IntTemplate() {} }; +template +class UnsignedIntTemplate { +public: + UnsignedIntTemplate() {} +}; + template 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"