[PATCH] D65043: [Format] Add C++20 standard to style options
Brian Gesiak via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 26 08:22:50 PDT 2019
modocache marked 2 inline comments as done.
modocache added inline comments.
================
Comment at: clang/lib/Format/Format.cpp:2373
LangOpts.CPlusPlus17 = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
- LangOpts.CPlusPlus2a = Style.Standard == FormatStyle::LS_Cpp03 ? 0 : 1;
+ LangOpts.CPlusPlus2a = Style.Standard == FormatStyle::LS_Cpp20 ? 1 : 0;
LangOpts.LineComment = 1;
----------------
Quuxplusone wrote:
> Incidentally, these four lines seem like a great place to use `Style.Standard >= FormatStyle::LS_CppWhatever` (with a cast if necessary), unless that's against some style rule.
This has already been updated to do so in D65183.
================
Comment at: clang/unittests/Format/FormatTest.cpp:13815
+ verifyFormat("co_yield++ i;");
+ verifyFormat("co_yield ++i;", Cpp20);
+
----------------
Quuxplusone wrote:
> If you're going to test C++11's behavior here, please use `co_yield - 1;` or something else that might reasonably appear in a C++11 program. `co_yield++ i;` is not valid C++ (unless `i` is a macro, I guess).
`i` would be an iterator in this case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65043/new/
https://reviews.llvm.org/D65043
More information about the cfe-commits
mailing list