Refactor Sema::LookupDecl() into 2 functions: LookupDeclInScope() and LookupDeclInContext().
The previous interface was very confusing. This is much more explicit, which will be easier to understand/optimize/convert.
The plan is to eventually deprecate both of these functions. For now, I'm focused on performance.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63256 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 064b851..2eb4605 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -561,9 +561,9 @@
DeclContext *DC = static_cast<DeclContext*>(SS->getScopeRep());
if (DC == 0)
return ExprError();
- Lookup = LookupDecl(Name, Decl::IDNS_Ordinary, S, DC);
+ Lookup = LookupDeclInContext(Name, Decl::IDNS_Ordinary, DC);
} else
- Lookup = LookupDecl(Name, Decl::IDNS_Ordinary, S);
+ Lookup = LookupDeclInScope(Name, Decl::IDNS_Ordinary, S);
if (Lookup.isAmbiguous()) {
DiagnoseAmbiguousLookup(Lookup, Name, Loc,
@@ -4031,9 +4031,9 @@
// Get the decl corresponding to this.
RecordDecl *RD = RC->getDecl();
FieldDecl *MemberDecl
- = dyn_cast_or_null<FieldDecl>(LookupDecl(OC.U.IdentInfo,
+ = dyn_cast_or_null<FieldDecl>(LookupDeclInContext(OC.U.IdentInfo,
Decl::IDNS_Ordinary,
- S, RD, false).getAsDecl());
+ RD, false).getAsDecl());
if (!MemberDecl)
return Diag(BuiltinLoc, diag::err_typecheck_no_member)
<< OC.U.IdentInfo << SourceRange(OC.LocStart, OC.LocEnd);