hanchenye-llvm-project/clang/lib/AST
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
..
APValue.cpp Pacify compilers that think you can drop off a fully covered switch. 2013-06-03 21:26:13 +00:00
ASTConsumer.cpp Sort all of Clang's files under 'lib', and fix up the broken headers 2012-12-04 09:13:33 +00:00
ASTContext.cpp [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
ASTDiagnostic.cpp If a default argument is a dependent type, get the real type from the desugared 2013-07-20 03:49:02 +00:00
ASTDumper.cpp ASTDumper: fix dump of CXXCatchStmt 2013-09-04 14:35:00 +00:00
ASTImporter.cpp Revert "Implement a rudimentary form of generic lambdas." 2013-08-22 12:12:24 +00:00
ASTTypeTraits.cpp Add more types to ASTNodeKind. Refactor common instantiation code. 2013-07-16 15:47:24 +00:00
AttrImpl.cpp [ms-cxxabi] Give the MS inheritance attributes a base class 2013-03-26 18:30:28 +00:00
CMakeLists.txt Fix CMakeLists.txt. 2013-07-01 20:34:51 +00:00
CXXABI.h [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
CXXInheritance.cpp Use pop_back_val() instead of both back() and pop_back(). 2013-08-23 16:11:15 +00:00
Comment.cpp Use CharInfo.h routines in TextComment::isWhitespaceNoCache 2013-08-23 17:45:43 +00:00
CommentBriefParser.cpp Some refactoring in my patch on document 2013-03-02 02:39:57 +00:00
CommentCommandTraits.cpp Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]). 2013-07-15 03:38:40 +00:00
CommentLexer.cpp Fix indentation 2013-08-23 17:48:41 +00:00
CommentParser.cpp Comment parsing: fix a bug where a line with whitespace between two paragraphs 2013-08-23 18:03:40 +00:00
CommentSema.cpp Use pop_back_val() instead of both back() and pop_back(). 2013-08-23 16:11:15 +00:00
Decl.cpp Fix name lookup with dependent using decls. 2013-08-20 00:39:40 +00:00
DeclBase.cpp C++ modules: fix a bug where loading a declaration with some name would prevent 2013-09-09 07:34:56 +00:00
DeclCXX.cpp Mark lambda closure classes as being implicitly-generated. 2013-09-05 17:46:21 +00:00
DeclFriend.cpp Lazily deserialize the "first' friend declaration when deserializing a class 2013-06-26 02:41:25 +00:00
DeclGroup.cpp Sort all of Clang's files under 'lib', and fix up the broken headers 2012-12-04 09:13:33 +00:00
DeclObjC.cpp ObjC migrator: Improve on hueristics. 2013-07-10 21:30:22 +00:00
DeclOpenMP.cpp OpenMP: basic support for #pragma omp parallel 2013-07-19 03:13:43 +00:00
DeclPrinter.cpp Fix pretty-printing for unnamed unions. 2013-08-12 21:54:04 +00:00
DeclTemplate.cpp A clean-up pass, exploring the unification of traversals of class, variable and function templates. 2013-08-23 22:21:36 +00:00
DeclarationName.cpp Provide operator<< for stream output of DeclarationNames 2013-05-14 21:04:00 +00:00
DumpXML.cpp Add ms_abi and sysv_abi attribute handling. 2013-08-30 04:39:01 +00:00
Expr.cpp Handle predefined expression for a captured statement 2013-08-26 14:27:34 +00:00
ExprCXX.cpp Correct typo. 2013-09-07 20:21:47 +00:00
ExprClassification.cpp Make IgnoreParens() look through ChooseExprs. 2013-07-20 00:40:58 +00:00
ExprConstant.cpp Adjust clang for change to APFloat::toString. 2013-08-29 23:44:43 +00:00
ExternalASTSource.cpp Simplify FindExternalVisibleDeclsByName by making it return a bool indicating 2013-02-07 03:30:24 +00:00
InheritViz.cpp Use llvm::sys::fs::createTemporaryFile. 2013-07-05 20:00:06 +00:00
ItaniumCXXABI.cpp [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
ItaniumMangle.cpp [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
Makefile
Mangle.cpp Get rid of dead/useless code for block mangling. 2013-07-10 01:13:27 +00:00
MangleNumberingContext.cpp [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
MicrosoftCXXABI.cpp [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
MicrosoftMangle.cpp [ms-cxxabi] Implement guard variables for static initialization 2013-09-10 20:14:30 +00:00
NSAPI.cpp Use None rather than Optional<T>() where possible. 2013-02-21 01:47:18 +00:00
NestedNameSpecifier.cpp Use pop_back_val() instead of both back() and pop_back(). 2013-08-23 16:11:15 +00:00
ParentMap.cpp [analyzer; new edges] Simplify edges in a C++11 for-range loop. 2013-06-06 21:53:45 +00:00
RawCommentList.cpp [Doc parsing] Provide diagnostics for unknown documentation 2013-05-03 23:15:20 +00:00
RecordLayout.cpp First pass at abstracting out a class for the target C++ ABI. 2013-01-25 22:30:49 +00:00
RecordLayoutBuilder.cpp Be lazier when loading KeyFunctions from PCH/modules. We don't need to load 2013-08-29 23:59:27 +00:00
SelectorLocationsKind.cpp
Stmt.cpp OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test threadprivate_messages.cpp) 2013-09-06 18:03:48 +00:00
StmtIterator.cpp Simplify StmtIterator. 2013-06-27 20:39:04 +00:00
StmtPrinter.cpp OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test threadprivate_messages.cpp) 2013-09-06 18:03:48 +00:00
StmtProfile.cpp OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test threadprivate_messages.cpp) 2013-09-06 18:03:48 +00:00
StmtViz.cpp
TemplateBase.cpp Reduce sizeof(TemplateArgument) from 32 to 24. 2013-08-21 23:05:56 +00:00
TemplateName.cpp Add quotation marks to template names in diagnostics. 2013-03-05 06:21:38 +00:00
Type.cpp PR17103: Scoped enumerations with signed integer types have signed integer 2013-09-04 23:34:21 +00:00
TypeLoc.cpp AST: Don't treat a TemplateExpansion as a Template 2013-08-28 00:00:27 +00:00
TypePrinter.cpp Mark that qualifiers can prefix the auto type. This seems to just have 2013-09-02 19:20:06 +00:00
VTTBuilder.cpp
VTableBuilder.cpp Abstract out virtual calls and virtual function prologue code generation; implement them for -cxx-abi microsoft 2013-08-21 06:25:03 +00:00