Fix mangling of function pointers in the Microsoft C++ Mangler.

llvm-svn: 107564
This commit is contained in:
Charles Davis 2010-07-03 05:53:41 +00:00
parent bf6ffa3b89
commit 0029a2a957
2 changed files with 8 additions and 0 deletions

View File

@ -1015,6 +1015,11 @@ void MicrosoftCXXNameMangler::mangleType(const PointerType *T) {
if (PointeeTy->isArrayType()) {
// Pointers to arrays are mangled like arrays.
mangleExtraDimensions(T->getPointeeType());
} else if (PointeeTy->isFunctionType()) {
// Function pointers are special.
Out << '6';
mangleType(static_cast<const FunctionType *>(PointeeTy.getTypePtr()),
NULL, false, false);
} else {
if (!PointeeTy.hasQualifiers())
// Lack of qualifiers is mangled as 'A'.

View File

@ -9,6 +9,7 @@
// CHECK: @"\01?g@bar@@2HA"
// CHECK: @"\01?h@@3QAHA"
// CHECK: @"\01?i@@3PAY0BD@HA"
// CHECK: @"\01?j@@3P6GHCE@ZA"
int a;
@ -58,6 +59,8 @@ extern int * const h = &a;
int i[10][20];
int (__stdcall *j)(signed char, unsigned char);
// Static functions are mangled, too.
// Also make sure calling conventions, arglists, and throw specs work.
static void __stdcall alpha(float a, double b) throw() {}