Change DeclContextLookup(Const)Result to (Mutable)ArrayRef<NamedDecl*>, as per review discussion in r170365

This does limit these typedefs to being sequences, but no current usage
requires them to be contiguous (we could expand this to a more general
iterator pair range concept at some point).

Also, it'd be nice if SmallVector were constructible directly from an ArrayRef
but this is a bit tricky since ArrayRef depends on SmallVectorBaseImpl for the
inverse conversion. (& generalizing over all range-like things, while nice,
would require some nontrivial SFINAE I haven't thought about yet)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170482 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/CXXInheritance.cpp b/lib/AST/CXXInheritance.cpp
index e0e3a69..5083a01 100644
--- a/lib/AST/CXXInheritance.cpp
+++ b/lib/AST/CXXInheritance.cpp
@@ -28,7 +28,7 @@
 
   llvm::SetVector<NamedDecl *, SmallVector<NamedDecl *, 8> > Decls;
   for (paths_iterator Path = begin(), PathEnd = end(); Path != PathEnd; ++Path)
-    Decls.insert(*Path->Decls.first);
+    Decls.insert(Path->Decls.front());
 
   NumDeclsFound = Decls.size();
   DeclsFound = new NamedDecl * [NumDeclsFound];
@@ -397,9 +397,9 @@
 
   DeclarationName N = DeclarationName::getFromOpaquePtr(Name);
   for (Path.Decls = BaseRecord->lookup(N);
-       Path.Decls.first != Path.Decls.second;
-       ++Path.Decls.first) {
-    if ((*Path.Decls.first)->isInIdentifierNamespace(IDNS_Tag))
+       !Path.Decls.empty();
+       Path.Decls = Path.Decls.slice(1)) {
+    if (Path.Decls.front()->isInIdentifierNamespace(IDNS_Tag))
       return true;
   }
 
@@ -415,9 +415,9 @@
   const unsigned IDNS = IDNS_Ordinary | IDNS_Tag | IDNS_Member;
   DeclarationName N = DeclarationName::getFromOpaquePtr(Name);
   for (Path.Decls = BaseRecord->lookup(N);
-       Path.Decls.first != Path.Decls.second;
-       ++Path.Decls.first) {
-    if ((*Path.Decls.first)->isInIdentifierNamespace(IDNS))
+       !Path.Decls.empty();
+       Path.Decls = Path.Decls.slice(1)) {
+    if (Path.Decls.front()->isInIdentifierNamespace(IDNS))
       return true;
   }
   
@@ -433,11 +433,11 @@
   
   DeclarationName N = DeclarationName::getFromOpaquePtr(Name);
   for (Path.Decls = BaseRecord->lookup(N);
-       Path.Decls.first != Path.Decls.second;
-       ++Path.Decls.first) {
+       !Path.Decls.empty();
+       Path.Decls = Path.Decls.slice(1)) {
     // FIXME: Refactor the "is it a nested-name-specifier?" check
-    if (isa<TypedefNameDecl>(*Path.Decls.first) ||
-        (*Path.Decls.first)->isInIdentifierNamespace(IDNS_Tag))
+    if (isa<TypedefNameDecl>(Path.Decls.front()) ||
+        Path.Decls.front()->isInIdentifierNamespace(IDNS_Tag))
       return true;
   }