diff options
| author | Charles Davis <cdavis@mines.edu> | 2010-07-03 05:53:41 +0000 |
|---|---|---|
| committer | Charles Davis <cdavis@mines.edu> | 2010-07-03 05:53:41 +0000 |
| commit | 0029a2a9579c4222c8feea85c2e4d5047297438e (patch) | |
| tree | 63374f2c44f7234feccfe3375291a54694593dfa | |
| parent | bf6ffa3b894c99c169432b759e50ce91bd746e6f (diff) | |
| download | bcm5719-llvm-0029a2a9579c4222c8feea85c2e4d5047297438e.tar.gz bcm5719-llvm-0029a2a9579c4222c8feea85c2e4d5047297438e.zip | |
Fix mangling of function pointers in the Microsoft C++ Mangler.
llvm-svn: 107564
| -rw-r--r-- | clang/lib/CodeGen/MicrosoftCXXABI.cpp | 5 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/mangle-ms.cpp | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp index a8fd0b0c2dd..960b1fe77a0 100644 --- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp +++ b/clang/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/clang/test/CodeGenCXX/mangle-ms.cpp b/clang/test/CodeGenCXX/mangle-ms.cpp index 47dedfe27a4..e2214100f17 100644 --- a/clang/test/CodeGenCXX/mangle-ms.cpp +++ b/clang/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() {} |

