summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* clang-format: Detect function-like macros only when upper case is used.Alexander Kornienko2014-03-181-1/+1
| | | | | | | | | | | | Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D3110 llvm-svn: 204156
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-151-6/+6
| | | | | | class. llvm-svn: 203999
* Remove an unnecessary check for FormatTok not being null.Alexander Kornienko2014-03-131-1/+2
| | | | | | | | | | | | | | | | | Summary: This check hints clang analyzer, that FormatTok may be null, and it reports a null pointer dereference error: http://buildd-clang.debian.net/scan-build/report-827c64.html#Path28 Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D3040 llvm-svn: 203800
* clang-format: Prevent ObjC code from confusing the braced-init detectionDaniel Jasper2014-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This was leading to bad formatting, e.g.: Before: f(^{ @autoreleasepool { if (a) { g(); } } }); After: f(^{ @autoreleasepool { if (a) { g(); } } }); llvm-svn: 203777
* clang-format: Fix another false positive in the lambda detection.Daniel Jasper2014-03-111-2/+2
| | | | | | | | | | Before: int i = (*b)[a] -> f(); After: int i = (*b)[a]->f(); llvm-svn: 203557
* clang-format: Fix incorrect lambda recognition exposed by r203452.Daniel Jasper2014-03-111-1/+2
| | | | | | | | | | Before: int i = a[a][a] -> f(); After: int i = a[a][a]->f(); llvm-svn: 203556
* clang-format: Add spaces around trailing/lambda return types.Daniel Jasper2014-03-101-0/+3
| | | | | | | | | | Before: int c = []()->int { return 2; }(); After: int c = []() -> int { return 2; }(); llvm-svn: 203452
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-1/+1
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* clang-format: Support lambdas with namespace-qualified return types.Daniel Jasper2014-02-111-0/+1
| | | | | | | E.g.: Foo([]()->std::vector<int> { return { 2 }; }()); llvm-svn: 201139
* clang-format: Support ObjC's NS_ENUMs.Daniel Jasper2014-01-301-1/+10
| | | | | | | | | | | | | | | | | | | | | | | Before: typedef NS_ENUM(NSInteger, MyType) { /// Information about someDecentlyLongValue. someDecentlyLongValue, /// Information about anotherDecentlyLongValue. anotherDecentlyLongValue, /// Information about aThirdDecentlyLongValue. aThirdDecentlyLongValue}; After: typedef NS_ENUM(NSInteger, MyType) { /// Information about someDecentlyLongValue. someDecentlyLongValue, /// Information about anotherDecentlyLongValue. anotherDecentlyLongValue, /// Information about aThirdDecentlyLongValue. aThirdDecentlyLongValue }; llvm-svn: 200469
* Fix crash on unmatched #endif's.Manuel Klimek2014-01-291-1/+3
| | | | | | | | The following snippet would crash: #endif #if A llvm-svn: 200381
* Get rid of special parsing for return statements.Manuel Klimek2014-01-241-37/+0
| | | | | | | | This was done when we were not able to parse lambdas to handle some edge cases for block formatting different in return statements, but is not necessary any more. llvm-svn: 199982
* clang-format: Fix incorrect lambda recognition.Daniel Jasper2014-01-221-1/+2
| | | | | | | | | | | | | Before: std::unique_ptr<int[]> foo() {} After: std::unique_ptr<int []> foo() {} Also, the formatting could go severely wrong after such a function before. llvm-svn: 199817
* clang-format: Enable formatting of lambdas with explicit return type.Daniel Jasper2014-01-161-2/+8
| | | | | | | | | So clang-format can now format: int c = []()->int { return 2; }(); int c = []()->vector<int> { return { 2 }; }(); llvm-svn: 199368
* clang-format: Don't hang forever when encountering a stray "}" in an ↵Benjamin Kramer2014-01-081-0/+4
| | | | | | | | @implementation block. PR18406. llvm-svn: 198770
* clang-format: Recognize single-line macro usages inside macros.Daniel Jasper2014-01-031-1/+1
| | | | | | | | | | | | | | | | | Before: #define LIST(L) \ L(FirstElement) L(SecondElement) L(ThirdElement) L(FourthElement) \ L(FifthElement) After: #define LIST(L) \ L(FirstElement) \ L(SecondElement) \ L(ThirdElement) \ L(FourthElement) \ L(FifthElement) llvm-svn: 198407
* clang-format: Fix various problems in formatting ObjC blocks.Daniel Jasper2013-12-231-5/+43
| | | | | | Among other things, this fixes llvm.org/PR15269. llvm-svn: 197900
* Implemented GNU-style formatting for compound statements.Alexander Kornienko2013-12-121-22/+45
| | | | | | | | | | | | | | | | Summary: Added BraceBreakingStyle::BS_GNU. I'm not sure about the correctness of static initializer formatting, but compound statements should be fine. Reviewers: djasper Reviewed By: djasper CC: cfe-commits, klimek Differential Revision: http://llvm-reviews.chandlerc.com/D2372 llvm-svn: 197138
* clang-format: Correctly handle Qt's Q_SLOTS.Daniel Jasper2013-11-291-1/+2
| | | | | | This should fix llvm.org/PR17241. Maybe it sticks this time :-). llvm-svn: 195953
* clang-format: Support Qt's slot access specifiers.Daniel Jasper2013-11-231-0/+3
| | | | | | This fixes llvm.org/PR17241. llvm-svn: 195555
OpenPOWER on IntegriCloud