]> granicus.if.org Git - clang/commitdiff
Fix mangling of integral template arguments between 1 and 10. Add a test case
authorCharles Davis <cdavis@mines.edu>
Mon, 28 May 2012 16:53:33 +0000 (16:53 +0000)
committerCharles Davis <cdavis@mines.edu>
Mon, 28 May 2012 16:53:33 +0000 (16:53 +0000)
for this. Reported by Timur Iskhodzhanov.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157583 91177308-0d34-0410-b5e6-96231b3b80d8

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

index feb1fa30833837ae07896fa05ced27c150a3c223..753b8174fb2ede96ca66e6889fda600def9dd9a2 100644 (file)
@@ -309,8 +309,8 @@ void MicrosoftCXXNameMangler::mangleNumber(const llvm::APSInt &Value) {
     return;
   }
   if (Value.uge(1) && Value.ule(10))
-    (Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()))).print(Out,
-                                                                                   false);
+    (Value-llvm::APSInt(llvm::APInt(Value.getBitWidth(), 1, Value.isSigned()),
+                        Value.isUnsigned())).print(Out, false);
   else {
     // We have to build up the encoding in reverse order, so it will come
     // out right when we write it out.
index b8138727a5acbb46fe5afa0131f16490d1269940..0a011b327e0ee6a95a5c04b79eb48eaf10f7c744 100644 (file)
@@ -38,6 +38,9 @@ void template_mangling() {
   BoolTemplate<true> _true;
 // CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE@XZ"
 
+  IntTemplate<5> five;
+// CHECK: call {{.*}} @"\01??0?$IntTemplate@$04@@QAE@XZ"
+
   IntTemplate<11> eleven;
 // CHECK: call {{.*}} @"\01??0?$IntTemplate@$0L@@@QAE@XZ"