[PATCH] D116316: [clang-format] Add an experimental option to remove optional control statement braces in LLVM C++ code

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 21:13:48 PST 2022


owenpan added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:3059
+  /// and ``while``) in C++ according to the LLVM coding style.
+  /// \warning
+  ///  This option will be renamed and expanded to support other styles!
----------------
HazardyKnusperkeks wrote:
> This should be two warning blocks.
Can you elaborate? I simply copied the format of the existing warning block. The alignment of the `\code` block below is off by 1 though.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:466
+
+bool UnwrappedLineParser::parseLevel(bool HasOpeningBrace, IfStmtKind *IfKind) {
+  const bool IsPrecededByCommentOrPPDirective =
----------------
HazardyKnusperkeks wrote:
> This should be an enum, a bool suggests that the return value is a failure/success indicator.
Most of the `parse...()` functions return `void` with no indication of pass/fail. Some of them return `bool`, e.g. `parseObjCProtocol()`, which doesn't indicate pass/fail according to the function header comment. I will add a similar comment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116316/new/

https://reviews.llvm.org/D116316



More information about the cfe-commits mailing list