[cfe-commits] r103842 - in /cfe/trunk: lib/CodeGen/TargetInfo.cpp test/CodeGenCXX/x86_32-arguments.cpp
Daniel Dunbar
daniel at zuster.org
Fri May 14 17:00:30 PDT 2010
Author: ddunbar
Date: Fri May 14 19:00:30 2010
New Revision: 103842
URL: http://llvm.org/viewvc/llvm-project?rev=103842&view=rev
Log:
C++/ABI/i386: Member function pointers should be passed by value.
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp
Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=103842&r1=103841&r2=103842&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri May 14 19:00:30 2010
@@ -387,10 +387,11 @@
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.
Modified: cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp?rev=103842&r1=103841&r2=103842&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/x86_32-arguments.cpp Fri May 14 19:00:30 2010
@@ -87,3 +87,12 @@
// 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; }
More information about the cfe-commits
mailing list