[PATCH] Clang-format support for removing space before assignment operators

Aaron Wishnick aaron.s.wishnick at gmail.com
Fri Sep 13 07:12:32 PDT 2013


Thanks for the feedback! I've addressed those three issues, and the updated
patch is attached.


On Fri, Sep 13, 2013 at 4:12 AM, Daniel Jasper <djasper at google.com> wrote:

> You should be able to use "Tok.getPrecedence() == prec::Assignment"
> instead of the new IsTokenAssignment function. Also, please put the tests
> into "unittests/Format/FormatTest.cpp". We have plans to turn (some of)
> those into file-based tests, but for now, I'd like to keep
> formatting-specific tests together. Also, in addition to actually testing
> whether the style-configuration works as expected, there are also tests
> there which test whether the option can be successfully parsed from JSON
> (see how it is done for the other flags close to the bottom).
>
>
> On Fri, Sep 13, 2013 at 12:14 AM, Aaron Wishnick <
> aaron.s.wishnick at gmail.com> wrote:
>
>> My organization's coding standards include not putting a space before
>> assignment operators, e.g. "int a= 42;". In order for us to be able to use
>> clang-format, we need support for this.
>>
>> I've attached a patch that adds a new format style option,
>> "SpaceBeforeAssignmentOperators." All the existing hard-coded styles now
>> default to having it set to true. I've also included a test.
>>
>> Please let me know if this looks good, or if there's anything else I can
>> do.
>>
>> Thank you!
>> Aaron
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130913/9500d7cd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: space_before_assignment_operators.patch
Type: application/octet-stream
Size: 4435 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130913/9500d7cd/attachment.obj>


More information about the cfe-commits mailing list