]> granicus.if.org Git - clang/commitdiff
C++/ABI/i386: Member function pointers should be passed by value.
authorDaniel Dunbar <daniel@zuster.org>
Sat, 15 May 2010 00:00:30 +0000 (00:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 15 May 2010 00:00:30 +0000 (00:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103842 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetInfo.cpp
test/CodeGenCXX/x86_32-arguments.cpp

index 09baf2e83396512c5357aa86f6279a5fba512758..176a7432b0c28371ad54b52c17f4f9f627acecff 100644 (file)
@@ -387,10 +387,11 @@ bool X86_32ABIInfo::shouldReturnTypeInRegister(QualType Ty,
     return true;
   }
 
-  // If this is a builtin, pointer, enum, or complex type, it is ok.
+  // If this is a builtin, pointer, enum, complex type, member pointer, or
+  // member function pointer it is ok.
   if (Ty->getAs<BuiltinType>() || Ty->hasPointerRepresentation() ||
       Ty->isAnyComplexType() || Ty->isEnumeralType() ||
-      Ty->isBlockPointerType())
+      Ty->isBlockPointerType() || Ty->isMemberPointerType())
     return true;
 
   // Arrays are treated like records.
index a92ba78b9f6d5156a9dc9090cd2a4bfecaa91e2a..033779d02812559575183b246ea128cbbd95e41c 100644 (file)
@@ -87,3 +87,12 @@ s4_2 f4() { return s4_2(); }
 // CHECK: define i32 @_Z2f5v()
 struct s5 { s5(); int &x; };
 s5 f5() { return s5(); }
+
+// CHECK: define i32 @_Z4f6_0M2s6i(i32 %a)
+// CHECK: define i64 @_Z4f6_1M2s6FivE(%{{.*}} byval %a)
+// FIXME: It would be nice to avoid byval on the previous case.
+struct s6 {};
+typedef int s6::* s6_mdp;
+typedef int (s6::*s6_mfp)();
+s6_mdp f6_0(s6_mdp a) { return a; }
+s6_mfp f6_1(s6_mfp a) { return a; }