[PATCH] D116229: [clang-format] Add option to align pointers in C style casts differently

Gabriel Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 23 10:46:19 PST 2021


yodaldevoid created this revision.
yodaldevoid added reviewers: HazardyKnusperkeks, MyDeveloperDay, curdeius, owenpan.
yodaldevoid requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

I personally prefer that pointers are aligned to the right in most cases to avoid problems when multiple variables are declared at once. That said, I prefer left alignment in C style casts to avoid the extra space and because there is no chance of the sorts of problems you see in declarations. This setting supports people with preferences like mine.

Currently this affects the alignment of both pointers and references in C style casts. If someone wanted to affect references separately then a separate setting for that, similar to ReferenceAlignmet, could be added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116229

Files:
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/TokenAnnotator.h
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116229.396054.patch
Type: text/x-patch
Size: 7476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211223/fa1908ca/attachment.bin>


More information about the cfe-commits mailing list