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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 13 00:18:13 PST 2022


HazardyKnusperkeks resigned from this revision.
HazardyKnusperkeks 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!
----------------
owenpan wrote:
> 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.
One Warning that the option is going to be renamed.

The other warning regarding the code changes.


================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:466
+
+bool UnwrappedLineParser::parseLevel(bool HasOpeningBrace, IfStmtKind *IfKind) {
+  const bool IsPrecededByCommentOrPPDirective =
----------------
owenpan wrote:
> 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.
Yeah I'm out here.


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

https://reviews.llvm.org/D116316



More information about the cfe-commits mailing list