mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-04 00:20:14 +00:00
[coroutines] Fix handling of dependent co_await in StmtProfiler.
Fix "Invalid operator call kind" error (llvm_unreachable) in DecodeOperatorCall when profiling a dependent co_await. Patch by Victor Zverovich! Differential Revision: https://reviews.llvm.org/D50002 llvm-svn: 338343
This commit is contained in:
parent
9164b9b16e
commit
6fff5c412b
@ -1277,7 +1277,6 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
|
||||
case OO_Arrow:
|
||||
case OO_Call:
|
||||
case OO_Conditional:
|
||||
case OO_Coawait:
|
||||
case NUM_OVERLOADED_OPERATORS:
|
||||
llvm_unreachable("Invalid operator call kind");
|
||||
|
||||
@ -1449,6 +1448,10 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
|
||||
|
||||
case OO_Subscript:
|
||||
return Stmt::ArraySubscriptExprClass;
|
||||
|
||||
case OO_Coawait:
|
||||
UnaryOp = UO_Coawait;
|
||||
return Stmt::UnaryOperatorClass;
|
||||
}
|
||||
|
||||
llvm_unreachable("Invalid overloaded operator expression");
|
||||
|
@ -66,6 +66,14 @@ int f2(T x) { // checks coawait_expr and coroutine_body_stmt
|
||||
co_return x; // checks coreturn_stmt with expr
|
||||
}
|
||||
|
||||
struct S {};
|
||||
S operator co_await(S) { return S(); }
|
||||
|
||||
template <typename T>
|
||||
int f3(T x) {
|
||||
co_await x; // checks dependent_coawait with overloaded co_await operator
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
Loading…
x
Reference in New Issue
Block a user