llvm-project/clang/lib/AST
Richard Smith 053f6c6c9e If a declaration is loaded, and then a module import adds a redeclaration, then
ensure that querying the first declaration for its most recent declaration
checks for redeclarations from the imported module.

This works as follows:
 * The 'most recent' pointer on a canonical declaration grows a pointer to the
   external AST source and a generation number (space- and time-optimized for
   the case where there is no external source).
 * Each time the 'most recent' pointer is queried, if it has an external source,
   we check whether it's up to date, and update it if not.
 * The ancillary data stored on the canonical declaration is allocated lazily
   to avoid filling it in for declarations that end up being non-canonical.
   We'll still perform a redundant (ASTContext) allocation if someone asks for
   the most recent declaration from a decl before setPreviousDecl is called,
   but such cases are probably all bugs, and are now easy to find.

Some finessing is still in order here -- in particular, we use a very general
mechanism for handling the DefinitionData pointer on CXXRecordData, and a more
targeted approach would be more compact.

Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was
addressing only a corner of the full problem space here. That's not covered
by this patch.

Early performance benchmarks show that this makes no measurable difference to 
Clang performance without modules enabled (and fixes a major correctness issue
with modules enabled). I'll revert if a full performance comparison shows any
problems.

llvm-svn: 209046
2014-05-16 23:01:30 +00:00
..
APValue.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +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 If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
ASTDiagnostic.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
ASTDumper.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
ASTImporter.cpp Rename SourceManager::createFileIDForMemBuffer() 2014-05-16 17:23:01 +00:00
ASTTypeTraits.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
AttrImpl.cpp Refactor the Microsoft inheritance attribute handling so that it no longer has special treatment. Also fixes a minor bug where the attributes were being parsed as though they were GNU-style attributes when they were in fact keyword attributes. 2013-12-18 23:44:18 +00:00
CMakeLists.txt [CMake] Use LINK_LIBS instead of target_link_libraries(). 2014-02-26 06:41:29 +00:00
CXXABI.h Drop AST's version of ARMCXXABI, it doesn't differ from the Itanium base 2014-05-13 11:20:16 +00:00
CXXInheritance.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
Comment.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
CommentBriefParser.cpp Some refactoring in my patch on document 2013-03-02 02:39:57 +00:00
CommentCommandTraits.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
CommentLexer.cpp CommentLexer: eliminate an NDEBUG from the headers 2013-12-07 13:51:26 +00:00
CommentParser.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
CommentSema.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
Decl.cpp If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
DeclBase.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
DeclCXX.cpp If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
DeclFriend.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +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 If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
DeclOpenMP.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
DeclPrinter.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
DeclTemplate.cpp If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
DeclarationName.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
Expr.cpp When an overloaded comparison operator returns a reference, do not consider 2014-05-14 23:22:10 +00:00
ExprCXX.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
ExprClassification.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
ExprConstant.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
ExternalASTSource.cpp If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
InheritViz.cpp [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. 2014-03-13 15:41:46 +00:00
ItaniumCXXABI.cpp Drop AST's version of ARMCXXABI, it doesn't differ from the Itanium base 2014-05-13 11:20:16 +00:00
ItaniumMangle.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
Makefile
Mangle.cpp [C++11] Replacing FunctionProtoType iterators param_type_begin() and param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. 2014-03-17 15:23:01 +00:00
MangleNumberingContext.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
MicrosoftCXXABI.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-11 06:22:39 +00:00
MicrosoftMangle.cpp MS ABI: Tighten RTTI mangling 2014-05-13 06:57:43 +00:00
NSAPI.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
NestedNameSpecifier.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
ParentMap.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
RawCommentList.cpp Comment parsing: when comment ranges are deserialized from multiple modules, 2014-03-27 15:40:39 +00:00
RecordLayout.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
RecordLayoutBuilder.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
SelectorLocationsKind.cpp
Stmt.cpp No longer triggering a checked iterator assert on Windows when using std::copy while deserializing attributed statements with more than one attribute. 2014-05-13 14:55:01 +00:00
StmtIterator.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
StmtPrinter.cpp Fix the AST printer for attributed statements so that it does not print duplicate attribute introducers. Eg) [[clang::fallthrough]] instead of [[[[clang::fallthrough]]]] 2014-05-13 16:12:14 +00:00
StmtProfile.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
StmtViz.cpp
TemplateBase.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
TemplateName.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
Type.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
TypeLoc.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
TypePrinter.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00
VTTBuilder.cpp [C++11] Replacing CXXRecordDecl iterators bases_begin() and bases_end() with iterator_range bases(). Updating all of the usages of the iterators with range-based for loops. 2014-03-13 15:41:46 +00:00
VTableBuilder.cpp [C++11] Use 'nullptr'. AST edition. 2014-05-12 05:36:57 +00:00