[PATCH] D120217: [clang-format] Add an option to insert braces after control statements
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 20 12:11:37 PST 2022
owenpan created this revision.
owenpan added reviewers: MyDeveloperDay, curdeius, HazardyKnusperkeks.
owenpan added a project: clang-format.
owenpan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This new option `InsertBraces` has been tested on `make clang` and `make check-clang`. It has almost zero overhead when turned off.
- Why this new patch?
Because of this comment <https://discourse.llvm.org/t/doubts-regarding-clang-format/58091/5>, I ran
https://reviews.llvm.org/D95168?id=322240 (the last diff before @MyDeveloperDay took over) on `make clang` and indeed it failed a lot.
- Why isn't this option an `enum` or a `struct`?
We plan to re-configure/re-package `RemoveBracesLLVM` to support other styles. After that, one can simply turn on `InsertBraces` and specify the suboptions of `RemoveBraces`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120217
Files:
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/FormatToken.h
clang/lib/Format/UnwrappedLineParser.cpp
clang/lib/Format/UnwrappedLineParser.h
clang/unittests/Format/FormatTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120217.410172.patch
Type: text/x-patch
Size: 15920 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220220/babcffe1/attachment.bin>
More information about the cfe-commits
mailing list