Serialization: Updates to use llvm/Support/OnDiskHashTable.h

The on-disk hashtable is moving from clang to llvm. This updates some
consumers for the new path and namespace. I've also shortened the
make_range(data_begin(), data_end()) calls on the hash table to just
use data().

Swift SVN r16537
This commit is contained in:
Justin Bogner
2014-04-18 18:05:35 +00:00
parent e6276a1c2f
commit 64c572e0d2
6 changed files with 17 additions and 39 deletions

View File

@@ -19,11 +19,9 @@
#include "swift/Basic/Range.h"
#include "swift/Serialization/BCReadingExtras.h"
// This is a template-only header; eventually it should move to llvm/Support.
#include "clang/Basic/OnDiskHashTable.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/OnDiskHashTable.h"
#include "llvm/Support/PrettyStackTrace.h"
using namespace swift;
@@ -965,8 +963,7 @@ void ModuleFile::lookupVisibleDecls(Module::AccessPathTy accessPath,
DeclVisibilityKind::VisibleAtTopLevel);
}
for (auto entry : make_range(TopLevelDecls->data_begin(),
TopLevelDecls->data_end())) {
for (auto entry : TopLevelDecls->data()) {
for (auto item : entry)
consumer.foundDecl(cast<ValueDecl>(getDecl(item.second)),
DeclVisibilityKind::VisibleAtTopLevel);
@@ -1057,8 +1054,7 @@ void ModuleFile::lookupClassMembers(Module::AccessPathTy accessPath,
return;
if (!accessPath.empty()) {
for (const auto &list : make_range(ClassMembersByName->data_begin(),
ClassMembersByName->data_end())) {
for (const auto &list : ClassMembersByName->data()) {
for (auto item : list) {
auto vd = cast<ValueDecl>(getDecl(item.second));
auto dc = vd->getDeclContext();
@@ -1072,8 +1068,7 @@ void ModuleFile::lookupClassMembers(Module::AccessPathTy accessPath,
return;
}
for (const auto &list : make_range(ClassMembersByName->data_begin(),
ClassMembersByName->data_end())) {
for (const auto &list : ClassMembersByName->data()) {
for (auto item : list)
consumer.foundDecl(cast<ValueDecl>(getDecl(item.second)),
DeclVisibilityKind::DynamicLookup);
@@ -1092,24 +1087,21 @@ ModuleFile::collectLinkLibraries(Module::LinkLibraryCallback callback) const {
void ModuleFile::getTopLevelDecls(SmallVectorImpl<Decl *> &results) {
PrettyModuleFileDeserialization stackEntry(*this);
if (OperatorDecls) {
for (auto entry : make_range(OperatorDecls->data_begin(),
OperatorDecls->data_end())) {
for (auto entry : OperatorDecls->data()) {
for (auto item : entry)
results.push_back(getDecl(item.second));
}
}
if (TopLevelDecls) {
for (auto entry : make_range(TopLevelDecls->data_begin(),
TopLevelDecls->data_end())) {
for (auto entry : TopLevelDecls->data()) {
for (auto item : entry)
results.push_back(getDecl(item.second));
}
}
if (ExtensionDecls) {
for (auto entry : make_range(ExtensionDecls->data_begin(),
ExtensionDecls->data_end())) {
for (auto entry : ExtensionDecls->data()) {
for (auto item : entry)
results.push_back(getDecl(item.second));
}
@@ -1166,4 +1158,3 @@ Optional<BriefAndRawComment> ModuleFile::getCommentForDeclByUSR(StringRef USR) {
return *I;
}