[PATCH] D150083: [clang-format] ObjCPropertyAttributeOrder to sort ObjC property attributes
Jared Grubb via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun May 7 21:16:19 PDT 2023
jaredgrubb added a comment.
Some implementation notes:
- The implementation was modeled after `QualifierAlignmentFixer` and `sortCppIncludes`.
- the additions to the `.bazel`/`.gn` build files was done naively based on searching for where "QualifierFixerTest" appeared in the repo; I can't really test these. It looks right, but it's a guess.
- I considered creating a top-level style similar to `QualifierAlignment/QualifierOrder`; that one has a few pre-canned values (`Leave, Left, Right, Custom`), where `Custom` opens up the style `QualifierOrder`, an array of qualifier names.
- Pro: we could create a `[Leave, LLVM]` that would set them in the same order the `DeclPrinter.cpp` would dump them
- Pro: users probably would like not having to think about 18 different attributes (I did try to document them in groups to make them easier to find)
- Con: I couldn't find any style guides that provide a "standard order", so I don't know any other pre-canned settings that wouldn't just be an opinion of my own personal style. If there are, let me know and that might add weight to going this route.
I don't like that there are 18 attributes that users _probably_ want to specify for the style, so having some shortcut seems helpful. Perhaps I could just document it that way so it's easy to copy-paste? I also considered making it possible to have an alias so the style would only need to have a handful of them to get full coverage (eg, if you specify `assign` in the style, then the tool would infer you also mean to imply that the similar attributes `retain, strong, copy, weak, unsafe_unretained` would occupy the same "slot" unless you also specify them explicitly).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150083/new/
https://reviews.llvm.org/D150083
More information about the cfe-commits
mailing list