clang API Documentation

clang::pch Namespace Reference

Typedefs

typedef uint32_t DeclID
 An ID number that refers to a declaration in a PCH file.
typedef uint32_t TypeID
 An ID number that refers to a type in a PCH file.
typedef uint32_t IdentID
 An ID number that refers to an identifier in a PCH file.
typedef uint32_t SelectorID

Enumerations

enum  BlockIDs { PCH_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID, SOURCE_MANAGER_BLOCK_ID, PREPROCESSOR_BLOCK_ID, DECLTYPES_BLOCK_ID }
 

Describes the various kinds of blocks that occur within a PCH file.

More...
enum  PCHRecordTypes {
  TYPE_OFFSET = 1, DECL_OFFSET = 2, LANGUAGE_OPTIONS = 3, METADATA = 4,
  IDENTIFIER_OFFSET = 5, IDENTIFIER_TABLE = 6, EXTERNAL_DEFINITIONS = 7, SPECIAL_TYPES = 8,
  STATISTICS = 9, TENTATIVE_DEFINITIONS = 10, LOCALLY_SCOPED_EXTERNAL_DECLS = 11, SELECTOR_OFFSETS = 12,
  METHOD_POOL = 13, PP_COUNTER_VALUE = 14, SOURCE_LOCATION_OFFSETS = 15, SOURCE_LOCATION_PRELOADS = 16,
  STAT_CACHE = 17, EXT_VECTOR_DECLS = 18, ORIGINAL_FILE_NAME = 19, VERSION_CONTROL_BRANCH_REVISION = 21,
  UNUSED_FILESCOPED_DECLS = 22, MACRO_DEFINITION_OFFSETS = 23, VTABLE_USES = 24, DYNAMIC_CLASSES = 25,
  CHAINED_METADATA = 26, REFERENCED_SELECTOR_POOL = 27, TU_UPDATE_LEXICAL = 28, REDECLS_UPDATE_LATEST = 29,
  SEMA_DECL_REFS = 30, WEAK_UNDECLARED_IDENTIFIERS = 31, PENDING_IMPLICIT_INSTANTIATIONS = 32, DECL_REPLACEMENTS = 33
}
 

Record types that occur within the PCH block itself.

More...
enum  SourceManagerRecordTypes {
  SM_SLOC_FILE_ENTRY = 1, SM_SLOC_BUFFER_ENTRY = 2, SM_SLOC_BUFFER_BLOB = 3, SM_SLOC_INSTANTIATION_ENTRY = 4,
  SM_LINE_TABLE = 5
}
 

Record types used within a source manager block.

More...
enum  PreprocessorRecordTypes {
  PP_MACRO_OBJECT_LIKE = 1, PP_MACRO_FUNCTION_LIKE = 2, PP_TOKEN = 3, PP_MACRO_INSTANTIATION = 4,
  PP_MACRO_DEFINITION = 5
}
 

Record types used within a preprocessor block.

More...
enum  PredefinedTypeIDs {
  PREDEF_TYPE_NULL_ID = 0, PREDEF_TYPE_VOID_ID = 1, PREDEF_TYPE_BOOL_ID = 2, PREDEF_TYPE_CHAR_U_ID = 3,
  PREDEF_TYPE_UCHAR_ID = 4, PREDEF_TYPE_USHORT_ID = 5, PREDEF_TYPE_UINT_ID = 6, PREDEF_TYPE_ULONG_ID = 7,
  PREDEF_TYPE_ULONGLONG_ID = 8, PREDEF_TYPE_CHAR_S_ID = 9, PREDEF_TYPE_SCHAR_ID = 10, PREDEF_TYPE_WCHAR_ID = 11,
  PREDEF_TYPE_SHORT_ID = 12, PREDEF_TYPE_INT_ID = 13, PREDEF_TYPE_LONG_ID = 14, PREDEF_TYPE_LONGLONG_ID = 15,
  PREDEF_TYPE_FLOAT_ID = 16, PREDEF_TYPE_DOUBLE_ID = 17, PREDEF_TYPE_LONGDOUBLE_ID = 18, PREDEF_TYPE_OVERLOAD_ID = 19,
  PREDEF_TYPE_DEPENDENT_ID = 20, PREDEF_TYPE_UINT128_ID = 21, PREDEF_TYPE_INT128_ID = 22, PREDEF_TYPE_NULLPTR_ID = 23,
  PREDEF_TYPE_CHAR16_ID = 24, PREDEF_TYPE_CHAR32_ID = 25, PREDEF_TYPE_OBJC_ID = 26, PREDEF_TYPE_OBJC_CLASS = 27,
  PREDEF_TYPE_OBJC_SEL = 28
}
 

Predefined type IDs.

More...
enum  TypeCode {
  TYPE_EXT_QUAL = 1, TYPE_COMPLEX = 3, TYPE_POINTER = 4, TYPE_BLOCK_POINTER = 5,
  TYPE_LVALUE_REFERENCE = 6, TYPE_RVALUE_REFERENCE = 7, TYPE_MEMBER_POINTER = 8, TYPE_CONSTANT_ARRAY = 9,
  TYPE_INCOMPLETE_ARRAY = 10, TYPE_VARIABLE_ARRAY = 11, TYPE_VECTOR = 12, TYPE_EXT_VECTOR = 13,
  TYPE_FUNCTION_NO_PROTO = 14, TYPE_FUNCTION_PROTO = 15, TYPE_TYPEDEF = 16, TYPE_TYPEOF_EXPR = 17,
  TYPE_TYPEOF = 18, TYPE_RECORD = 19, TYPE_ENUM = 20, TYPE_OBJC_INTERFACE = 21,
  TYPE_OBJC_OBJECT_POINTER = 22, TYPE_DECLTYPE = 23, TYPE_ELABORATED = 24, TYPE_SUBST_TEMPLATE_TYPE_PARM = 25,
  TYPE_UNRESOLVED_USING = 26, TYPE_INJECTED_CLASS_NAME = 27, TYPE_OBJC_OBJECT = 28, TYPE_TEMPLATE_TYPE_PARM = 29,
  TYPE_TEMPLATE_SPECIALIZATION = 30, TYPE_DEPENDENT_NAME = 31, TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32, TYPE_DEPENDENT_SIZED_ARRAY = 33
}
 

Record codes for each kind of type.

More...
enum  SpecialTypeIDs {
  SPECIAL_TYPE_BUILTIN_VA_LIST = 0, SPECIAL_TYPE_OBJC_ID = 1, SPECIAL_TYPE_OBJC_SELECTOR = 2, SPECIAL_TYPE_OBJC_PROTOCOL = 3,
  SPECIAL_TYPE_OBJC_CLASS = 4, SPECIAL_TYPE_CF_CONSTANT_STRING = 5, SPECIAL_TYPE_OBJC_FAST_ENUMERATION_STATE = 6, SPECIAL_TYPE_FILE = 7,
  SPECIAL_TYPE_jmp_buf = 8, SPECIAL_TYPE_sigjmp_buf = 9, SPECIAL_TYPE_OBJC_ID_REDEFINITION = 10, SPECIAL_TYPE_OBJC_CLASS_REDEFINITION = 11,
  SPECIAL_TYPE_BLOCK_DESCRIPTOR = 12, SPECIAL_TYPE_BLOCK_EXTENDED_DESCRIPTOR = 13, SPECIAL_TYPE_OBJC_SEL_REDEFINITION = 14, SPECIAL_TYPE_NS_CONSTANT_STRING = 15,
  SPECIAL_TYPE_INT128_INSTALLED = 16
}
 

The type IDs for special types constructed by semantic analysis.

More...
enum  DeclCode {
  DECL_ATTR = 50, DECL_TRANSLATION_UNIT, DECL_TYPEDEF, DECL_ENUM,
  DECL_RECORD, DECL_ENUM_CONSTANT, DECL_FUNCTION, DECL_OBJC_METHOD,
  DECL_OBJC_INTERFACE, DECL_OBJC_PROTOCOL, DECL_OBJC_IVAR, DECL_OBJC_AT_DEFS_FIELD,
  DECL_OBJC_CLASS, DECL_OBJC_FORWARD_PROTOCOL, DECL_OBJC_CATEGORY, DECL_OBJC_CATEGORY_IMPL,
  DECL_OBJC_IMPLEMENTATION, DECL_OBJC_COMPATIBLE_ALIAS, DECL_OBJC_PROPERTY, DECL_OBJC_PROPERTY_IMPL,
  DECL_FIELD, DECL_VAR, DECL_IMPLICIT_PARAM, DECL_PARM_VAR,
  DECL_FILE_SCOPE_ASM, DECL_BLOCK, DECL_CONTEXT_LEXICAL, DECL_CONTEXT_VISIBLE,
  DECL_NAMESPACE, DECL_NAMESPACE_ALIAS, DECL_USING, DECL_USING_SHADOW,
  DECL_USING_DIRECTIVE, DECL_UNRESOLVED_USING_VALUE, DECL_UNRESOLVED_USING_TYPENAME, DECL_LINKAGE_SPEC,
  DECL_CXX_RECORD, DECL_CXX_METHOD, DECL_CXX_CONSTRUCTOR, DECL_CXX_DESTRUCTOR,
  DECL_CXX_CONVERSION, DECL_ACCESS_SPEC, DECL_FRIEND, DECL_FRIEND_TEMPLATE,
  DECL_CLASS_TEMPLATE, DECL_CLASS_TEMPLATE_SPECIALIZATION, DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION, DECL_FUNCTION_TEMPLATE,
  DECL_TEMPLATE_TYPE_PARM, DECL_NON_TYPE_TEMPLATE_PARM, DECL_TEMPLATE_TEMPLATE_PARM, DECL_STATIC_ASSERT
}
 

Record codes for each kind of declaration.

More...
enum  StmtCode {
  STMT_STOP = 100, STMT_NULL_PTR, STMT_NULL, STMT_COMPOUND,
  STMT_CASE, STMT_DEFAULT, STMT_LABEL, STMT_IF,
  STMT_SWITCH, STMT_WHILE, STMT_DO, STMT_FOR,
  STMT_GOTO, STMT_INDIRECT_GOTO, STMT_CONTINUE, STMT_BREAK,
  STMT_RETURN, STMT_DECL, STMT_ASM, EXPR_PREDEFINED,
  EXPR_DECL_REF, EXPR_INTEGER_LITERAL, EXPR_FLOATING_LITERAL, EXPR_IMAGINARY_LITERAL,
  EXPR_STRING_LITERAL, EXPR_CHARACTER_LITERAL, EXPR_PAREN, EXPR_PAREN_LIST,
  EXPR_UNARY_OPERATOR, EXPR_OFFSETOF, EXPR_SIZEOF_ALIGN_OF, EXPR_ARRAY_SUBSCRIPT,
  EXPR_CALL, EXPR_MEMBER, EXPR_BINARY_OPERATOR, EXPR_COMPOUND_ASSIGN_OPERATOR,
  EXPR_CONDITIONAL_OPERATOR, EXPR_IMPLICIT_CAST, EXPR_CSTYLE_CAST, EXPR_COMPOUND_LITERAL,
  EXPR_EXT_VECTOR_ELEMENT, EXPR_INIT_LIST, EXPR_DESIGNATED_INIT, EXPR_IMPLICIT_VALUE_INIT,
  EXPR_VA_ARG, EXPR_ADDR_LABEL, EXPR_STMT, EXPR_TYPES_COMPATIBLE,
  EXPR_CHOOSE, EXPR_GNU_NULL, EXPR_SHUFFLE_VECTOR, EXPR_BLOCK,
  EXPR_BLOCK_DECL_REF, EXPR_OBJC_STRING_LITERAL, EXPR_OBJC_ENCODE, EXPR_OBJC_SELECTOR_EXPR,
  EXPR_OBJC_PROTOCOL_EXPR, EXPR_OBJC_IVAR_REF_EXPR, EXPR_OBJC_PROPERTY_REF_EXPR, EXPR_OBJC_KVC_REF_EXPR,
  EXPR_OBJC_MESSAGE_EXPR, EXPR_OBJC_SUPER_EXPR, EXPR_OBJC_ISA, STMT_OBJC_FOR_COLLECTION,
  STMT_OBJC_CATCH, STMT_OBJC_FINALLY, STMT_OBJC_AT_TRY, STMT_OBJC_AT_SYNCHRONIZED,
  STMT_OBJC_AT_THROW, STMT_CXX_CATCH, STMT_CXX_TRY, EXPR_CXX_OPERATOR_CALL,
  EXPR_CXX_MEMBER_CALL, EXPR_CXX_CONSTRUCT, EXPR_CXX_TEMPORARY_OBJECT, EXPR_CXX_STATIC_CAST,
  EXPR_CXX_DYNAMIC_CAST, EXPR_CXX_REINTERPRET_CAST, EXPR_CXX_CONST_CAST, EXPR_CXX_FUNCTIONAL_CAST,
  EXPR_CXX_BOOL_LITERAL, EXPR_CXX_NULL_PTR_LITERAL, EXPR_CXX_TYPEID_EXPR, EXPR_CXX_TYPEID_TYPE,
  EXPR_CXX_THIS, EXPR_CXX_THROW, EXPR_CXX_DEFAULT_ARG, EXPR_CXX_BIND_TEMPORARY,
  EXPR_CXX_BIND_REFERENCE, EXPR_CXX_SCALAR_VALUE_INIT, EXPR_CXX_NEW, EXPR_CXX_DELETE,
  EXPR_CXX_PSEUDO_DESTRUCTOR, EXPR_CXX_EXPR_WITH_TEMPORARIES, EXPR_CXX_DEPENDENT_SCOPE_MEMBER, EXPR_CXX_DEPENDENT_SCOPE_DECL_REF,
  EXPR_CXX_UNRESOLVED_CONSTRUCT, EXPR_CXX_UNRESOLVED_MEMBER, EXPR_CXX_UNRESOLVED_LOOKUP, EXPR_CXX_UNARY_TYPE_TRAIT
}
 

Record codes for each kind of statement or expression.

More...
enum  DesignatorTypes { DESIG_FIELD_NAME = 0, DESIG_FIELD_DECL = 1, DESIG_ARRAY = 2, DESIG_ARRAY_RANGE = 3 }
 

The kinds of designators that can occur in a DesignatedInitExpr.

More...

Variables

const unsigned VERSION_MAJOR = 4
 PCH major version number supported by this version of Clang.
const unsigned VERSION_MINOR = 0
 PCH minor version number supported by this version of Clang.
const unsigned NUM_PREDEF_TYPE_IDS = 100
 The number of predefined type IDs that are reserved for the PREDEF_TYPE_* constants.

Typedef Documentation

typedef uint32_t clang::pch::DeclID

An ID number that refers to a declaration in a PCH file.

The ID numbers of declarations are consecutive (in order of discovery) and start at 2. 0 is reserved for NULL, and 1 is reserved for the translation unit declaration.

Definition at line 53 of file PCHBitCodes.h.

typedef uint32_t clang::pch::IdentID

An ID number that refers to an identifier in a PCH file.

Definition at line 69 of file PCHBitCodes.h.

typedef uint32_t clang::pch::SelectorID

Definition at line 71 of file PCHBitCodes.h.

typedef uint32_t clang::pch::TypeID

An ID number that refers to a type in a PCH file.

The ID of a type is partitioned into two parts: the lower three bits are used to store the const/volatile/restrict qualifiers (as with QualType) and the upper bits provide a type index. The type index values are partitioned into two sets. The values below NUM_PREDEF_TYPE_IDs are predefined type IDs (based on the PREDEF_TYPE_*_ID constants), with 0 as a placeholder for "no type". Values from NUM_PREDEF_TYPE_IDs are other types that have serialized representations.

Definition at line 65 of file PCHBitCodes.h.


Enumeration Type Documentation

Describes the various kinds of blocks that occur within a PCH file.

Enumerator:
PCH_BLOCK_ID 

The PCH block, which acts as a container around the full PCH block.

SOURCE_MANAGER_BLOCK_ID 

The block containing information about the source manager.

PREPROCESSOR_BLOCK_ID 

The block containing information about the preprocessor.

DECLTYPES_BLOCK_ID 

The block containing the definitions of all of the types and decls used within the PCH file.

Definition at line 75 of file PCHBitCodes.h.

Record types that occur within the PCH block itself.

Enumerator:
TYPE_OFFSET 

Record code for the offsets of each type.

The TYPE_OFFSET constant describes the record that occurs within the PCH block. The record itself is an array of offsets that point into the declarations and types block (identified by DECLTYPES_BLOCK_ID). The index into the array is based on the ID of a type. For a given type ID T, the lower three bits of T are its qualifiers (const, volatile, restrict), as in the QualType class. The upper bits, after being shifted and subtracting NUM_PREDEF_TYPE_IDS, are used to index into the TYPE_OFFSET block to determine the offset of that type's corresponding record within the DECLTYPES_BLOCK_ID block.

DECL_OFFSET 

Record code for the offsets of each decl.

The DECL_OFFSET constant describes the record that occurs within the block identified by DECL_OFFSETS_BLOCK_ID within the PCH block. The record itself is an array of offsets that point into the declarations and types block (identified by DECLTYPES_BLOCK_ID). The declaration ID is an index into this record, after subtracting one to account for the use of declaration ID 0 for a NULL declaration pointer. Index 0 is reserved for the translation unit declaration.

LANGUAGE_OPTIONS 

Record code for the language options table.

The record with this code contains the contents of the LangOptions structure. We serialize the entire contents of the structure, and let the reader decide which options are actually important to check.

METADATA 

PCH metadata, including the PCH file version number and the target triple used to build the PCH file.

IDENTIFIER_OFFSET 

Record code for the table of offsets of each identifier ID.

The offset table contains offsets into the blob stored in the IDENTIFIER_TABLE record. Each offset points to the NULL-terminated string that corresponds to that identifier.

IDENTIFIER_TABLE 

Record code for the identifier table.

The identifier table is a simple blob that contains NULL-terminated strings for all of the identifiers referenced by the PCH file. The IDENTIFIER_OFFSET table contains the mapping from identifier IDs to the characters in this blob. Note that the starting offsets of all of the identifiers are odd, so that, when the identifier offset table is loaded in, we can use the low bit to distinguish between offsets (for unresolved identifier IDs) and IdentifierInfo pointers (for already-resolved identifier IDs).

EXTERNAL_DEFINITIONS 

Record code for the array of external definitions.

The PCH file contains a list of all of the unnamed external definitions present within the parsed headers, stored as an array of declaration IDs. These external definitions will be reported to the AST consumer after the PCH file has been read, since their presence can affect the semantics of the program (e.g., for code generation).

SPECIAL_TYPES 

Record code for the set of non-builtin, special types.

This record contains the type IDs for the various type nodes that are constructed during semantic analysis (e.g., __builtin_va_list). The SPECIAL_TYPE_* constants provide offsets into this record.

STATISTICS 

Record code for the extra statistics we gather while generating a PCH file.

TENTATIVE_DEFINITIONS 

Record code for the array of tentative definitions.

LOCALLY_SCOPED_EXTERNAL_DECLS 

Record code for the array of locally-scoped external declarations.

SELECTOR_OFFSETS 

Record code for the table of offsets into the Objective-C method pool.

METHOD_POOL 

Record code for the Objective-C method pool,.

PP_COUNTER_VALUE 

The value of the next __COUNTER__ to dispense. [PP_COUNTER_VALUE, Val].

SOURCE_LOCATION_OFFSETS 

Record code for the table of offsets into the block of source-location information.

SOURCE_LOCATION_PRELOADS 

Record code for the set of source location entries that need to be preloaded by the PCH reader.

This set contains the source location entry for the predefines buffer and for any file entries that need to be preloaded.

STAT_CACHE 

Record code for the stat() cache.

EXT_VECTOR_DECLS 

Record code for the set of ext_vector type names.

ORIGINAL_FILE_NAME 

Record code for the original file that was used to generate the precompiled header.

VERSION_CONTROL_BRANCH_REVISION 

Record #20 intentionally left blank.

Record code for the version control branch and revision information of the compiler used to build this PCH file.

UNUSED_FILESCOPED_DECLS 

Record code for the array of unused file scoped decls.

MACRO_DEFINITION_OFFSETS 

Record code for the table of offsets to macro definition entries in the preprocessing record.

VTABLE_USES 

Record code for the array of VTable uses.

DYNAMIC_CLASSES 

Record code for the array of dynamic classes.

CHAINED_METADATA 

Record code for the chained PCH metadata, including the PCH version and the name of the PCH this is chained to.

REFERENCED_SELECTOR_POOL 

Record code for referenced selector pool.

TU_UPDATE_LEXICAL 

Record code for an update to the TU's lexically contained declarations.

REDECLS_UPDATE_LATEST 

Record code for an update to first decls pointing to the latest redeclarations.

SEMA_DECL_REFS 

Record code for declarations that Sema keeps references of.

WEAK_UNDECLARED_IDENTIFIERS 

Record code for weak undeclared identifiers.

PENDING_IMPLICIT_INSTANTIATIONS 

Record code for pending implicit instantiations.

DECL_REPLACEMENTS 

Record code for a decl replacement block.

If a declaration is modified after having been deserialized, and then written to a dependent PCH file, its ID and offset must be added to the replacement block.

Definition at line 94 of file PCHBitCodes.h.

Record types used within a preprocessor block.

Enumerator:
PP_MACRO_OBJECT_LIKE 

An object-like macro definition. [PP_MACRO_OBJECT_LIKE, IdentInfoID, SLoc, IsUsed].

PP_MACRO_FUNCTION_LIKE 

A function-like macro definition. [PP_MACRO_FUNCTION_LIKE, <ObjectLikeStuff>, IsC99Varargs, IsGNUVarars, NumArgs, ArgIdentInfoID* ].

PP_TOKEN 

Describes one token. [PP_TOKEN, SLoc, Length, IdentInfoID, Kind, Flags].

PP_MACRO_INSTANTIATION 

Describes a macro instantiation within the preprocessing record.

PP_MACRO_DEFINITION 

Describes a macro definition within the preprocessing record.

Definition at line 290 of file PCHBitCodes.h.

Record types used within a source manager block.

Enumerator:
SM_SLOC_FILE_ENTRY 

Describes a source location entry (SLocEntry) for a file.

SM_SLOC_BUFFER_ENTRY 

Describes a source location entry (SLocEntry) for a buffer.

SM_SLOC_BUFFER_BLOB 

Describes a blob that contains the data for a buffer entry. This kind of record always directly follows a SM_SLOC_BUFFER_ENTRY record.

SM_SLOC_INSTANTIATION_ENTRY 

Describes a source location entry (SLocEntry) for a macro instantiation.

SM_LINE_TABLE 

Describes the SourceManager's line table, with information about line directives.

Definition at line 270 of file PCHBitCodes.h.


Variable Documentation

const unsigned clang::pch::VERSION_MAJOR = 4

PCH major version number supported by this version of Clang.

Whenever the PCH format changes in a way that makes it incompatible with previous versions (such that a reader designed for the previous version could not support reading the new version), this number should be increased.

Version 4 of PCH files also requires that the version control branch and revision match exactly, since there is no backward compatibility of PCH files at this time.

Definition at line 36 of file PCHBitCodes.h.

const unsigned clang::pch::VERSION_MINOR = 0

PCH minor version number supported by this version of Clang.

Whenever the PCH format changes in a way that is still compatible with previous versions (such that a reader designed for the previous version could still support reading the new version by ignoring new kinds of subblocks), this number should be increased.

Definition at line 46 of file PCHBitCodes.h.