summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/IdentifierResolver.h
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-21 22:25:48 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-21 22:25:48 +0000
commita868bbd392594290cff15a3d25e8a69fe43a3857 (patch)
tree045c8d9a805a09312e207cea5c7a0a8aab565ca6 /clang/lib/Sema/IdentifierResolver.h
parent1f9183c7ca3621dff097392aa5b2390a3ea69df3 (diff)
downloadbcm5719-llvm-a868bbd392594290cff15a3d25e8a69fe43a3857.tar.gz
bcm5719-llvm-a868bbd392594290cff15a3d25e8a69fe43a3857.zip
Lazy deserialization of the declaration chains associated with
identifiers from a precompiled header. This patch changes the primary name lookup method for entities within a precompiled header. Previously, we would load all of the names of declarations at translation unit scope into a large DenseMap (inside the TranslationUnitDecl's DeclContext), and then perform a special "last resort" lookup into this DeclContext when we knew there was a PCH file (see Sema::LookupName). Now, when we see an identifier named for the first time, we load all of the declarations with that name that are visible from the translation unit into the IdentifierInfo's chain of declarations. Thus, the explicit "look into the translation unit's DeclContext" code is gone, and Sema effectively uses the same IdentifierInfo-based name lookup mechanism whether we are using a PCH file or not. This approach should help PCH scale with the size of the input program rather than the size of the PCH file. The "Hello, World!" application with Carbon.h as a PCH file now loads 20% of the identifiers in the PCH file rather than 85% of the identifiers. 90% of the 20% of identifiers loaded are actually loaded when we deserialize the preprocessor state. The next step is to make the preprocessor load macros lazily, which should drastically reduce the number of types, declarations, and identifiers loaded for "Hello, World". llvm-svn: 69737
Diffstat (limited to 'clang/lib/Sema/IdentifierResolver.h')
-rw-r--r--clang/lib/Sema/IdentifierResolver.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Sema/IdentifierResolver.h b/clang/lib/Sema/IdentifierResolver.h
index 1843f4ebca1..0b0e6b388dd 100644
--- a/clang/lib/Sema/IdentifierResolver.h
+++ b/clang/lib/Sema/IdentifierResolver.h
@@ -177,6 +177,14 @@ public:
/// (and, therefore, replaced).
bool ReplaceDecl(NamedDecl *Old, NamedDecl *New);
+ /// \brief Link the declaration into the chain of declarations for
+ /// the given identifier.
+ ///
+ /// This is a lower-level routine used by the PCH reader to link a
+ /// declaration into a specific IdentifierInfo before the
+ /// declaration actually has a name.
+ void AddDeclToIdentifierChain(IdentifierInfo *II, NamedDecl *D);
+
explicit IdentifierResolver(const LangOptions &LangOpt);
~IdentifierResolver();
OpenPOWER on IntegriCloud