[PATCH] [ms-cxxabi] Implement member pointer conversions

Reid Kleckner rnk at google.com
Fri May 3 15:24:00 PDT 2013


Hi rjmccall,

This only supports converting along non-virtual inheritance paths by
changing the field offset or the non-virtual base adjustment.

There are three kinds of conversions I had to implement:
- codegen for Value conversions
- Constant emission for APValue
- Constant folding for CastExprs

In almost all initialization settings EmitMemberPointer(APValue) is
called, except when the expression contains a reinterpret cast.

One major corner case is when a C-style cast fails to static_cast and so
it falls back to a reinterpret_cast.  MSVC seems to do both the
static_cast to change the class type and a reinterpret_cast (no-op) to
change the pointee type.  I chose not to implement that, since it's
consistent with what clang and gcc do (no conversion).

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

Files:
  lib/CodeGen/MicrosoftCXXABI.cpp
  test/CodeGenCXX/microsoft-abi-member-pointers.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D741.1.patch
Type: text/x-patch
Size: 26283 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130503/0c95ecff/attachment.bin>


More information about the cfe-commits mailing list