Merge remote-tracking branch 'origin/master' into master-next

This commit is contained in:
swift-ci
2018-07-31 13:29:50 -07:00
59 changed files with 996 additions and 413 deletions

View File

@@ -835,6 +835,9 @@ bool ModuleFile::readIndexBlock(llvm::BitstreamCursor &cursor) {
assert(blobData.empty());
setEntryPointClassID(scratch.front());
break;
case index_block::ORDERED_TOP_LEVEL_DECLS:
OrderedTopLevelDecls.assign(scratch.begin(), scratch.end());
break;
case index_block::LOCAL_TYPE_DECLS:
LocalTypeDecls = readLocalDeclTable(scratch, blobData);
break;
@@ -1672,8 +1675,8 @@ void ModuleFile::getImportDecls(SmallVectorImpl<Decl *> &Results) {
SmallVector<ValueDecl *, 8> Decls;
TopLevelModule->lookupQualified(
ModuleType::get(TopLevelModule), ScopeID,
NL_QualifiedDefault | NL_KnownNoDependency, nullptr, Decls);
TopLevelModule, ScopeID,
NL_QualifiedDefault | NL_KnownNoDependency, Decls);
Optional<ImportKind> FoundKind = ImportDecl::findBestImportKind(Decls);
assert(FoundKind.hasValue() &&
"deserialized imports should not be ambiguous");
@@ -1988,48 +1991,15 @@ ModuleFile::collectLinkLibraries(ModuleDecl::LinkLibraryCallback callback) const
void ModuleFile::getTopLevelDecls(SmallVectorImpl<Decl *> &results) {
PrettyStackTraceModuleFile stackEntry(*this);
if (PrecedenceGroupDecls) {
for (auto entry : PrecedenceGroupDecls->data()) {
for (auto item : entry)
results.push_back(getDecl(item.second));
}
}
if (OperatorDecls) {
for (auto entry : OperatorDecls->data()) {
for (auto item : entry)
results.push_back(getDecl(item.second));
}
}
if (TopLevelDecls) {
for (auto entry : TopLevelDecls->data()) {
for (auto item : entry) {
Expected<Decl *> declOrError = getDeclChecked(item.second);
if (!declOrError) {
if (!getContext().LangOpts.EnableDeserializationRecovery)
fatal(declOrError.takeError());
llvm::consumeError(declOrError.takeError());
continue;
}
results.push_back(declOrError.get());
}
}
}
if (ExtensionDecls) {
for (auto entry : ExtensionDecls->data()) {
for (auto item : entry) {
Expected<Decl *> declOrError = getDeclChecked(item.second);
if (!declOrError) {
if (!getContext().LangOpts.EnableDeserializationRecovery)
fatal(declOrError.takeError());
llvm::consumeError(declOrError.takeError());
continue;
}
results.push_back(declOrError.get());
}
for (DeclID entry : OrderedTopLevelDecls) {
Expected<Decl *> declOrError = getDeclChecked(entry);
if (!declOrError) {
if (!getContext().LangOpts.EnableDeserializationRecovery)
fatal(declOrError.takeError());
llvm::consumeError(declOrError.takeError());
continue;
}
results.push_back(declOrError.get());
}
}