Unify ctx_iterator/ctx_begin()/ctx_end() and iterator/begin()/end() so that a single iterator type is used for both traversing decls of the same declaration context *and* of the parent declaration contexts, depending on the value of the bool parameter 'LookInParentCtx' that is passed to IdentifierResolver::begin().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53724 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6acbb2d..e2ac7c5 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -91,15 +91,16 @@
   //   in this case the class name or enumeration name is hidden.
   if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
     // We are pushing the name of a tag (enum or class).
-    IdentifierResolver::ctx_iterator
-      CIT = IdResolver.ctx_begin(TD->getIdentifier(), TD->getDeclContext());
-    if (CIT != IdResolver.ctx_end(TD->getIdentifier()) &&
-        IdResolver.isDeclInScope(*CIT, TD->getDeclContext(), S)) {
+    IdentifierResolver::iterator
+        I = IdResolver.begin(TD->getIdentifier(),
+                             TD->getDeclContext(), false/*LookInParentCtx*/);
+    if (I != IdResolver.end() &&
+        IdResolver.isDeclInScope(*I, TD->getDeclContext(), S)) {
       // There is already a declaration with the same name in the same
       // scope. It must be found before we find the new declaration,
       // so swap the order on the shadowed declaration chain.
 
-      IdResolver.AddShadowedDecl(TD, *CIT);
+      IdResolver.AddShadowedDecl(TD, *I);
       return;
     }
   }
@@ -158,7 +159,7 @@
   // that is in the appropriate namespace.  This search should not take long, as
   // shadowing of names is uncommon, and deep shadowing is extremely uncommon.
   for (IdentifierResolver::iterator
-       I = IdResolver.begin(II, CurContext), E = IdResolver.end(II); I != E; ++I)
+       I = IdResolver.begin(II, CurContext), E = IdResolver.end(); I != E; ++I)
     if ((*I)->getIdentifierNamespace() & NS)
       return *I;