[PATCH] D65043: [Format] Add C++20 standard to style options
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 09:04:46 PDT 2019
MyDeveloperDay added inline comments.
================
Comment at: clang/lib/Format/Format.cpp:76
+ IO.enumCase(Value, "C++20", FormatStyle::LS_Cpp20);
IO.enumCase(Value, "Auto", FormatStyle::LS_Auto);
}
----------------
Prior to C++20 being confirmed and given the line 2373 being LangOpts.CPlusPlus2a, it feels a little wrong to introduce anything here other than Cpp2a into what is effectively the .clang-format file format.
In the rare event that Cpp2a becomes something other than 20, this would leave us with .clang-format files out there defining something that doesn't really exist, but regardless of the assignment of Cpp2a to what it might become
```
IO.enumCase(Value, "Cpp2a", FormatStyle::LS_Cpp2a);
```
will always be correct, meaning Clang-Format files with Cpp2a would be correct for whatever it became Cpp20 or Cpp21....
When 2a becomes something real, there will likely be a change in clang to change LangOptions.. this feels like the correct time to add
```
LS_Cpp20 ~= LS_Cpp2a
and
IO.enumCase(Value, "Cpp2a", FormatStyle::LS_Cpp20);
IO.enumCase(Value, "Cpp20", FormatStyle::LS_Cpp20);
IO.enumCase(Value, "C++20", FormatStyle::LS_Cpp20);
```
along with the corresponding changes to all uses of LS_Cpp2a upgraded to the correct version.
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