llvm-project/clang/lib/Serialization
Ben Langmuir 487ea14a46 Add a "signature" to AST files to verify that they haven't changed
Since the order of the IDs in the AST file (e.g. DeclIDs, SelectorIDs)
is not stable, it is not safe to load an AST file that depends on
another AST file that has been rebuilt since the importer was built,
even if "nothing changed". We previously used size and modtime to check
this, but I've seen cases where a module rebuilt quickly enough to foil
this check and caused very hard to debug build errors.

To save cycles when we're loading the AST, we just generate a random
nonce value and check that it hasn't changed when we load an imported
module, rather than actually hash the whole file.

This is slightly complicated by the fact that we need to verify the
signature inside addModule, since we might otherwise consider that a
mdoule is "OutOfDate" when really it is the importer that is out of
date. I didn't see any regressions in module load time after this
change.

llvm-svn: 220493
2014-10-23 18:05:36 +00:00
..
ASTCommon.cpp [modules] Make NamespaceAliasDecl redeclarable, as it should be. This fixes 2014-09-03 23:11:22 +00:00
ASTCommon.h [modules] Number anonymous declarations that are lexically within mergeable 2014-08-28 01:33:39 +00:00
ASTReader.cpp Add a "signature" to AST files to verify that they haven't changed 2014-10-23 18:05:36 +00:00
ASTReaderDecl.cpp [modules] Initial support for explicitly loading .pcm files. 2014-10-22 02:05:46 +00:00
ASTReaderInternals.h Header guard canonicalization, clang part. 2014-08-13 16:25:19 +00:00
ASTReaderStmt.cpp Removing the setLBracLoc and setRBracLoc functions from CompoundStmt -- their only use was with the AST reader, and friendship can be used to handle that. Drive-by rename of "Brac" to "Brace" for the private data members. NFC. 2014-10-22 21:06:18 +00:00
ASTWriter.cpp Add a "signature" to AST files to verify that they haven't changed 2014-10-23 18:05:36 +00:00
ASTWriterDecl.cpp Change how we distinguish bitfield widths, in-class 2014-10-10 18:44:34 +00:00
ASTWriterStmt.cpp [OPENMP] Codegen for 'private' clause in 'parallel' directive. 2014-10-21 03:16:40 +00:00
CMakeLists.txt [CMake] Use LINK_LIBS instead of target_link_libraries(). 2014-02-26 06:41:29 +00:00
GeneratePCH.cpp [C++11] Use 'nullptr'. Serialization edition. 2014-05-22 05:54:18 +00:00
GlobalModuleIndex.cpp Add a "signature" to AST files to verify that they haven't changed 2014-10-23 18:05:36 +00:00
Makefile
Module.cpp Add a "signature" to AST files to verify that they haven't changed 2014-10-23 18:05:36 +00:00
ModuleManager.cpp Add a "signature" to AST files to verify that they haven't changed 2014-10-23 18:05:36 +00:00