#
1b750edd |
| 14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Make single-line if statements optional.
Now, "if (a) return;" is only allowed, if this option is set.
Also add a Chromium style which is currently identical to Google style except for this option.
Make single-line if statements optional.
Now, "if (a) return;" is only allowed, if this option is set.
Also add a Chromium style which is currently identical to Google style except for this option.
llvm-svn: 172431
show more ...
|
#
3e9218e5 |
| 14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix a bug in the line merging.
If the first line of a merge would exactly fit into the column limit, an unsigned overflow made us not break.
llvm-svn: 172426
|
#
2ab0d01a |
| 14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix bug that would lead to joining preprocessor directives.
Before: #include "a.h" #include "b.h" After: #include "a.h" #include "b.h" llvm-svn: 172424
|
#
39825eaf |
| 14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Put simple preprocessor directives on a single line.
Before: #define A \ A After: #define A A llvm-svn: 172423
|
#
25837aa6 |
| 14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Put short if statements on a single line.
Before: if (a) return; After: if (a) return;
Not yet sure, whether this is always desired, but we can add options and make this a style paramete
Put short if statements on a single line.
Before: if (a) return; After: if (a) return;
Not yet sure, whether this is always desired, but we can add options and make this a style parameter as we go along.
llvm-svn: 172413
show more ...
|
#
13f23e17 |
| 14-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve understanding post increment and decrement.
Before: (a->f()) ++; a[42] ++; After: (a->f())++; a[42]++; llvm-svn: 172400
|
#
116ba682 |
| 14-Jan-2013 |
Alexander Kornienko <alexfh@google.com> |
Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.
Summary: Added tests for clang-format diagnostics. Added DiagnosticConsumer argument to clang::format::reformat
Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.
Summary: Added tests for clang-format diagnostics. Added DiagnosticConsumer argument to clang::format::reformat().
Reviewers: klimek, djasper
Reviewed By: djasper
CC: cfe-commits, thakis, rafael.espindola
Differential Revision: http://llvm-reviews.chandlerc.com/D290
llvm-svn: 172399
show more ...
|
#
557811fe |
| 14-Jan-2013 |
Manuel Klimek <klimek@google.com> |
Adds some more tests for * and &.
While reviewing r172303 I noticed that I wasn't sure whether we still format those correctly and didn't see any tests.
llvm-svn: 172396
|
#
7769a904 |
| 14-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Add a test for bitfields.
They work fine, but this fifth use of colons (after labels, in ?:, in initalizer lists in constructors, in objc method expressions, and in bitfields) wasn't cove
Formatter: Add a test for bitfields.
They work fine, but this fifth use of colons (after labels, in ?:, in initalizer lists in constructors, in objc method expressions, and in bitfields) wasn't covered by tests yet.
llvm-svn: 172377
show more ...
|
#
942ee72a |
| 13-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Stronger respect the input codes line breaks wrt. comments.
clang-format should not change whether or not there is a line break before a line comment as this strongly influences the percieved bindin
Stronger respect the input codes line breaks wrt. comments.
clang-format should not change whether or not there is a line break before a line comment as this strongly influences the percieved binding.
User input: void f(int a, // b is awesome int b); void g(int a, // a is awesome int b); Before: void f(int a, // b is awesome int b); void g(int a, // a is awesome int b); After: <unchanged from input>
llvm-svn: 172361
show more ...
|
#
22cf4622 |
| 13-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Format unions like structs and classes.
Note that I don't know whether we should put {} on a single line in this case, but it is probably a theoretical issue as in practice such structs, classes or
Format unions like structs and classes.
Note that I don't know whether we should put {} on a single line in this case, but it is probably a theoretical issue as in practice such structs, classes or unions won't be empty.
Before: union A {} a; After: union A {} a; llvm-svn: 172355
show more ...
|
#
48cb3b97 |
| 13-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Always put a space after ",".
I am not aware of a case where that would be wrong. The specific case I am fixing are function parameters wrapped in parenthesis (e.g. in macros).
Before: function(a,(
Always put a space after ",".
I am not aware of a case where that would be wrong. The specific case I am fixing are function parameters wrapped in parenthesis (e.g. in macros).
Before: function(a,(b)); After: function(a, (b)); llvm-svn: 172351
show more ...
|
#
5ef433fc |
| 13-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Don't put spaces around hyphens in include paths.
Before: #include <a - a> After: #include <a-a> llvm-svn: 172350
|
#
ef906a9c |
| 13-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Improve identification of c-style casts.
A ")" before any of "=", "{" or ";" won't be a cast. This fixes issues with the formatting of unnamed parameters.
Before: void f(int *){} After: void f(int
Improve identification of c-style casts.
A ")" before any of "=", "{" or ";" won't be a cast. This fixes issues with the formatting of unnamed parameters.
Before: void f(int *){} After: void f(int *) {} llvm-svn: 172349
show more ...
|
#
2827a7ec |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Don't insert a space before unary operators after selector names.
Before: [color getRed: &r green: &g blue: &b alpha: &a];
Now: [color getRed:&r green:&g blue:&b alpha:&a];
llvm-svn
Formatter: Don't insert a space before unary operators after selector names.
Before: [color getRed: &r green: &g blue: &b alpha: &a];
Now: [color getRed:&r green:&g blue:&b alpha:&a];
llvm-svn: 172337
show more ...
|
#
5c8709bc |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Add a test for @selector in an ObjC method expression, which happens to work already.
llvm-svn: 172335
|
#
92c05391 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Remove debugging junk I accidentally landed in r172333.
llvm-svn: 172334
|
#
c9d73611 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Prefer breaking before ObjC selector names over breaking at their ':'
Before: if ((self = [super initWithContentRect:contentRect styleMask: styleMask backing:NSBacking
Formatter: Prefer breaking before ObjC selector names over breaking at their ':'
Before: if ((self = [super initWithContentRect:contentRect styleMask: styleMask backing:NSBackingStoreBuffered defer:YES])) {
Now: if ((self = [super initWithContentRect:contentRect styleMask:styleMask backing:NSBackingStoreBuffered defer:YES])) {
llvm-svn: 172333
show more ...
|
#
7b7877ad |
| 12-Jan-2013 |
Daniel Jasper <djasper@google.com> |
Fix incorrect comparison operator causing loooong formatting times.
llvm-svn: 172308
|
#
c7a56342 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Remove a redundant CurrentLineType check.
The containing if checks for this already. No functionality change.
llvm-svn: 172306
|
#
a7252d83 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: Initial support for formatting Objective-C method expressions. This follows the approach suggested
Formatter: Initial support for formatting Objective-C method expressions. This follows the approach suggested by djasper in PR14911: When a '[' is seen that's at the start of a line, follows a binary operator, or follows one of : [ ( return throw, that '[' and its closing ']' are marked as TT_ObjCMethodExpr and every ':' in that range that isn't part of a ternary ?: is marked as TT_ObjCMethodExpr as well.
Update the layout routines to not output spaces around ':' tokens that are marked TT_ObjCMethodExpr, and only allow breaking after such tokens, not before.
Before: [self adjustButton : closeButton_ ofKind : NSWindowCloseButton];
Now: [self adjustButton:closeButton_ ofKind:NSWindowCloseButton];
llvm-svn: 172304
show more ...
|
#
eee7b81a |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: * and & are binary operators before ( and [.
llvm-svn: 172303
|
#
5dafd4a7 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: * and & are binary operators after ) and ].
llvm-svn: 172302
|
#
63a54eb7 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: + and - after { are unary operators.
llvm-svn: 172301
|
#
4a5030c7 |
| 12-Jan-2013 |
Nico Weber <nicolasweber@gmx.de> |
Formatter: add a test for :? in []
llvm-svn: 172289
|