MS ABI: Fix mangling of unsigned int template params

llvm-svn: 223999
This commit is contained in:
Will Wilson 2014-12-11 05:47:10 +00:00
parent c3504c4874
commit e74c28105d
2 changed files with 13 additions and 1 deletions

View 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) {

View 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"