[PATCH] clang-format: Add ability to align assignment operators

Matt Oakes oakesm9 at gmail.com
Fri Apr 3 08:30:18 PDT 2015


In Objective-C some style guides (including the one at my workplace) use a style where assignment operators are aligned, in an effort to increase code readability. This patch adds an option to the format library which allows this functionality. It is disabled by default for all the included styles, so it must be explicitly enabled.

The option will change code such as:

```
- (void)method {
    NSNumber *one = @1;
    NSNumber *twentyFive = @25;
}
```

to:

```
- (void)method {
    NSNumber *one        = @1;
    NSNumber *twentyFive = @25;
}
```

http://reviews.llvm.org/D8821

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

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8821.23221.patch
Type: text/x-patch
Size: 8524 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150403/ea9728aa/attachment.bin>


More information about the cfe-commits mailing list