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/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 7ecac00..f1b8617 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -32,9 +32,7 @@
       return 0;
     DC = static_cast<DeclContext*>(SS->getScopeRep());
   }
-  Decl *IIDecl = DC ? 
-                 LookupDeclInContext(&II, Decl::IDNS_Ordinary, DC, false) :
-                 LookupDeclInScope(&II, Decl::IDNS_Ordinary, S, false);
+  Decl *IIDecl = LookupParsedName(S, SS, &II, LookupOrdinaryName);
 
   if (IIDecl) {
     // FIXME: We need to represent templates via some kind of
@@ -96,7 +94,7 @@
   bool Invalid = false;
 
   if (ParamName) {
-    Decl *PrevDecl = LookupDeclInScope(ParamName, Decl::IDNS_Tag, S);
+    Decl *PrevDecl = LookupName(S, ParamName, LookupTagName);
     if (PrevDecl && PrevDecl->isTemplateParameter())
       Invalid = Invalid || DiagnoseTemplateParameterShadow(ParamNameLoc,
 							   PrevDecl);
@@ -132,7 +130,7 @@
 
   IdentifierInfo *ParamName = D.getIdentifier();
   if (ParamName) {
-    Decl *PrevDecl = LookupDeclInScope(ParamName, Decl::IDNS_Tag, S);
+    Decl *PrevDecl = LookupName(S, ParamName, LookupTagName);
     if (PrevDecl && PrevDecl->isTemplateParameter())
       Invalid = Invalid || DiagnoseTemplateParameterShadow(D.getIdentifierLoc(),
 							   PrevDecl);