Commit Graph

14 Commits

Author SHA1 Message Date
David Majnemer b3e5654923 MS ABI: Handle member function pointers returning a member data pointer
MSVC doesn't decide what the inheritance model for a returned member
pointer *until* a call expression returns it.

This fixes PR20017.

llvm-svn: 215164
2014-08-07 22:56:13 +00:00
David Majnemer 86c318f496 MS ABI: Add support for the -vm{b,g,s,m,v} flags
These flags control the inheritance model initially used by the
translation unit.

Differential Revision: http://llvm-reviews.chandlerc.com/D2741

llvm-svn: 201175
2014-02-11 21:05:00 +00:00
David Majnemer 4bb0980d96 MS ABI: Add support for #pragma pointers_to_members
Introduce a notion of a 'current representation method' for
pointers-to-members.

When starting out, this is set to 'best case' (representation method is
chosen by examining the class, selecting the smallest representation
that would work given the class definition or lack thereof).

This pragma allows the translation unit to dictate exactly what
representation to use, similar to how the inheritance model keywords
operate.

N.B.  PCH support is forthcoming.

Differential Revision: http://llvm-reviews.chandlerc.com/D2723

llvm-svn: 201105
2014-02-10 19:50:15 +00:00
David Majnemer 98c9ee2068 MS ABI: Don't be so hasty to judge an inheritance model
If we are in the middle of defining the class, don't attempt to
validate previously annotated declarations.  We may not have seen base
specifiers or virtual method declarations yet.

llvm-svn: 200959
2014-02-07 00:43:07 +00:00
Reid Kleckner bd63b33854 [ms-cxxabi] Raise aggregate memptr alignment to 8 for x86_32
With this change, we give different results for __alignof than MSVC, but
our record layout is compatible.

Some data member pointers also now have a size that is not a multiple of
their alignment.

Fixes PR18618.

Reviewers: majnemer

Differential Revision: http://llvm-reviews.chandlerc.com/D2669

llvm-svn: 200585
2014-01-31 22:28:50 +00:00
David Majnemer 2c4e00ac1c Sema: Diagnose improper application of inheritance keywords
We would previously allow inappropriate inheritance keywords to appear
on class declarations.  We would also allow inheritance keywords on
templates which were not fully specialized; this was divergent from
MSVC.

Differential Revision: http://llvm-reviews.chandlerc.com/D2585

llvm-svn: 200423
2014-01-29 22:07:36 +00:00
Hans Wennborg c9bd88e681 Remove the -cxx-abi command-line flag.
This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples,
Itanium otherwise. It's no longer possible to do weird combinations.

To be able to run a test with a specific ABI without constraining it to a
specific triple, new substitutions are added to lit: %itanium_abi_triple and
%ms_abi_triple can be used to get the current target triple adjusted to the
desired ABI. For example, if the test suite is running with the i686-pc-win32
target, %itanium_abi_triple will expand to i686-pc-mingw32.

Differential Revision: http://llvm-reviews.chandlerc.com/D2545

llvm-svn: 199250
2014-01-14 19:35:09 +00:00
Eli Friedman 61a511ff5b Add a few more tests for casts.
llvm-svn: 184392
2013-06-20 01:35:13 +00:00
Reid Kleckner 557a035229 [ms-cxxabi] Add more tests for r178297
This covers a few cases where the class of a member pointer is not a
CXXRecordDecl.

llvm-svn: 178307
2013-03-28 23:11:29 +00:00
Reid Kleckner 3a52abf553 [ms-cxxabi] Correctly compute the size of member pointers
Summary:
This also relaxes the requirement on Windows that the member pointer
class type be a complete type (http://llvm.org/PR12070).  We still ask
for a complete type to instantiate any templates (MSVC does this), but
if that fails we continue as normal, relying on any inheritance
attributes on the declaration.

Reviewers: rjmccall

CC: triton, timurrrr, cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D568

llvm-svn: 178283
2013-03-28 20:02:56 +00:00
Joao Matos e30771fdbd Revert r163078 per chandlerc's request.
llvm-svn: 163145
2012-09-04 17:18:12 +00:00
Joao Matos 26b2095401 Added a diagnostic for mismatched MS inheritance attributes. Also fixed the incomplete type member pointer size calculation under the MS ABI.
llvm-svn: 163078
2012-09-02 00:13:48 +00:00
Charles Davis ebab1ed5d3 Error out if reinterpret_casting between member pointers of two different
sizes.

llvm-svn: 111119
2010-08-16 05:30:44 +00:00
Charles Davis 2d3694297d Err on incomplete class types in member pointers when compiling for the
Microsoft C++ ABI, for now.

llvm-svn: 111118
2010-08-16 04:01:50 +00:00