[PATCH] D94661: [clang-format] [PR19056] Add support for access modifiers indentation

Jakub Budiský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 14 02:07:58 PST 2021


Budovi created this revision.
Budovi added reviewers: MyDeveloperDay, rsmith.
Budovi added a project: clang-format.
Budovi requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Adds support for coding styles that make a separate indentation level for access modifiers, such as Code::Blocks or QtCreator.

The new option, `IndentAccessModifiers`, if enabled, forces the content inside classes, structs and unions (“records”) to be indented twice while removing a level for access modifiers. The value of `AccessModifierOffset` is disregarded in this case, aiming towards an ease of use.




The PR (https://bugs.llvm.org/show_bug.cgi?id=19056) had an implementation attempt by @MyDeveloperDay already (https://reviews.llvm.org/D60225) but I've decided to start from scratch. They differ in functionality, chosen approaches, and even the option name. The code tries to re-use the existing functionality to achieve this behavior, limiting possibility of breaking something else.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94661

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/lib/Format/UnwrappedLineParser.h
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94661.316589.patch
Type: text/x-patch
Size: 13109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210114/9371505a/attachment-0001.bin>


More information about the cfe-commits mailing list