[cfe-commits] r107568 - in /cfe/trunk: lib/CodeGen/MicrosoftCXXABI.cpp test/CodeGenCXX/mangle-ms.cpp
Charles Davis
cdavis at mines.edu
Sat Jul 3 01:15:16 PDT 2010
Author: cdavis
Date: Sat Jul 3 03:15:16 2010
New Revision: 107568
URL: http://llvm.org/viewvc/llvm-project?rev=107568&view=rev
Log:
Fix mangling of array dimensions in the Microsoft C++ Mangler.
Modified:
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=107568&r1=107567&r2=107568&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Sat Jul 3 03:15:16 2010
@@ -289,8 +289,8 @@
Out << '?';
Number = -Number;
}
- if (Number <= 9) {
- Out << Number;
+ if (Number >= 1 && Number <= 10) {
+ Out << Number-1;
} else {
// We have to build up the encoding in reverse order, so it will come
// out right when we write it out.
@@ -935,8 +935,8 @@
break;
case TTK_Enum:
Out << 'W';
- mangleNumber(getASTContext().getTypeSizeInChars(
- cast<EnumDecl>(T->getDecl())->getIntegerType()).getQuantity());
+ Out << getASTContext().getTypeSizeInChars(
+ cast<EnumDecl>(T->getDecl())->getIntegerType()).getQuantity();
break;
}
mangleName(T->getDecl());
@@ -977,7 +977,7 @@
if (ElementTy->isConstantArrayType()) {
const ConstantArrayType *CAT =
static_cast<const ConstantArrayType *>(ElementTy.getTypePtr());
- Dimensions.push_back(CAT->getSize()-1);
+ Dimensions.push_back(CAT->getSize());
ElementTy = CAT->getElementType();
} else if (ElementTy->isVariableArrayType()) {
assert(false && "Don't know how to mangle VLAs!");
@@ -991,8 +991,8 @@
// If there are any additional dimensions, mangle them now.
if (Dimensions.size() > 0) {
Out << 'Y';
- // <dimension-count> ::= <number> # number of extra dimensions minus 1
- mangleNumber(Dimensions.size()-1);
+ // <dimension-count> ::= <number> # number of extra dimensions
+ mangleNumber(Dimensions.size());
for (unsigned Dim = 0; Dim < Dimensions.size(); ++Dim) {
mangleNumber(Dimensions[Dim].getLimitedValue());
}
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=107568&r1=107567&r2=107568&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Sat Jul 3 03:15:16 2010
@@ -8,7 +8,7 @@
// CHECK: @"\01?f at foo@@2DD"
// CHECK: @"\01?g at bar@@2HA"
// CHECK: @"\01?h@@3QAHA"
-// CHECK: @"\01?i@@3PAY0BD at HA"
+// CHECK: @"\01?i@@3PAY0BE at HA"
// CHECK: @"\01?j@@3P6GHCE at ZA"
// CHECK: @"\01?k@@3PTfoo@@DA"
// CHECK: @"\01?l@@3P8foo@@AAHH at ZA"
@@ -89,4 +89,4 @@
// Array mangling. (It should be mangled as a const pointer, but that needs
// to be fixed in Sema.)
void epsilon(int a[][10][20]) {}
-// CHECK: @"\01?epsilon@@YAXQAY19BD at H@Z"
+// CHECK: @"\01?epsilon@@YAXQAY19BE at H@Z"
More information about the cfe-commits
mailing list