summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add missing include.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230910
* clang-format: [js] Support ES6 module exports.Daniel Jasper2015-02-191-5/+22
| | | | | | Patch by Martin Probst, thank you! llvm-svn: 229865
* clang-format: [js] Support ES6 module imports.Daniel Jasper2015-02-191-0/+18
| | | | | | Patch by Martin Probst. llvm-svn: 229863
* clang-format: [js] Do not fall through for JS structural elements.Daniel Jasper2015-02-191-1/+2
| | | | | | Patch by Martin Probst. Thank you. llvm-svn: 229862
* clang-format: [JS] Support classes.Daniel Jasper2015-02-181-3/+8
| | | | | | | | | | This adds support for JavaScript class definitions (again following TypeScript & AtScript style). This only required support for visibility modifiers in JS, everything else was already working. Patch by Martin Probst, thank you. llvm-svn: 229701
* clang-format: Correctly mark preprocessor lines in child blocks.Daniel Jasper2015-02-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | This prevents contracting: auto lambda = []() { int a = 2 #if A + 2 #endif ; }; into: auto lambda = []() { int a = 2 #if A + 2 #endif ; }; Which is obviously BAD. This fixes llvm.org/PR22496. llvm-svn: 228522
* clang-format: Format Objective-C try blocks like all the other try blocks.Nico Weber2015-02-071-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: @try { // ... } @finally { // ... } Now: @try { // ... } @finally { // ... } This is consistent with how we format C++ try blocks and SEH try blocks. clang-format not doing this before was an implementation oversight. This is dependent on BraceBreakingStyle. The snippet above is with the Attach style. Style Stroustrip for example still results in the "Before:" snippet, which makes sense since other blocks (try, else) break after '}' too. llvm-svn: 228483
* clang-format: Add support for SEH __try / __except / __finally blocks.Nico Weber2015-02-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | This lets clang-format format __try { } __except(0) { } and __try { } __finally { } correctly. __try and __finally are keywords if `LangOpts.MicrosoftExt` is set, so this turns this on. This also enables a few other keywords, but it shouldn't overly perturb regular clang-format operation. __except is a context-sensitive keyword, so `AdditionalKeywords` needs to be passed around to a few more places. Fixes PR22321. llvm-svn: 228148
* 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
OpenPOWER on IntegriCloud