[PATCH] D113319: [clang-format] Improve require and concept handling
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 3 12:34:12 PST 2021
HazardyKnusperkeks added a comment.
Still WIP, not marking as changes planned, so that it pops up on your list and you can give me feedback. :)
================
Comment at: clang/lib/Format/Format.cpp:1213
+ // This is open for discussions! When will LLVM adapt C++20?
+ LLVMStyle.RequiresClausePositionForClasses = FormatStyle::RCPS_OwnLine;
+ LLVMStyle.RequiresClausePositionForFunctions = FormatStyle::RCPS_OwnLine;
----------------
What are your opinions on that?
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:435
-void UnwrappedLineParser::parseLevel(bool HasOpeningBrace) {
+/// \brief Parses a level, that is ???.
+/// \param HasOpeningBrace If that level is started by an opening brace.
----------------
Does anyone know for sure what the level is? I have an idea, but I'm not 100% sure yet.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2643
+ RequiresToken->setType(TT_RequiresClauseForFunctions);
+ // Else: We are a requires clause within a requires expression.
+ // The Semi is eaten by the caller, he also adds the unwrapped line.
----------------
Here I have an requires for a requires clause which did not get a type. Same as requires for requires expressions right now.
Should I tag all of them, even if I do not use the type right now?
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2727
-void UnwrappedLineParser::parseRequires() {
+/*void UnwrappedLineParser::parseRequires() {
assert(FormatTok->Tok.is(tok::kw_requires) && "'requires' expected");
----------------
This will be removed.
================
Comment at: clang/unittests/Format/FormatTest.cpp:22715-22717
+ " typename T::Bar;\n"
+ " { t.bar() } -> std::same_as<bool>;\n"
+ "}\n"
----------------
Should these lines be indented because requires is indented, or not?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113319/new/
https://reviews.llvm.org/D113319
More information about the cfe-commits
mailing list