summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: Fix assertion when trying to build a nullptr StringRef.Daniel Jasper2015-01-191-0/+1
| | | | llvm-svn: 226448
* clang-format: Fix endless loop on incomplete try-catch-block.Daniel Jasper2015-01-191-1/+1
| | | | llvm-svn: 226447
* clang-format: [Java] Support try blocks with resources.Daniel Jasper2015-01-141-0/+4
| | | | | | | | | | | | | | | Before: try (SomeResource rs = someFunction()) { Something(); } After: try (SomeResource rs = someFunction()) { Something(); } llvm-svn: 225973
* clang-format: Fix formatting of inline asm.Daniel Jasper2015-01-121-2/+2
| | | | | | | | | Specifically, adjust the leading "__asm {" and trailing "}" while still leaving the assembly inside it alone. This fixes llvm.org/PR22190. llvm-svn: 225623
* clang-format: [Java] Fix incorrect recognition of annonymous classes.Daniel Jasper2015-01-041-2/+3
| | | | | | | | | | | | | | | | Before: someFunction(new Runnable() { public void run() { System.out.println(42); } }); After: someFunction(new Runnable() { public void run() { System.out.println(42); } }); llvm-svn: 225142
* clang-format: Support commas in lambda return types.Daniel Jasper2014-12-081-0/+1
| | | | | | | | | | Before: auto next_pair = [](A * a) -> pair<A*, A*>{}; After: auto next_pair = [](A* a) -> pair<A*, A*>{}; llvm-svn: 223652
* clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.Daniel Jasper2014-12-051-1/+2
| | | | | | This fixes llvm.org/PR21756. llvm-svn: 223458
* clang-format: [Java] Support Foo.class;Daniel Jasper2014-11-261-0/+7
| | | | | | | | | | | | | Before: SomeClass. class.getName(); After: SomeClass.class.getName(); This fixes llvm.org/PR21665. llvm-svn: 222813
* clang-format: [JS] Support Closure's module statements.Daniel Jasper2014-11-231-0/+2
| | | | | | | 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: Understand more lambda return types.Daniel Jasper2014-11-211-0/+3
| | | | | | | | | | Before: auto a = [&b, c ](D * d) -> D * {} After: auto a = [&b, c](D* d) -> D* {} llvm-svn: 222534
* clang-format: [Java] Accept generic types in enum declarationDaniel Jasper2014-11-191-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Before: enum Foo implements Bar<X, Y> { ABC { ... } , CDE { ... }; } After: enum Foo implements Bar<X, Y> { ABC { ... }, CDE { ... }; } Patch by Harry Terkelsen. llvm-svn: 222394
* clang-format: [Java] Support Java enums.Daniel Jasper2014-11-131-18/+85
| | | | | | | In Java, enums can contain a class body and enum constants can have arguments as well as class bodies. Support most of that. llvm-svn: 221895
* clang-format: Improve free-standing macro detection.Daniel Jasper2014-11-051-10/+7
| | | | | | | | | | | | Before: SOME_WEIRD_LOG_MACRO << "Something long enough to cause a line break"; After: SOME_WEIRD_LOG_MACRO << "Something long enough to cause a line break"; llvm-svn: 221338
* clang-format: Use identifier table for keywords in other languages.Daniel Jasper2014-11-041-7/+7
| | | | | | | | | Slightly easier to write, more efficient and prevents bugs by misspelling them. No functional changes intended. llvm-svn: 221259
* Revert "clang-format: [Java] Allow trailing semicolons after enums."Daniel Jasper2014-11-031-3/+4
| | | | | | | | | This reverts commit b5bdb2ef59ab922bcb4d6e843fffaee1f7f68a8c. This doesn't really seem necessary on second though and causes problems with C++ enum formatting. llvm-svn: 221158
* clang-format: [Java] Allow trailing semicolons after enums.Daniel Jasper2014-11-031-4/+3
| | | | | | | | | | | Before: enum SomeThing { ABC, CDE } ; After: enum SomeThing { ABC, CDE }; llvm-svn: 221125
* clang-format: Fix false positive in lambda detection.Daniel Jasper2014-11-021-1/+2
| | | | | | | | | | | | Before: delete [] a -> b; After: delete[] a->b; This fixes part of llvm.org/PR21419. llvm-svn: 221114
* clang-format: [Java] Support enums without trailing semicolon.Daniel Jasper2014-11-021-0/+3
| | | | | | | | | | | | | | | | | | | Before: class SomeClass { enum SomeThing { ABC, CDE } void f() { } } After: class SomeClass { enum SomeThing { ABC, CDE } void f() { } } This fixed llvm.org/PR21458. llvm-svn: 221113
* clang-format: [Java] Support try/catch/finally blocks.Daniel Jasper2014-11-021-1/+2
| | | | llvm-svn: 221104
* clang-format: [Java] Don't break after extends/implements.Daniel Jasper2014-11-021-4/+4
| | | | | | | | | | | | Before: abstract class SomeClass extends SomeOtherClass implements SomeInterface {} After: abstract class SomeClass extends SomeOtherClass implements SomeInterface {} llvm-svn: 221103
* clang-format: [Java] Support extending inner classes.Daniel Jasper2014-10-211-3/+4
| | | | | | | | | | | Before: class A extends B .C {} After: class A extends B.C {} llvm-svn: 220280
* clang-format: Basic support for Java.Daniel Jasper2014-09-151-1/+7
| | | | llvm-svn: 217759
* clang-format: [JS] Better support for empty function literals.Daniel Jasper2014-09-051-0/+7
| | | | | | | | | | Before: SomeFunction(function(){}); After: SomeFunction(function() {}); llvm-svn: 217236
* clang-format: Address review comments of r216501.Daniel Jasper2014-08-271-2/+1
| | | | llvm-svn: 216565
* clang-format: Don't butcher __asm blocks.Daniel Jasper2014-08-261-0/+15
| | | | | | | | Instead completely cop out of formatting them for now. This fixes llvm.org/PR20618. llvm-svn: 216501
* Fixes bug 20587 - Add K&R break before braces styleRoman Kashitsyn2014-08-111-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: http://llvm.org/bugs/show_bug.cgi?id=20587 Added K&R style. It could be enabled by the following option: ``` BreakBeforeBraces: KernighanRitchie ``` This style is like `Attach`, but break *only* before function declarations. As I can see, no additional logic required to support this style, any style different from other styles automagically satisfies K&R. Reviewers: djasper Reviewed By: djasper Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D4837 llvm-svn: 215354
* Use std::unique_ptr to handle transient ownership of UnwrappedLine in ↵David Blaikie2014-08-091-6/+5
| | | | | | ScopedLineState llvm-svn: 215294
* clang-format: Break before 'else' in Stroustrup style.Daniel Jasper2014-08-051-0/+2
| | | | | | | | | Seems to be the desired thing to do according to: http://www.stroustrup.com/Programming/PPP-style-rev3.pdf Patch by Jarkko Hietaniemi, thank you! llvm-svn: 214857
* clang-format: Understand parameter pack initialization.Daniel Jasper2014-08-041-1/+1
| | | | | | | | | | Before: Constructor(A... a) : a_(X<A> { std::forward<A>(a) }...) {} After: Constructor(A... a) : a_(X<A>{std::forward<A>(a)}...) {} llvm-svn: 214720
* Fix parsing of classes where the class name is an absolute nested name ↵Manuel Klimek2014-07-311-4/+2
| | | | | | specifier. llvm-svn: 214393
* clang-format: [JS] support free-standing functions again.Daniel Jasper2014-06-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | This worked initially but was broken by r210887. Before: function outer1(a, b) { function inner1(a, b) { return a; } inner1(a, b); } function outer2(a, b) { function inner2(a, b) { return a; } inner2(a, b); } After: function outer1(a, b) { function inner1(a, b) { return a; } inner1(a, b); } function outer2(a, b) { function inner2(a, b) { return a; } inner2(a, b); } Thanks to Adam Strzelecki for working on this. llvm-svn: 212038
* clang-format: [JS] Understand named function literals.Daniel Jasper2014-06-131-0/+5
| | | | | | | | | | | | | | | | | | | Before: return {a: function SomeFunction(){// ... return 1; } } ; After: return { a: function SomeFunction() { // ... return 1; } }; llvm-svn: 210887
* clang-format: Support variadic lambda captures.Daniel Jasper2014-06-101-0/+2
| | | | | | | | | | Before: return [ i, args... ]{}; After: return [i, args...] {}; llvm-svn: 210514
* clang-format: Fix braced list detection.Daniel Jasper2014-05-221-2/+6
| | | | | | | | | | | | | Before: static_assert(std::is_integral<int> {} + 0, ""); int a = std::is_integral<int> {} + 0; After: static_assert(std::is_integral<int>{} + 0, ""); int a = std::is_integral<int>{} + 0; llvm-svn: 209431
* clang-format: Fix incorrect braced init identification.Daniel Jasper2014-05-221-1/+2
| | | | | | | | | | | | | | | | | | | | Before: int foo(int i) { return fo1 {} (i); } int foo(int i) { return fo1 {} (i); } After: int foo(int i) { return fo1{}(i); } int foo(int i) { return fo1{}(i); } This fixes llvm.org/PR19812. llvm-svn: 209428
* clang-format: Fix incorrect macro call detection.Daniel Jasper2014-05-211-1/+3
| | | | | | | | | | | | | In: struct A { A() noexcept(....) {} }; 'A()' is not a macro call. This fixes llvm.org/PR19814. llvm-svn: 209294
* clang-format: [JS] Understand top-level function literals properly.Daniel Jasper2014-05-201-0/+4
| | | | llvm-svn: 209205
* clang-format: Fix bug introduced by r208392.Daniel Jasper2014-05-091-11/+9
| | | | | | Also run clang-format over clang-format's files. llvm-svn: 208409
* [C++11] Use 'nullptr'.Craig Topper2014-05-091-6/+6
| | | | llvm-svn: 208392
* clang-format: Initial support for try-catch.Daniel Jasper2014-05-081-0/+73
| | | | | | | | | | Most of this patch was created by Alexander Rojas in http://reviews.llvm.org/D2555 Thank you! Synced and addressed review comments. llvm-svn: 208302
* clang-format: [JS] support closures in container literals.Daniel Jasper2014-05-081-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Before: return {body: {setAttribute: function(key, val) {this[key] = val; } , getAttribute : function(key) { return this[key]; } , style : { direction: '' } } } ; After: return { body: { setAttribute: function(key, val) { this[key] = val; }, getAttribute: function(key) { return this[key]; }, style: {direction: ''} } }; llvm-svn: 208292
* clang-format: [JS] Don't indent in goog.scope blocks.Daniel Jasper2014-05-061-2/+20
| | | | | | | | | | | | | | | | Before: goog.scope(function() { var x = a.b; var y = c.d; }); // goog.scope After: goog.scope(function() { var x = a.b; var y = c.d; }); // goog.scope llvm-svn: 208088
* Fixes issue with Allman BreakBeforeBraces for Objective C @interfaceDinesh Dwivedi2014-05-021-2/+5
| | | | | | | | | | | | | | | | | | | Before: @interface BSApplicationController () { @private id _extraIvar; } @end After: @interface BSApplicationController () { @private id _extraIvar; } @end llvm-svn: 207849
* [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
* Format code around VCS conflict markers.Manuel Klimek2014-04-141-25/+44
| | | | | | | | | | | | | | | | | | | | | Now correctly formats: { int a; void f() { callme(some(parameter1, <<<<<<< text by the vcs parameter2), ||||||| text by the vcs parameter2), parameter3, ======= text by the vcs parameter2, parameter3), >>>>>>> text by the vcs otherparameter); } } llvm-svn: 206157
* Correctly handle escaped newlines when the next token starts without a space.Manuel Klimek2014-04-111-4/+9
| | | | | | | We will need this to correctly handle conflict markers inside macro definitions. llvm-svn: 206029
* clang-format: Fix false positive in braced list detection in protos.Daniel Jasper2014-04-101-12/+19
| | | | llvm-svn: 205954
* clang-format: Support configurable list of foreach-macros.Daniel Jasper2014-04-011-2/+9
| | | | | | | | This fixes llvm.org/PR17242. Patch by Brian Green, thank you! llvm-svn: 205307
* clang-format: Solve issues found and fixed by clang-tidy.Daniel Jasper2014-03-311-1/+1
| | | | llvm-svn: 205193
* clang-format: Recognize more ObjC blocks with parameters/return type.Daniel Jasper2014-03-281-2/+6
| | | | llvm-svn: 204990
OpenPOWER on IntegriCloud