Fix mangling of integral template arguments between 1 and 10. Add a test case

for this. Reported by Timur Iskhodzhanov.

llvm-svn: 157583
This commit is contained in:
Charles Davis 2012-05-28 16:53:33 +00:00
parent 0efd915d92
commit 6770dea704
2 changed files with 5 additions and 2 deletions

View File

@ -309,8 +309,8 @@ void MicrosoftCXXNameMangler::mangleNumber(const llvm::APSInt &Value) {
return; return;
} }
if (Value.uge(1) && Value.ule(10)) if (Value.uge(1) && Value.ule(10))
(Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()))).print(Out, (Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()),
false); Value.isUnsigned())).print(Out, false);
else { else {
// We have to build up the encoding in reverse order, so it will come // We have to build up the encoding in reverse order, so it will come
// out right when we write it out. // out right when we write it out.

View File

@ -38,6 +38,9 @@ void template_mangling() {
BoolTemplate<true> _true; BoolTemplate<true> _true;
// CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE@XZ" // CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE@XZ"
IntTemplate<5> five;
// CHECK: call {{.*}} @"\01??0?$IntTemplate@$04@@QAE@XZ"
IntTemplate<11> eleven; IntTemplate<11> eleven;
// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0L@@@QAE@XZ" // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0L@@@QAE@XZ"