llvm-project/clang/lib/Serialization
Argyrios Kyrtzidis 7d23857a07 [PCH] When pre-validating the headers from the PCH, only validate non-system headers.
Stat'ing all the headers from the PCH to make sure they are up-to-date takes significant time.
In a particular source file (whose PCH file included Cocoa.h) from total -fsyntax-only time
12% was just stat calls. Change pre-validation to only check non-system headers.

There are some notable disadvantages:

-If a system header, that is not include-guarded, changes after the PCH was created, we will not
find it in the header info table and we will #import it, effectively #importing it twice, thus
we will emit some error due to a multiple definition and after that the "header was modified" error will likely
be emitted, for example something like:

NSDictionary.h:12:1: error: duplicate interface definition for class 'NSDictionary'
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
^
NSDictionary.h:12:12: note: previous definition is here
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
           ^
fatal error: file 'NSDictionary.h' has been modified since the precompiled header was built

Though we get the "header was modified" error, this is a bit confusing.

-Theoretically it is possible that such a system header will cause no errors but it will just cause an
unfortunate semantic change, though I find this rather unlikely.

The advantages:

-Reduces compilation time when using a huge PCH like the Cocoa ones
-System headers change very infrequent and when they do, users/build systems should be able to know that
re-building from scratch is needed.

Addresses rdar://13056262

llvm-svn: 176567
2013-03-06 18:12:50 +00:00
..
ASTCommon.cpp [Sema] Semantic analysis for empty-declaration and attribute-declaration. 2013-02-22 17:15:32 +00:00
ASTCommon.h Make getDefinitiveDeclContext() actually return a DeclContext, as one 2013-01-22 17:08:30 +00:00
ASTReader.cpp [PCH] When pre-validating the headers from the PCH, only validate non-system headers. 2013-03-06 18:12:50 +00:00
ASTReaderDecl.cpp [Sema] Semantic analysis for empty-declaration and attribute-declaration. 2013-02-22 17:15:32 +00:00
ASTReaderInternals.h [PCH] For HeaderFileInfoTrait, hash the key using size & time of the file. 2013-03-06 18:12:47 +00:00
ASTReaderStmt.cpp objective-C arg: provide fixit support when 2013-02-22 22:02:53 +00:00
ASTWriter.cpp [PCH] When pre-validating the headers from the PCH, only validate non-system headers. 2013-03-06 18:12:50 +00:00
ASTWriterDecl.cpp [Sema] Semantic analysis for empty-declaration and attribute-declaration. 2013-02-22 17:15:32 +00:00
ASTWriterStmt.cpp objective-C arg: provide fixit support when 2013-02-22 22:02:53 +00:00
CMakeLists.txt Implement the writer side of the global module index. 2013-01-23 22:38:11 +00:00
GeneratePCH.cpp Sort all of Clang's files under 'lib', and fix up the broken headers 2012-12-04 09:13:33 +00:00
GlobalModuleIndex.cpp Never cache the result of a module file lookup. 2013-02-08 21:27:45 +00:00
Makefile Reintroduce the serialization library, with fixed dependencies. 2010-08-17 20:43:28 +00:00
Module.cpp [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more than once. 2013-03-06 18:12:44 +00:00
ModuleManager.cpp Never cache the result of a module file lookup. 2013-02-08 21:27:45 +00:00