diff options
author | John McCall <rjmccall@apple.com> | 2009-10-09 21:13:30 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-09 21:13:30 +0000 |
commit | f36e02d4aff98bf2e52e342e0038d4172fbb5e64 (patch) | |
tree | de0e84cc5c69c3749a01794221565dcbe5d22614 /lib/Sema/SemaExprCXX.cpp | |
parent | d7e5bdb23c6ba2786cf94788c9af555e2c1276ce (diff) |
Refactor the LookupResult API to simplify most common operations. Require users to
pass a LookupResult reference to lookup routines. Call out uses which assume a single
result.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 86a5ad88cc..d746237563 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -69,8 +69,9 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, TyOrExpr = GetTypeFromParser(TyOrExpr).getAsOpaquePtr(); IdentifierInfo *TypeInfoII = &PP.getIdentifierTable().get("type_info"); - Decl *TypeInfoDecl = LookupQualifiedName(StdNamespace, TypeInfoII, - LookupTagName); + LookupResult R; + LookupQualifiedName(R, StdNamespace, TypeInfoII, LookupTagName); + Decl *TypeInfoDecl = R.getAsSingleDecl(Context); RecordDecl *TypeInfoRecordDecl = dyn_cast_or_null<RecordDecl>(TypeInfoDecl); if (!TypeInfoRecordDecl) return ExprError(Diag(OpLoc, diag::err_need_header_before_typeid)); @@ -589,14 +590,17 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, DeclarationName Name, Expr** Args, unsigned NumArgs, DeclContext *Ctx, bool AllowMissing, FunctionDecl *&Operator) { - LookupResult R = LookupQualifiedName(Ctx, Name, LookupOrdinaryName); - if (!R) { + LookupResult R; + LookupQualifiedName(R, Ctx, Name, LookupOrdinaryName); + if (R.empty()) { if (AllowMissing) return false; return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call) << Name << Range; } + // FIXME: handle ambiguity + OverloadCandidateSet Candidates; for (LookupResult::iterator Alloc = R.begin(), AllocEnd = R.end(); Alloc != AllocEnd; ++Alloc) { @@ -868,8 +872,8 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, = cast<CXXRecordDecl>(Pointee->getAs<RecordType>()->getDecl()); // Try to find operator delete/operator delete[] in class scope. - LookupResult Found = LookupQualifiedName(Record, DeleteName, - LookupOrdinaryName); + LookupResult Found; + LookupQualifiedName(Found, Record, DeleteName, LookupOrdinaryName); // FIXME: Diagnose ambiguity properly assert(!Found.isAmbiguous() && "Ambiguous delete/delete[] not handled"); for (LookupResult::iterator F = Found.begin(), FEnd = Found.end(); |