[PATCH] D50002: [coroutines] Fix handling of dependent co_await in StmtProfiler
Victor Zverovich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 30 12:24:01 PDT 2018
vitaut created this revision.
vitaut added reviewers: rsmith, GorNishanov, EricWF.
Herald added subscribers: cfe-commits, modocache.
Fix "Invalid operator call kind" error (`llvm_unreachable`) in
`DecodeOperatorCall` when compiling the following example with `-emit-pch`:
struct S {};
S operator co_await(S) { return S(); }
template <typename T>
int f3(T x) {
co_await x;
}
Add the example to PCH test cases.
Repository:
rC Clang
https://reviews.llvm.org/D50002
Files:
lib/AST/StmtProfile.cpp
test/PCH/coroutines.cpp
Index: test/PCH/coroutines.cpp
===================================================================
--- test/PCH/coroutines.cpp
+++ test/PCH/coroutines.cpp
@@ -66,6 +66,14 @@
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
Index: lib/AST/StmtProfile.cpp
===================================================================
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1277,7 +1277,6 @@
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 @@
case OO_Subscript:
return Stmt::ArraySubscriptExprClass;
+
+ case OO_Coawait:
+ UnaryOp = UO_Coawait;
+ return Stmt::UnaryOperatorClass;
}
llvm_unreachable("Invalid overloaded operator expression");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50002.158045.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180730/12949d4e/attachment.bin>
More information about the cfe-commits
mailing list