Commit Graph

16 Commits

Author SHA1 Message Date
Reid Kleckner d8110b6558 [ms-cxxabi] Implement guard variables for static initialization
Static locals requiring initialization are not thread safe on Windows.
Unfortunately, it's possible to create static locals that are actually
externally visible with inline functions and templates.  As a result, we
have to implement an initialization guard scheme that is compatible with
TUs built by MSVC, which makes thread safety prohibitively difficult.

MSVC's scheme is that every function that requires a guard gets an i32
bitfield.  Each static local is assigned a bit that indicates if it has
been initialized, up to 32 bits, at which point a new bitfield is
created.  MSVC rejects inline functions with more than 32 static locals,
and the externally visible mangling (?_B) only allows for one guard
variable per function.

On Eli's recommendation, I used MangleNumberingContext to track which
bit each static corresponds to.

Implements PR16888.

Reviewers: rjmccall, eli.friedman

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

llvm-svn: 190427
2013-09-10 20:14:30 +00:00
Reid Kleckner 2341ae3856 [ms-cxxabi] Implement member pointer emission and dereferencing
Summary:
Handles all inheritance models for both data and function member
pointers.

Also implements isZeroInitializable() and refactors some of the null
member pointer code.

MSVC supports converting member pointers through virtual bases, which
clang does not (yet?) support.  Implementing that extension is covered
by http://llvm.org/15713

Reviewers: rjmccall

CC: cfe-commits

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

llvm-svn: 179305
2013-04-11 18:13:19 +00:00
Benjamin Kramer 08db461ca7 Make helpers static & 80 cols.
llvm-svn: 178767
2013-04-04 17:07:04 +00:00
Reid Kleckner 08a39a686e [ms-cxxabi] Rename enum and remove dead case per Jordan's suggestion
The IHM_ prefix was a fairly gross abbreviation to try to hit three
characters for uniqueness.

llvm-svn: 178551
2013-04-02 17:40:19 +00:00
Reid Kleckner daa0f3176e [ms-cxxabi] Remove unused variable
llvm-svn: 178550
2013-04-02 17:24:20 +00:00
Reid Kleckner be377cd518 [ms-cxxabi] Move MS inheritance model calculation into MemberPointerType
Summary:
This makes it possible to share code between lib/AST/MicrosoftCXXABI.cpp
and lib/CodeGen/MicrosoftCXXABI.cpp.  No functionality change.

Also adds comments about the layout of the member pointer structs as I
currently understand them.

Reviewers: rjmccall

CC: timurrrr, cfe-commits

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

llvm-svn: 178548
2013-04-02 16:23:57 +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
Timur Iskhodzhanov c5098ad371 [Windows] Use thiscall as the default calling convention for class methods. PR12785
llvm-svn: 160121
2012-07-12 09:50:54 +00:00
Douglas Gregor e8bbc12152 Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).

llvm-svn: 138985
2011-09-02 00:18:52 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Ken Dyck 316d6f69bc Convert RecordLayout::NonVirtualSize from bit units to CharUnits.
llvm-svn: 124646
2011-02-01 01:52:10 +00:00
Anders Carlsson 60a6263ee8 Move isNearlyEmpty out into the ASTContext so it can be called from CodeGen as well.
llvm-svn: 120137
2010-11-25 01:51:53 +00:00
Charles Davis 31575f758c Add a hook to the CXXABI object to get the default method calling convention.
This isn't used yet, because someone more experienced than I needs to look
at the type system about gutting getCanonicalCallConv().

llvm-svn: 117638
2010-10-29 03:25:11 +00:00
Charles Davis 53c59df2f7 Implement support for member pointers under the Microsoft C++ ABI in the
AST library.

This also adds infrastructure for supporting multiple C++ ABIs in the AST.

llvm-svn: 111117
2010-08-16 03:33:14 +00:00