[PATCH] D156247: [Clang] Add a warning on uses of coroutine keywords

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 09:16:42 PDT 2023


ilya-biryukov created this revision.
Herald added a subscriber: ChuanqiXu.
Herald added a project: All.
ilya-biryukov requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang 17 will land with unaddressed coroutine bugs, see

- https://github.com/llvm/llvm-project/issues/58459
- https://github.com/llvm/llvm-project/issues/56301
- https://github.com/llvm/llvm-project/issues/57638
- https://github.com/llvm/llvm-project/issues/63818

It would be useful to have a way to use other C++20, but guarantee
coroutines are not used. This patch achieves it with a warning that
fires on `co_await`, `co_return` and `co_yield`.

The new warning is `-Wpre-c++20-compat-coroutines`, which is also
enabled with `-Wpre-c++20-compat-pedantic`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156247

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaCoroutine.cpp
  clang/test/SemaCXX/cxx20-coroutines-warning.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156247.544009.patch
Type: text/x-patch
Size: 5328 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230725/05ac9bc1/attachment.bin>


More information about the cfe-commits mailing list