llvm-project/clang/lib/Frontend
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
..
ASTConsumers.cpp De-virtualize a method. It's called through template magic and doesn't override anything. 2014-03-13 07:14:47 +00:00
ASTMerge.cpp [C++11] Replacing DeclBase iterators decls_begin() and decls_end() with iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops. 2014-03-07 19:56:05 +00:00
ASTUnit.cpp Eliminate ASTContext's DelayInitialization flag 2014-05-03 03:46:04 +00:00
CMakeLists.txt Reapply r207477 and r207479 without cyclic dependency 2014-04-29 16:25:26 +00:00
CacheTokens.cpp Teach users of OnDiskHashTable to define hash_value and offset types 2014-04-18 20:27:24 +00:00
ChainedDiagnosticConsumer.cpp Remove spurious mode marker from .cpp file. 2012-10-29 06:05:01 +00:00
ChainedIncludesSource.cpp Replace OwningPtr with std::unique_ptr. 2014-03-07 20:03:18 +00:00
CompilerInstance.cpp Switch Wmodule-build to a remark 2014-05-08 22:36:02 +00:00
CompilerInvocation.cpp Make DiagnosticsEngine non-copyable 2014-05-11 22:10:52 +00:00
CreateInvocationFromCommandLine.cpp Eliminate DefaultImageName from the Driver constructor 2014-05-15 22:26:36 +00:00
DependencyFile.cpp [Modules] Emit the module file paths as dependencies of the PCH when we are building one. 2014-03-14 03:07:38 +00:00
DependencyGraph.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-13 06:07:04 +00:00
DiagnosticRenderer.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-13 06:07:04 +00:00
FrontendAction.cpp If a declaration is loaded, and then a module import adds a redeclaration, then 2014-05-16 23:01:30 +00:00
FrontendActions.cpp do not warn about unknown pragmas in modes that do not handle them (pr9537) 2014-05-01 12:54:03 +00:00
FrontendOptions.cpp Remove duplicated case. 2013-06-22 16:44:45 +00:00
HeaderIncludeGen.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-13 06:07:04 +00:00
InitHeaderSearch.cpp ARM64: initial clang support commit. 2014-03-29 15:09:45 +00:00
InitPreprocessor.cpp Revert "Move -fms-extensions predefined macros into InitPreprocessor" 2014-04-16 20:10:16 +00:00
LangStandards.cpp Remove unnecessary default cases in switches over enums. 2012-01-17 02:30:50 +00:00
LayoutOverrideSource.cpp Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h. 2013-02-08 22:30:41 +00:00
LogDiagnosticPrinter.cpp Add 'remark' diagnostic type in 'clang' 2014-02-28 09:11:08 +00:00
Makefile
MultiplexConsumer.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-13 06:07:04 +00:00
PrintPreprocessedOutput.cpp do not warn about unknown pragmas in modes that do not handle them (pr9537) 2014-05-01 12:54:03 +00:00
SerializedDiagnosticPrinter.cpp [C++11] Add 'override' keyword to virtual methods that override their base class. 2014-03-13 06:07:04 +00:00
TextDiagnostic.cpp The Visual Studio IDE changed behavior in VS2012. It used to be the case that 2014-03-07 00:23:36 +00:00
TextDiagnosticBuffer.cpp Support 'remark' in VerifyDiagnosticConsumer 2014-05-01 14:06:01 +00:00
TextDiagnosticPrinter.cpp Allow adding a value to a flag in diagnostics. 2014-04-21 23:16:03 +00:00
VerifyDiagnosticConsumer.cpp Support 'remark' in VerifyDiagnosticConsumer 2014-05-01 14:06:01 +00:00