[serialization] Add support for [conversion] methods.

Take advantage of the fact that a function can never be both a conversion
method and an assignment operator to pack both flags into the same bit in
the serialized record.

Swift SVN r6185
This commit is contained in:
Jordan Rose
2013-07-11 23:35:12 +00:00
parent 02c609854c
commit d1163afb4b
3 changed files with 12 additions and 6 deletions

View File

@@ -672,13 +672,13 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
DeclID contextID;
bool isImplicit;
bool isClassMethod;
bool isAssignment;
bool isAssignmentOrConversion;
TypeID signatureID;
DeclID associatedDeclID;
DeclID overriddenID;
decls_block::FuncLayout::readRecord(scratch, nameID, contextID, isImplicit,
isClassMethod, isAssignment,
isClassMethod, isAssignmentOrConversion,
signatureID, associatedDeclID,
overriddenID);
@@ -738,8 +738,12 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
fn->setStatic(isClassMethod);
if (isImplicit)
fn->setImplicit();
if (isAssignment)
fn->getMutableAttrs().Assignment = isAssignment;
if (isAssignmentOrConversion) {
if (fn->isOperator())
fn->getMutableAttrs().Assignment = true;
else
fn->getMutableAttrs().Conversion = true;
}
if (Decl *associated = getDecl(associatedDeclID)) {
if (auto op = dyn_cast<OperatorDecl>(associated)) {