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/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 5ebec02..129967a 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -555,14 +555,9 @@
// Could be enum-constant, value decl, instance variable, etc.
Decl *D = 0;
- LookupResult Lookup;
- if (SS && !SS->isEmpty()) {
- DeclContext *DC = static_cast<DeclContext*>(SS->getScopeRep());
- if (DC == 0)
- return ExprError();
- Lookup = LookupDeclInContext(Name, Decl::IDNS_Ordinary, DC);
- } else
- Lookup = LookupDeclInScope(Name, Decl::IDNS_Ordinary, S);
+ if (SS && SS->isInvalid())
+ return ExprError();
+ LookupResult Lookup = LookupParsedName(S, SS, Name, LookupOrdinaryName);
if (Lookup.isAmbiguous()) {
DiagnoseAmbiguousLookup(Lookup, Name, Loc,
@@ -1519,9 +1514,7 @@
// than this.
LookupResult Result
= LookupQualifiedName(RDecl, DeclarationName(&Member),
- LookupCriteria(LookupCriteria::Member,
- /*RedeclarationOnly=*/false,
- getLangOptions().CPlusPlus));
+ LookupMemberName, false);
Decl *MemberDecl = 0;
if (!Result)
@@ -4030,9 +4023,9 @@
// Get the decl corresponding to this.
RecordDecl *RD = RC->getDecl();
FieldDecl *MemberDecl
- = dyn_cast_or_null<FieldDecl>(LookupDeclInContext(OC.U.IdentInfo,
- Decl::IDNS_Ordinary,
- RD, false).getAsDecl());
+ = dyn_cast_or_null<FieldDecl>(LookupQualifiedName(RD, OC.U.IdentInfo,
+ LookupMemberName)
+ .getAsDecl());
if (!MemberDecl)
return Diag(BuiltinLoc, diag::err_typecheck_no_member)
<< OC.U.IdentInfo << SourceRange(OC.LocStart, OC.LocEnd);