[PATCH] [ms-cxxabi] Emit non-virtual member function pointers

Reid Kleckner rnk at google.com
Tue Apr 30 16:44:42 PDT 2013


  Thanks!  I'm curious if John has any thoughts on this, though.


================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:552
@@ +551,3 @@
+
+  // The rest of the fields are adjusted by conversions to a more derived class.
+  if (hasNonVirtualBaseAdjustmentField(IsMemberFunction, Inheritance))
----------------
João Matos wrote:
> Maybe we should leave a FIXME: with a link to the PR?
This code doesn't need to change, so I see no cause for a FIXME here.  We just need to implement ConvertMemberPointer().

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:604
@@ +603,3 @@
+MicrosoftCXXABI::EmitMemberPointer(const APValue &MP, QualType MPT) {
+  llvm_unreachable("const expr member pointer conversions not implemented in "
+                   "the MS ABI");
----------------
João Matos wrote:
> What exactly are "const expr member pointer conversions"?
This overload gets called to implement initializers like this:

struct A { int a; void foo(); };
struct B { int b; void bar(); };
struct C : A, B { };
void (C::*mp)() = &B::bar;

We have to do a compile-time conversion from 'void (B::*)()' to C, which means adjusting the non-virtual base offset.

If you look at the Itanium code, you can see how the conversions are implemented twice: once for Values and once for Constants.

We could probably avoid the duplication with a template, but I'm not sure it's worth it.

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:142
@@ -141,1 +141,3 @@
 
+  /// EmitFullMemberPointer - Emits a full member pointer with the fields common
+  /// data and function member pointers.
----------------
João Matos wrote:
> with the fields common *to*
Fixed


http://llvm-reviews.chandlerc.com/D699



More information about the cfe-commits mailing list