aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2010-07-03 05:53:41 +0000
committerCharles Davis <cdavis@mines.edu>2010-07-03 05:53:41 +0000
commit1139da148e44193a71585f418be96ef9c5f6defa (patch)
treeba6e2119d41ff2d85ef2c98a3600a62e64ddeb56
parentd9d97265f9f34b20f174591d88a11a97502c9dbe (diff)
Fix mangling of function pointers in the Microsoft C++ Mangler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107564 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/MicrosoftCXXABI.cpp5
-rw-r--r--test/CodeGenCXX/mangle-ms.cpp3
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp
index a8fd0b0c2d..960b1fe77a 100644
--- a/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -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'.
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp
index 47dedfe27a..e2214100f1 100644
--- a/test/CodeGenCXX/mangle-ms.cpp
+++ b/test/CodeGenCXX/mangle-ms.cpp
@@ -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() {}