[PATCH] D102730: [clang-format] Support custom If macros
Vitali Lovich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 27 12:56:52 PDT 2021
vlovich added inline comments.
================
Comment at: clang/include/clang/Format/Format.h:2983
/// \endcode
- SBPO_ControlStatementsExceptForEachMacros,
+ SBPO_ControlStatementsExceptControlMacros,
/// Put a space before opening parentheses only if the parentheses are not
----------------
HazardyKnusperkeks wrote:
> Why did you change this?
Per the discussion below.
> MyDeveloperDay
> I'll let you decide if you think we need another SBPO_XXX style?
> Me
> I thought about it but I wasn't was really sure how to add it in a way that would make sense. Do you think people would want to apply consistent SBPO styling for IF & FOREACH macros or want fine-grained control? If the former, then I can just check the foreach macro & maybe rename it to SBPO_ControlStatementsExceptMacros (maintaining the old name for back compat). If the latter, then it would seem like we need a separate boolean that controls whether SBPO_ControlStatements would apply?
> My gut is probably the "maintain consistency" option is fine for now so I've gone ahead & applied that change in the latest diff.
This felt like a simpler solution because otherwise you would either end up with SBPO_ControlStatementsForEachMacros, SBPO_ControlStatementsExceptIfAndForEachMacros, SBPO_ControlStatementsExceptIfMacros which just feels extremely confusing (& for now I'm assuming you'll want a similar style for ForEach & If macros). Arguably at the point where you want distinct SBPO styling of these control-like macros, you would be moved them out into a separate option since it's really orthogonal to the other settings.
Open to suggestions of course.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102730/new/
https://reviews.llvm.org/D102730
More information about the cfe-commits
mailing list