diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-04 16:44:47 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-04 16:44:47 +0000 |
commit | 94eabf33559de43bd1d13ed297178bb45ddd610d (patch) | |
tree | d1b8086da44301dd7ba0499363e5dda330f238a8 /clang/lib/Sema/SemaExpr.cpp | |
parent | 7bad6d1d32ad67605e188c61f300ee71a7485891 (diff) | |
download | bcm5719-llvm-94eabf33559de43bd1d13ed297178bb45ddd610d.tar.gz bcm5719-llvm-94eabf33559de43bd1d13ed297178bb45ddd610d.zip |
Bring operator name lookup (as required for C++ operator overloading)
into the general name-lookup fold. This cleans up some ugly,
not-quite-working code in the handling of operator overloading.
llvm-svn: 63735
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index c1e4c0ecdd4..d408defbff4 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1190,7 +1190,8 @@ Sema::ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, // Build the candidate set for overloading OverloadCandidateSet CandidateSet; - AddOperatorCandidates(OverOp, S, Args, 2, CandidateSet); + if (AddOperatorCandidates(OverOp, S, OpLoc, Args, 2, CandidateSet)) + return ExprError(); // Perform overload resolution. OverloadCandidateSet::iterator Best; @@ -1281,7 +1282,9 @@ Sema::ActOnArraySubscriptExpr(Scope *S, ExprArg Base, SourceLocation LLoc, // to the candidate set. OverloadCandidateSet CandidateSet; Expr *Args[2] = { LHSExp, RHSExp }; - AddOperatorCandidates(OO_Subscript, S, Args, 2, CandidateSet); + if (AddOperatorCandidates(OO_Subscript, S, LLoc, Args, 2, CandidateSet, + SourceRange(LLoc, RLoc))) + return ExprError(); // Perform overload resolution. OverloadCandidateSet::iterator Best; @@ -3738,7 +3741,8 @@ Action::OwningExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc, // to the candidate set. OverloadCandidateSet CandidateSet; Expr *Args[2] = { lhs, rhs }; - AddOperatorCandidates(OverOp, S, Args, 2, CandidateSet); + if (AddOperatorCandidates(OverOp, S, TokLoc, Args, 2, CandidateSet)) + return ExprError(); // Perform overload resolution. OverloadCandidateSet::iterator Best; @@ -3840,8 +3844,9 @@ Action::OwningExprResult Sema::ActOnUnaryOp(Scope *S, SourceLocation OpLoc, // Add the appropriate overloaded operators (C++ [over.match.oper]) // to the candidate set. OverloadCandidateSet CandidateSet; - if (OverOp != OO_None) - AddOperatorCandidates(OverOp, S, &Input, 1, CandidateSet); + if (OverOp != OO_None && + AddOperatorCandidates(OverOp, S, OpLoc, &Input, 1, CandidateSet)) + return ExprError(); // Perform overload resolution. OverloadCandidateSet::iterator Best; |