[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 31 02:19:35 PDT 2016
ABataev added inline comments.
================
Comment at: include/clang/AST/ExprCXX.h:4265
+ CoawaitDependentExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op,
+ UnresolvedSet<16> OperatorCandidates)
+ : Expr(CoawaitDependentExprClass, Ty, VK_RValue, OK_Ordinary, true, true,
----------------
`const UnresolvedSetImpl &`
================
Comment at: include/clang/AST/ExprCXX.h:4266-4267
+ UnresolvedSet<16> OperatorCandidates)
+ : Expr(CoawaitDependentExprClass, Ty, VK_RValue, OK_Ordinary, true, true,
+ true, Op->containsUnexpandedParameterPack()),
+ KeywordLoc(KeywordLoc), Operand(Op),
----------------
Add comments with the name of params on `true` args
================
Comment at: include/clang/AST/ExprCXX.h:4277
+
+ Expr *getOperand() const { return static_cast<Expr *>(Operand); }
+
----------------
s/static_cast<Expr *>/cast<Expr>/g
================
Comment at: include/clang/AST/ExprCXX.h:4279
+
+ const UnresolvedSet<16> &getOperatorCandidates() const {
+ return CoawaitOperatorCandidates;
----------------
`const UnresolvedSetImpl &`
================
Comment at: include/clang/Sema/Sema.h:8040
+ BuildCoawaitDependentExpr(SourceLocation KwLoc, Expr *E,
+ const UnresolvedSet<16> &CoawaitOperatorCandidates);
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E);
----------------
`const UnresolvedSetImpl &`
================
Comment at: lib/Sema/SemaCoroutine.cpp:82
CXXRecordDecl *RD = CoroTrait->getAsCXXRecordDecl();
assert(RD && "specialization of class template is not a class?");
----------------
`auto *RD`
================
Comment at: lib/Sema/SemaCoroutine.cpp:237-244
+static UnresolvedSet<16> lookupOperatorCoawaitCall(Sema &SemaRef, Scope *S,
+ SourceLocation Loc,
+ Expr *E) {
UnresolvedSet<16> Functions;
SemaRef.LookupOverloadedOperatorName(OO_Coawait, S, E->getType(), QualType(),
Functions);
+ return Functions;
----------------
Maybe it is better to add an argument `UnresolvedSetImpl &OpCandidates`?
================
Comment at: lib/Sema/SemaCoroutine.cpp:250
+ Expr *E,
+ const UnresolvedSet<16> &Functions) {
return SemaRef.CreateOverloadedUnaryOp(Loc, UO_Coawait, Functions, E);
----------------
`const UnresolvedSetImpl &Functions`
================
Comment at: lib/Sema/SemaCoroutine.cpp:301
+ SourceLocation Loc, StringRef Name,
+ MutableArrayRef<Expr *> Args) {
+ assert(Coroutine->CoroutinePromise && "no promise for coroutine");
----------------
Why do you need `MutableArrayRef<Epr *>`, when `ArrayRef<Expr *>` is enough? Also `buildMemberCall` must be changed
================
Comment at: lib/Sema/SemaCoroutine.cpp:331
+ExprResult
+Sema::BuildCoawaitDependentExpr(SourceLocation Loc, Expr *E,
+ const UnresolvedSet<16> &Candidates) {
----------------
s/BuildCoawaitDependentExpr/buildCoawaitDependentExpr/g
================
Comment at: lib/Sema/SemaCoroutine.cpp:332
+Sema::BuildCoawaitDependentExpr(SourceLocation Loc, Expr *E,
+ const UnresolvedSet<16> &Candidates) {
+ auto *Coroutine = checkCoroutineContext(*this, Loc, "co_await");
----------------
`const UnresolvedSetImpl &`
================
Comment at: lib/Sema/SemaCoroutine.cpp:352
+
+ CXXRecordDecl *RD = Promise->getType()->getAsCXXRecordDecl();
+ if (lookupMember(*this, "await_transform", RD, Loc)) {
----------------
`auto *RD`
================
Comment at: lib/Sema/TreeTransform.h:1327
+ Expr *Result,
+ const UnresolvedSet<16> &Candidates) {
+ return getSema().BuildCoawaitDependentExpr(CoawaitLoc, Result, Candidates);
----------------
`const UnresolvedSetImpl &`
https://reviews.llvm.org/D26057
More information about the cfe-commits
mailing list