Implementation of pre-compiled headers (PCH) based on lazy

de-serialization of abstract syntax trees.

PCH support serializes the contents of the abstract syntax tree (AST)
to a bitstream. When the PCH file is read, declarations are serialized
as-needed. For example, a declaration of a variable "x" will be
deserialized only when its VarDecl can be found by a client, e.g.,
based on name lookup for "x" or traversing the entire contents of the
owner of "x".

This commit provides the framework for serialization and (lazy)
deserialization, along with support for variable and typedef
declarations (along with several kinds of types). More
declarations/types, along with important auxiliary structures (source
manager, preprocessor, etc.), will follow.

llvm-svn: 68732
This commit is contained in:
Douglas Gregor
2009-04-09 22:27:44 +00:00
parent f2489ea043
commit ef84c4b434
19 changed files with 2301 additions and 49 deletions

View File

@@ -524,6 +524,12 @@ bool Sema::MergeTypeDefDecl(TypedefDecl *New, Decl *OldD) {
return false;
}
// __builtin_va_list gets redeclared in the built-in definitions
// buffer when using PCH. Don't complain about such redefinitions.
if (Context.getExternalSource() &&
strcmp(SourceMgr.getBufferName(New->getLocation()), "<built-in>") == 0)
return false;
Diag(New->getLocation(), diag::err_redefinition) << New->getDeclName();
Diag(Old->getLocation(), diag::note_previous_definition);
return true;