r305498 - [coroutines] Remove pass-through operator co_await; Replace it with the input expression
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 15 13:00:54 PDT 2017
Author: ericwf
Date: Thu Jun 15 15:00:54 2017
New Revision: 305498
URL: http://llvm.org/viewvc/llvm-project?rev=305498&view=rev
Log:
[coroutines] Remove pass-through operator co_await; Replace it with the input expression
Reviewers: GorNishanov, rsmith
Reviewed By: GorNishanov
Differential Revision: https://reviews.llvm.org/D34216
Modified:
cfe/trunk/lib/CodeGen/CGCoroutine.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGCoroutine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCoroutine.cpp?rev=305498&r1=305497&r2=305498&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCoroutine.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCoroutine.cpp Thu Jun 15 15:00:54 2017
@@ -160,19 +160,6 @@ static LValueOrRValue emitSuspendExpress
bool ignoreResult, bool forLValue) {
auto *E = S.getCommonExpr();
- // FIXME: rsmith 5/22/2017. Does it still make sense for us to have a
- // UO_Coawait at all? As I recall, the only purpose it ever had was to
- // represent a dependent co_await expression that couldn't yet be resolved to
- // a CoawaitExpr. But now we have (and need!) a separate DependentCoawaitExpr
- // node to store unqualified lookup results, it seems that the UnaryOperator
- // portion of the representation serves no purpose (and as seen in this patch,
- // it's getting in the way). Can we remove it?
-
- // Skip passthrough operator co_await (present when awaiting on an LValue).
- if (auto *UO = dyn_cast<UnaryOperator>(E))
- if (UO->getOpcode() == UO_Coawait)
- E = UO->getSubExpr();
-
auto Binder =
CodeGenFunction::OpaqueValueMappingData::bind(CGF, S.getOpaqueValue(), E);
auto UnbindOnExit = llvm::make_scope_exit([&] { Binder.unbind(CGF); });
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=305498&r1=305497&r2=305498&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Jun 15 15:00:54 2017
@@ -12057,11 +12057,17 @@ ExprResult Sema::CreateBuiltinUnaryOp(So
}
break;
case UO_Extension:
- case UO_Coawait:
resultType = Input.get()->getType();
VK = Input.get()->getValueKind();
OK = Input.get()->getObjectKind();
break;
+ case UO_Coawait:
+ // It's unnessesary to represent the pass-through operator co_await in the
+ // AST; just return the input expression instead.
+ assert(!Input.get()->getType()->isDependentType() &&
+ "the co_await expression must be non-dependant before "
+ "building operator co_await");
+ return Input;
}
if (resultType.isNull() || Input.isInvalid())
return ExprError();
More information about the cfe-commits
mailing list