From: Chris Lattner
Declarations in Clang's abstract syntax trees are stored
hierarchically. At the top of the hierarchy is the translation unit
(TranslationUnitDecl
), which contains all of the
-declarations in the translation unit. These declarations---such as
-functions or struct types---may also contain other declarations inside
+declarations in the translation unit. These declarations (such as
+functions or struct types) may also contain other declarations inside
them, and so on. Within Clang, each declaration is stored within a declaration
context, as represented by the DeclContext
class.
@@ -313,7 +313,7 @@ deserializing all of the declarations stored within that declaration
context. Therefore, Clang will deserialize the translation unit
declaration without deserializing the declarations within that
translation unit. When required, the declarations stored within a
-declaration context will be serialized. There are two representations
+declaration context will be deserialized. There are two representations
of the declarations within a declaration context, which correspond to
the name-lookup and iteration behavior described above:
IdentifierInfo
structure will have the same contents it would have after parsing the headers in the precompiled header.
+identifier table. If an identifier is found, its contents (macro
+definitions, flags, top-level declarations, etc.) will be deserialized, at which point the corresponding IdentifierInfo
structure will have the same contents it would have after parsing the headers in the precompiled header.
Within the PCH file, the identifiers used to name declarations are represented with an integral value. A separate table provides a mapping from this integral value (the identifier ID) to the location within the on-disk hash table where that identifier is stored. This mapping is used when