Eliminated LookupCriteria, whose creation was causing a bottleneck for
LookupName et al. Instead, use an enum and a bool to describe its
contents.

Optimized the C/Objective-C path through LookupName, eliminating any
unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing
some code and arguments that are no longer used.

Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers
over to LookupName, LookupQualifiedName, or LookupParsedName, as
appropriate.

All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and
-disable-free. Plus, we're down to three name-lookup routines.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63354 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp
index 4e9d085..781d89a 100644
--- a/lib/Sema/IdentifierResolver.cpp
+++ b/lib/Sema/IdentifierResolver.cpp
@@ -225,14 +225,9 @@
   return toIdDeclInfo(Ptr)->RemoveDecl(D);
 }
 
-/// begin - Returns an iterator for decls with name 'Name', starting at
-/// declaration context 'Ctx'. If 'LookInParentCtx' is true, it will walk the
-/// decls of parent declaration contexts too.
+/// begin - Returns an iterator for decls with name 'Name'.
 IdentifierResolver::iterator
-IdentifierResolver::begin(DeclarationName Name, const DeclContext *Ctx,
-                          bool LookInParentCtx) {
-  assert(Ctx && "null param passed");
-
+IdentifierResolver::begin(DeclarationName Name) {
   void *Ptr = Name.getFETokenInfo<void>();
   if (!Ptr) return end();
 
@@ -245,26 +240,11 @@
 
   IdDeclInfo::DeclsTy::iterator I = IDI->decls_end();
   if (I != IDI->decls_begin())
-    return iterator(I-1, LookInParentCtx);
+    return iterator(I-1);
   else // No decls found.
     return end();
 }
 
-/// PreIncIter - Do a preincrement when 'Ptr' is a BaseIter.
-void IdentifierResolver::iterator::PreIncIter() {
-  NamedDecl *D = **this;
-  void *InfoPtr = D->getDeclName().getFETokenInfo<void>();
-  assert(!isDeclPtr(InfoPtr) && "Decl with wrong id ?");
-  IdDeclInfo *Info = toIdDeclInfo(InfoPtr);
-
-  BaseIter I = getIterator();
-  if (I != Info->decls_begin())
-    *this = iterator(I-1, LookInParentCtx());
-  else // No more decls.
-    *this = end();
-}
-
-
 //===----------------------------------------------------------------------===//
 // IdDeclInfoMap Implementation
 //===----------------------------------------------------------------------===//