[PATCH] D65044: [Format] Add option to enable coroutines keywords

Brian Gesiak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 20 17:37:42 PDT 2019


modocache created this revision.
modocache added reviewers: rsmith, sammccall, Typz, klimek.
Herald added a subscriber: EricWF.
Herald added a project: clang.

In a previous change, https://reviews.llvm.org/D65043, I allowed users to
explicitly opt-in to formatting according to the C++20 standard. Should
a user choose to do so, the formatter would treat coroutine keywords
such as `co_yield` as keywords, whereas under the C++11 standard they
would be treated as identifiers.

However, this excludes a use case in which, for example, a user's codebase
is written using the C++17 standard, but with an explicit opt-in to
`-fcoroutines-ts`. This commit adds an option to clang-format to allow
formatting under an arbitrary standard, but with `co_yield` and friends
treated as keywords.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65044

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65044.210979.patch
Type: text/x-patch
Size: 4073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190721/00a6bb9b/attachment.bin>


More information about the cfe-commits mailing list