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/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 1870a8f..24f7531 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1375,8 +1375,8 @@
// original-namespace-definition is the name of the namespace. Subsequently
// in that declarative region, it is treated as an original-namespace-name.
- Decl *PrevDecl = LookupDeclInScope(II, Decl::IDNS_Ordinary, DeclRegionScope,
- /*LookupInParent=*/false);
+ Decl *PrevDecl = LookupName(DeclRegionScope, II, LookupOrdinaryName,
+ true);
if (NamespaceDecl *OrigNS = dyn_cast_or_null<NamespaceDecl>(PrevDecl)) {
// This is an extended namespace definition.
@@ -1437,14 +1437,7 @@
// FIXME: This still requires lot more checks, and AST support.
// Lookup namespace name.
- LookupCriteria Criteria(LookupCriteria::Namespace, /*RedeclarationOnly=*/false,
- /*CPlusPlus=*/true);
- Decl *NS = 0;
- if (SS.isSet())
- NS = LookupQualifiedName(static_cast<DeclContext*>(SS.getScopeRep()),
- NamespcName, Criteria);
- else
- NS = LookupName(S, NamespcName, Criteria);
+ Decl *NS = LookupParsedName(S, &SS, NamespcName, LookupNamespaceName, false);
if (NS) {
assert(isa<NamespaceDecl>(NS) && "expected namespace decl");
@@ -2179,7 +2172,7 @@
// FIXME: Need to check for abstract classes.
IdentifierInfo *II = D.getIdentifier();
- if (Decl *PrevDecl = LookupDeclInScope(II, Decl::IDNS_Ordinary, S)) {
+ if (Decl *PrevDecl = LookupName(S, II, LookupOrdinaryName)) {
// The scope should be freshly made just for us. There is just no way
// it contains any previous declaration.
assert(!S->isDeclScope(PrevDecl));