================
Comment at: lib/AST/MicrosoftMangle.cpp:891
@@ +890,3 @@
+ getASTContext().getCharWidth();
+ mangleIntegerLiteral(Offset, false);
+ } else
----------------
David Majnemer wrote:
> Reid Kleckner wrote:
> > There's a fair amount of complexity in member pointers.
> > - Can I mangle in a null data memptr here?
> > - The null representation is different between standard layout records (-1)
> > and other records (0).
> > - Can I mangle a field from a base class that is not at offset 0?
> >
> > All this is currently handled in CodeGen/MicrosoftCXXABI.cpp, which this
> > AST code can't depend on. We could raise some parts of it up into the AST
> > CXXABI if needed.
> - Yes.
> - null data memptr get's mangled like -1 for standard layout records and 0
> for other records.
> - Yes:
> ```
> struct base1 {
> int thing;
> virtual int fun();
> };
> struct base2 : virtual public base1 {
> int thing;
> virtual int fun2();
> };
> struct record : public base2, virtual public base1 {
> int first;
> int second;
> virtual int fun3();
> };
>
> template <int record::*>
> struct type2 {};
> type2<(int record::*)(&base2::thing)> memptr4;
> type2<(int record::*)(&base1::thing)> memptr5;
> ```
> get's mangled like so:
> ```
> struct type2<{8,0}> memptr4
> struct type2<{4,4}> memptr5
> ```
>
> Note that clang **refuses** to do anything with this C++ code.
Right, the refusal is covered by http://llvm.org/PR15713. I think clang can
currently dereference and copy member pointers for classes with virtual
inheritance, but it can't convert them across a virtual inheritance link.
These should work and will probably form similarly wide member pointers with a
vbtable offset of 0:
type2<&base2::first> memptr6;
type2<&base2::second> memptr7;
Anyway, I think this means we need the member pointer layout code in the AST
CXXABI, and then we can expose that back to CodeGen through ASTContext.
http://llvm-reviews.chandlerc.com/D1323
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits