summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: [JS] Support Closure's module statements.Daniel Jasper2014-11-231-2/+3
| | | | | | | These are like import statements and should not be line-wrapped. Minor restructuring of the handling of other import statements. llvm-svn: 222637
* clang-format: Use nested block special case for all languages.Daniel Jasper2014-11-211-23/+20
| | | | | | | | | | | | | | | | | | | Previously this was only used for JavaScript. Before: functionCall({ int i; int j; }, aaaa, bbbb, cccc); After: functionCall({ int i; int j; }, aaaa, bbbb, cccc); llvm-svn: 222531
* clang-format: [Java] Don't align after "return".Daniel Jasper2014-11-201-1/+2
| | | | | | | | | | | | | | | | | | Doesn't seem to be common practice in Java. Before: return aaaaaaaaaaaaaaaaaaa && bbbbbbbbbbbbbbbbbbb && ccccccccccccccccccc; After: return aaaaaaaaaaaaaaaaaaa && bbbbbbbbbbbbbbbbbbb && ccccccccccccccccccc; Patch by Harry Terkelsen. llvm-svn: 222424
* clang-format: Add option to disable alignment after opening bracketsDaniel Jasper2014-11-181-5/+8
| | | | | | | | | | | | | | Before: SomeFunction(parameter, parameter); After: SomeFunction(parameter, parameter); Patch by Harry Terkelsen, thank you! llvm-svn: 222284
* clang-format: Improve function parameter packing.Daniel Jasper2014-11-141-1/+2
| | | | | | | | | | | | | | | Before: void SomeLoooooooooooongFunction( std::unique_ptr<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbb); After: void SomeLoooooooooooongFunction( std::unique_ptr<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> aaaaaaaaaaaaaaaaaaaaaaaaaa, int bbbbbbbbbbbbb); llvm-svn: 221989
* clang-format: Improve indentation of comments in expressions.Daniel Jasper2014-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | Before: int i = (a) // comment + b; return aaaa == bbbb // comment ? aaaa : bbbb; After: int i = (a) // comment + b; return aaaa == bbbb // comment ? aaaa : bbbb; llvm-svn: 221985
* Revert "clang-format: [js] Updates to Google's JavaScript style."Daniel Jasper2014-11-051-1/+0
| | | | | | | | This reverts commit eefd2eaad43c5c2b17953ae7ed1e72b28e696f7b. Apparently, this change was a bit premature. llvm-svn: 221365
* clang-format: Use identifier table for keywords in other languages.Daniel Jasper2014-11-041-5/+6
| | | | | | | | | Slightly easier to write, more efficient and prevents bugs by misspelling them. No functional changes intended. llvm-svn: 221259
* clang-format: [Java] Fix class declaration formatting.Daniel Jasper2014-11-031-1/+3
| | | | | | | | | | | | | | | | Before: @SomeAnnotation() abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc { } After: @SomeAnnotation() abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc { } llvm-svn: 221121
* clang-format: [Java] Don't break after extends/implements.Daniel Jasper2014-11-021-0/+7
| | | | | | | | | | | | Before: abstract class SomeClass extends SomeOtherClass implements SomeInterface {} After: abstract class SomeClass extends SomeOtherClass implements SomeInterface {} llvm-svn: 221103
* clang-format: [Java] Improve line breaks around annotations.Daniel Jasper2014-10-311-3/+6
| | | | | | | | | | | | | | | | | Before: @SomeAnnotation("With some really looooooooooooooong text") private static final long something = 0L; void SomeFunction(@Nullable String something) {} After: @SomeAnnotation("With some really looooooooooooooong text") private static final long something = 0L; void SomeFunction(@Nullable String something) {} llvm-svn: 220984
* clang-format: [js] Updates to Google's JavaScript style.Daniel Jasper2014-10-311-0/+1
| | | | | | The style guide is changing.. llvm-svn: 220977
* clang-format: [ObjC] Add separate flag to control indentation in blocksDaniel Jasper2014-10-281-2/+2
| | | | | | | | | | Apparently, people are very much divided on what the "correct" indentation is. So, best to give them a choice. The new flag is called ObjCBlockIndentWidth and the default is now set to the same value as IndentWidth for the pre-defined styles. llvm-svn: 220784
* clang-format: Don't break after very short return types.Daniel Jasper2014-10-271-0/+6
| | | | | | | | | | | | | | Before: void SomeFunction(int parameter); After: void SomeFunction( int parameter); (Unless AlwaysBreakAfterDefinitionReturnType after type is set). llvm-svn: 220686
* clang-format: [Proto] Change formatting text-formatted options.Daniel Jasper2014-10-271-2/+1
| | | | | | | | | | | | | | Before: optional Type type = 1 [(mutate_options) = {vital : true abc : false}]; After: optional Type type = 1 [(mutate_options) = { vital : true abc : false }]; llvm-svn: 220679
* clang-format: [Java] Wrap after each function annotation.Daniel Jasper2014-10-211-1/+3
| | | | | | | | | | | Before: @Override public String toString() { .. } After: @Override public String toString() { .. } llvm-svn: 220274
* clang-format: Add option to control call argument bin-packing separatelyDaniel Jasper2014-10-091-5/+7
| | | | | | | This is desirable for the Chromium style guide: http://www.chromium.org/developers/coding-style llvm-svn: 219400
* clang-format: Fix bug with comments between non-trival parameters.Daniel Jasper2014-10-071-3/+4
| | | | | | | | | | | | | | Before: SomeFunction(a, a, // comment b + x); After: SomeFunction(a, a, // comment b + x); llvm-svn: 219209
* clang-format: [JS] Improve formatting of function literals in chainsDaniel Jasper2014-09-291-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before: getSomeLongPromise(.....) .then( function(value) { body(); body(); }) .thenCatch(function(error) { body(); body(); }); After: getSomeLongPromise(.....) .then(function(value) { body(); body(); }) .thenCatch(function(error) { body(); body(); }); llvm-svn: 218595
* clang-format: Undo r216377.Daniel Jasper2014-09-191-4/+3
| | | | | | It has proven to not be a food idea in many case. llvm-svn: 218107
* clang-format: Improve line breaks at function calls.Daniel Jasper2014-09-121-0/+12
| | | | | | | | | | | | | Before: EXPECT_CALL(SomeObject, SomeFunction(Parameter)).Times(2).WillRepeatedly( Return(SomeValue)); After: EXPECT_CALL(SomeObject, SomeFunction(Parameter)) .Times(2) .WillRepeatedly(Return(SomeValue)); llvm-svn: 217687
* clang-format: [JS] Format embedded function literals more efficently.Daniel Jasper2014-09-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: return { a: a, link: function() { f(); // }, link: function() { f(); // } }; After: return { a: a, link: function() { f(); // }, link: function() { f(); // } }; llvm-svn: 217238
* clang-format: Improve formatting of nested builder-type calls.Daniel Jasper2014-08-251-3/+4
| | | | | | | | | | | | Before: f(FirstToken->WhitespaceRange.getBegin().getLocWithOffset( First->LastNewlineOffset)); After: f(FirstToken->WhitespaceRange.getBegin() .getLocWithOffset(First->LastNewlineOffset)); llvm-svn: 216377
* clang-format: Fix indentation in multi-line placement new.Daniel Jasper2014-08-061-0/+3
| | | | | | | | | | | | | | Before: auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = new (aaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa)) typename aaaaaaaaaaaaaaaaaaaaaaaa(); After: auto aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = new (aaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa)) typename aaaaaaaaaaaaaaaaaaaaaaaa(); llvm-svn: 214964
* clang-format: [proto] Improve formatting of text-proto options.Daniel Jasper2014-07-281-1/+2
| | | | | | Initial patch and tests by Kaushik Sridharan, thank you! llvm-svn: 214084
* clang-format: Improve heuristic around avoiding bad line breaks.Daniel Jasper2014-07-151-1/+2
| | | | | | | | | | | Now, this can be properly formatted: static_cast<A< // B> *>( // ); Before, clang-format could end up, not formatting the code at all. llvm-svn: 213055
* clang-format: Add new option to indent wrapped function declarations.Daniel Jasper2014-07-091-2/+3
| | | | | | | | | Though not completely identical, make former IndentFunctionDeclarationAfterType change this flag for backwards compatibility (it is somewhat close in meaning and better the err'ing on an unknown config flag). llvm-svn: 212597
* clang-format: Revamp function declaration/definition indentation.Daniel Jasper2014-07-091-8/+7
| | | | | | | | | | | | | | Key changes: - Correctly (well ...) distinguish function declarations and variable declarations with ()-initialization. - Don't indent when breaking function declarations/definitions after the return type. - Indent variable declarations and typedefs when breaking after the type. This fixes llvm.org/PR17999. llvm-svn: 212591
* clang-format: [JS] Treat dict literals similar to objc method exprs.Daniel Jasper2014-06-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: return { link: function() { f(); // } }; return { a: a, link: function() { f(); // } } After: return { link: function() { f(); // } }; return { a: a, link: function() { f(); // } }; llvm-svn: 210537
* clang-format: Fix enum formatting with specific comment.Daniel Jasper2014-06-101-1/+3
| | | | | | | | | | | | | | | Before: enum Fruit { // APPLE, PEAR }; After: enum Fruit { // APPLE, PEAR }; llvm-svn: 210522
* clang-format: Handle multiline strings inside ternary expressions.Daniel Jasper2014-06-101-1/+2
| | | | | | | With AlwaysSplitBeforeMultilineStrings, clang-format would not find any valid solution. llvm-svn: 210513
* clang-format: Leave empty lines within UnwrappedLines.Daniel Jasper2014-06-041-4/+2
| | | | | | | | These are commonly used to structure things like enums or long braced lists. There doesn't seem to be a good reason to have the behavior in such structures be different from the behavior between statements. llvm-svn: 210183
* clang-format: Refactor indentation behavior for multiple nested blocks.Daniel Jasper2014-06-031-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a few oddities when formatting multiple nested JavaScript blocks, e.g.: Before: promise.then( function success() { doFoo(); doBar(); }, [], function error() { doFoo(); doBaz(); }); promise.then([], function success() { doFoo(); doBar(); }, function error() { doFoo(); doBaz(); }); After: promise.then( function success() { doFoo(); doBar(); }, [], function error() { doFoo(); doBaz(); }); promise.then([], function success() { doFoo(); doBar(); }, function error() { doFoo(); doBaz(); }); llvm-svn: 210097
* clang-format: Format array and dict literals similar to blocks.Daniel Jasper2014-05-281-45/+59
| | | | | | | | | | | | | | | | | | | | | | | Especially, reduce the amount of indentation if it doesn't increase readability. Before: NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithDictionary:@{ aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb : bbbbb, cccccccccccccccc : ccccccccccccccc }]; After: NSMutableDictionary* dictionary = [NSMutableDictionary dictionaryWithDictionary:@{ aaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbb : bbbbb, cccccccccccccccc : ccccccccccccccc }]; llvm-svn: 209720
* clang-format: Split up moveStateToNextToken.Daniel Jasper2014-05-261-120/+151
| | | | | | No functional changes intended. llvm-svn: 209626
* clang-format: Fix corner case working around one-per-line dict literals.Daniel Jasper2014-05-211-2/+4
| | | | | | | | | | | | | | | Before: var object_literal_with_long_name = { a: 'aaaaaaaaaaaaaaaaaa', b: 'bbbbbbbbbbbbbbbbbb' }; After: var object_literal_with_long_name = { a: 'aaaaaaaaaaaaaaaaaa', b: 'bbbbbbbbbbbbbbbbbb' }; llvm-svn: 209296
* clang-format: [JS] Support different function literal style.Daniel Jasper2014-05-211-2/+33
| | | | | | | | | | | | | | | | | Before: goog.array.forEach(array, function() { doSomething(); doSomething(); }, this); After: goog.array.forEach(array, function() { doSomething(); doSomething(); }, this); llvm-svn: 209291
* clang-format: Don't force line breaks in ObjC calls with ColumnLimit 0.Daniel Jasper2014-05-191-1/+1
| | | | | | | | | | | Before: [self.x a:b c:d]; Got reformatted toi (with ColumnLimit set to 0): [self.x a:b c:d]; llvm-svn: 209114
* clang-format: Fix bug introduced by r208392.Daniel Jasper2014-05-091-8/+5
| | | | | | Also run clang-format over clang-format's files. llvm-svn: 208409
* [C++11] Use 'nullptr'.Craig Topper2014-05-091-3/+3
| | | | llvm-svn: 208392
* clang-format: Cleanup redundant calculation of ParenLevel.Daniel Jasper2014-05-081-18/+16
| | | | | | No functional changes intended. llvm-svn: 208304
* clang-format: Fix corner cases for comments in if conditions.Daniel Jasper2014-05-071-2/+3
| | | | | | | | | | | | Before: if ( // a x + 3) { .. After: if ( // a x + 3) { .. llvm-svn: 208175
* clang-format: Fix import statements with ColumnLimit: 0Daniel Jasper2014-05-051-1/+1
| | | | | | These used to interact badly with AlwaysBreakBeforeMultilineStrings. llvm-svn: 207955
* Fix typo (first commit to test commit access).Dinesh Dwivedi2014-05-011-1/+1
| | | | llvm-svn: 207775
* clang-format: Don't bin-pack text-proto-formatted options.Daniel Jasper2014-04-291-0/+1
| | | | | | | | | | | | | | | Before: repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA, bbbbbbb: BBBB, bbbb: BBB}]; After: repeated double value = 1 [(aaaaaaa.aaaaaaaaa) = {aaaaaaaaaaaaaaaa: AAAAAAAAAA, bbbbbbb: BBBB, bbbb: BBB}]; llvm-svn: 207538
* clang-format: Allow single-line function in WebKit style.Daniel Jasper2014-04-291-2/+2
| | | | | | | | | | | Before: void f() { return; } After: void f() { return; } llvm-svn: 207527
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-2/+2
| | | | | | | | | | definition below all of the header #include lines, clang edition. If you want more details about this, you can see some of the commits to Debug.h in LLVM recently. This is just the clang section of a cleanup I've done for all uses of DEBUG_TYPE in LLVM. llvm-svn: 206849
* clang-format: Respect BinPackParameters in Cpp11BracedListStyle.Daniel Jasper2014-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | With BinPackParameters=false and Cpp11BracedListStyle=true (i.e. mostly for Chromium): Before: const Aaaaaa aaaaa = {aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk}; After: const Aaaaaa aaaaa = {aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk}; This fixes llvm.org/PR19359. I am not sure we'll want this in all cases in the long run, but I'll guess we'll get feedback on that. llvm-svn: 206458
* clang-format: Add special case to reduce indentaiton in streams.Daniel Jasper2014-04-161-2/+4
| | | | | | | | | | | | | | | | This is similar to how we treat assignments and seems to be generally desirable. Before: llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 206384
* Fix assertion when breaking string literals with tab characters.Alexander Kornienko2014-04-151-0/+6
| | | | | | | | | | | | | | Summary: Fixes http://llvm.org/PR19368 Reviewers: djasper, klimek Reviewed By: klimek CC: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D3379 llvm-svn: 206295
OpenPOWER on IntegriCloud