[cfe-commits] r107564 - in /cfe/trunk: lib/CodeGen/MicrosoftCXXABI.cpp test/CodeGenCXX/mangle-ms.cpp

Charles Davis cdavis at mines.edu
Fri Jul 2 22:53:41 PDT 2010


Author: cdavis
Date: Sat Jul  3 00:53:41 2010
New Revision: 107564

URL: http://llvm.org/viewvc/llvm-project?rev=107564&view=rev
Log:
Fix mangling of function pointers 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=107564&r1=107563&r2=107564&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Sat Jul  3 00:53:41 2010
@@ -1015,6 +1015,11 @@
   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'.

Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=107564&r1=107563&r2=107564&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Sat Jul  3 00:53:41 2010
@@ -9,6 +9,7 @@
 // CHECK: @"\01?g at bar@@2HA"
 // CHECK: @"\01?h@@3QAHA"
 // CHECK: @"\01?i@@3PAY0BD at HA"
+// CHECK: @"\01?j@@3P6GHCE at ZA"
 
 int a;
 
@@ -58,6 +59,8 @@
 
 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() {}





More information about the cfe-commits mailing list