[serialization] Introduce ModuleID, with codes for special modules.

ModuleID is compatible with IdentifierID, but uses 0 to mean “the builtin module”
and 1 to mean “the current module”. Anything else is a top-level module name,
as an identifier. As an implementation detail, 1 is now never a valid IdentifierID.
(0 remains “the empty string”.)

Using this, simplify the encoding of the owner of a conformance.

Swift SVN r9944
This commit is contained in:
Jordan Rose
2013-11-04 23:50:46 +00:00
parent e001667ac2
commit 63731584b6
5 changed files with 70 additions and 40 deletions

View File

@@ -370,10 +370,13 @@ public:
Optional<DeclContext *> ForcedContext = {},
std::function<void(Decl*)> DidRecord = nullptr);
/// Returns the appropriate module for the given ID.
Module *getModule(serialization::ModuleID MID);
/// Returns the appropriate module for the given name.
///
/// If the name matches the name of the current module, a shadowed module
/// is loaded instead. An empty name represents the Builtin module.
/// is loaded instead.
Module *getModule(Identifier name);
/// Reads a substitution record from \c DeclTypeCursor.