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/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp
index cf93571..c77325f 100644
--- a/lib/Sema/SemaCXXScopeSpec.cpp
+++ b/lib/Sema/SemaCXXScopeSpec.cpp
@@ -36,10 +36,7 @@
                                                     SourceLocation IdLoc,

                                                     SourceLocation CCLoc,

                                                     IdentifierInfo &II) {

-  Decl *SD = LookupParsedName(S, SS, &II,

-                              LookupCriteria(LookupCriteria::NestedNameSpecifier, 

-                                             /*RedeclarationOnly=*/false, 

-                                             /*CPlusPlus=*/true));

+  Decl *SD = LookupParsedName(S, &SS, &II, LookupNestedNameSpecifierName);

 

   if (SD) {

     if (TypedefDecl *TD = dyn_cast<TypedefDecl>(SD)) {

@@ -60,10 +57,7 @@
   // ordinary name lookup, which can help us produce better error

   // messages.

   if (!SD)

-    SD = LookupParsedName(S, SS, &II,

-                          LookupCriteria(LookupCriteria::Ordinary,

-                                         /*RedeclarationOnly=*/false, 

-                                         /*CPlusPlus=*/true));

+    SD = LookupParsedName(S, &SS, &II, LookupOrdinaryName);

   unsigned DiagID;

   if (SD)

     DiagID = diag::err_expected_class_or_namespace;