[PATCH] D110833: [clang-format] Refactor SpaceBeforeParens to add flags
Christian Rayroud via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 22 02:37:41 PDT 2021
crayroud added inline comments.
================
Comment at: clang/include/clang/Format/Format.h:3422
/// true: false:
- /// for (auto v : values) {} vs. for(auto v: values) {}
+ /// for (auto v : values) {} vs. for (auto v: values) {}
/// \endcode
----------------
HazardyKnusperkeks wrote:
> Please remove again. :)
I changed the documentation to have a space added or removed only before the for loop colon. Indeed the space after the for is handled by SpaceBeforeParens... and not SpaceBeforeRangeBasedForLoopColon. Why do you think it is better to keep it as before ?
================
Comment at: clang/lib/Format/Format.cpp:1221
LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements;
+ LLVMStyle.SpaceBeforeParensFlags.AfterControlStatements = true;
+ LLVMStyle.SpaceBeforeParensFlags.AfterOperators = true;
----------------
HazardyKnusperkeks wrote:
> Is this needed? Shouldn't the expand take care of that?
Indeed the expand takes care of that and it would be nice not to have to repeat it here.
I had to add it for the test FormatTest.ConfigurationRoundTripTest, as it is done for LLVMStyle.BraceWrapping.
What do you think is best ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110833/new/
https://reviews.llvm.org/D110833
More information about the cfe-commits
mailing list