[PATCH] D50002: [coroutines] Fix handling of dependent co_await in StmtProfiler

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 30 17:48:14 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL338343: [coroutines] Fix handling of dependent co_await in StmtProfiler. (authored by rsmith, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D50002?vs=158045&id=158145#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50002

Files:
  cfe/trunk/lib/AST/StmtProfile.cpp
  cfe/trunk/test/PCH/coroutines.cpp


Index: cfe/trunk/lib/AST/StmtProfile.cpp
===================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp
+++ cfe/trunk/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");
Index: cfe/trunk/test/PCH/coroutines.cpp
===================================================================
--- cfe/trunk/test/PCH/coroutines.cpp
+++ cfe/trunk/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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50002.158145.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180731/ce6984f0/attachment.bin>


More information about the cfe-commits mailing list