Specially, in ASTWriter, the LocalDeclID to the ModuleFile been writting is equal to the GlobalDeclID. Outside the serializer, all the DeclID been used should be GlobalDeclID. We can translate a LocalDeclID to the GlobalDeclID by [ASTReader::getGlobalDeclID()](classclang%5F1%5F1ASTReader.html#a80b9d632ad37edacdfd07f12c3450d84 "Map from a local declaration ID within a given module to a global declaration ID.").
An ID number that refers to a declaration in an AST file.
The ID numbers of declarations are consecutive (in order of discovery), with values below NUM_PREDEF_DECL_IDS being reserved. At the start of a chain of precompiled headers, declaration ID 1 is used for the translation unit declaration.
DeclID should only be used directly in serialization. All other users should use LocalDeclID or GlobalDeclID.