summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* clang-format: Fix bad merging of lines in nested blocks.Daniel Jasper2014-10-271-5/+7
| | | | | | | | | | | | | | | Before: SomeFunction([]() { #define A a return 43; }); After: SomeFunction([]() { #define A a return 43; }); llvm-svn: 220684
* clang-format: [Proto] Change formatting text-formatted options.Daniel Jasper2014-10-271-1/+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: Fix incorrect space after "<".Daniel Jasper2014-10-231-3/+4
| | | | | | | | | | Before: bool a = 2 <::SomeFunction(); After: bool a = 2 < ::SomeFunction(); llvm-svn: 220505
* clang-format: Use AllowShortBlocksOnASingleLine for ObjC blocks, too.Daniel Jasper2014-10-221-0/+3
| | | | llvm-svn: 220375
* clang-format: Fix incorrect trailing return arrow detection.Daniel Jasper2014-10-221-1/+1
| | | | | | | | | | Before: auto doSomething(Aaaaaa* aaaaaa) -> decltype(aaaaaa -> f()) {} After: auto doSomething(Aaaaaa* aaaaaa) -> decltype(aaaaaa->f()) {} llvm-svn: 220373
* clang-format: [Java] Understand string literal concatenation.Daniel Jasper2014-10-211-0/+3
| | | | | | | | | | | Before: String someString = "abc" + "cde"; After: String someString = "abc" + "cde"; llvm-svn: 220287
* clang-format: [Java] Fix formatting of multiple annotations.Daniel Jasper2014-10-211-1/+2
| | | | | | | | | | | | | | | Before: @SuppressWarnings(value = "unchecked") @Author(name = "abc") public void doSomething() { } After: @SuppressWarnings(value = "unchecked") @Author(name = "abc") public void doSomething() { } llvm-svn: 220286
* clang-format: [Java] Fix space in generic method calls.Daniel Jasper2014-10-211-0/+5
| | | | | | | | | | Before: A.<B>doSomething(); After: A.<B>doSomething(); llvm-svn: 220285
* clang-format: [Java] Improve annotation handling.Daniel Jasper2014-10-211-0/+2
| | | | | | | | | | | | Before: @SuppressWarnings( value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") public static int iiiiiiiiiiiiiiiiiiiiiiii; After: @SuppressWarnings(value = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") public static int iiiiiiiiiiiiiiiiiiiiiiii; llvm-svn: 220284
* clang-format: [Java] Make annotation formatting more consistent.Daniel Jasper2014-10-211-1/+1
| | | | | | | | | | | | | | | | | Before: DoSomething(new A() { @Override public String toString() { } }); After: DoSomething(new A() { @Override public String toString() { } }); llvm-svn: 220282
* clang-format: [Java] Improve generic support.Daniel Jasper2014-10-211-8/+11
| | | | | | | | | | | | Before: Iterable< ? > a; Iterable< ? extends SomeObject > a; After: Iterable<?> a; Iterable<? extends SomeObject> a; llvm-svn: 220281
* clang-format: [Java] Support annotations with parameters.Daniel Jasper2014-10-211-1/+4
| | | | | | | | | | | | Before: @SuppressWarnings (value = "unchecked") public void doSomething() { .. } After: @SuppressWarnings(value = "unchecked") public void doSomething() { .. } llvm-svn: 220279
* clang-format: [Java] Wrap after each function annotation.Daniel Jasper2014-10-211-0/+6
| | | | | | | | | | | Before: @Override public String toString() { .. } After: @Override public String toString() { .. } llvm-svn: 220274
* clang-format: [ObjC] Fix spacing in block variable parameters.Daniel Jasper2014-10-211-0/+3
| | | | | | | | | | Before: { void (^block)(Object * x); } After: { void (^block)(Object *x); } llvm-svn: 220270
* clang-format: Fix space in direct destructor calls.Daniel Jasper2014-10-211-56/+52
| | | | | | | | | | | | Before: void F(int& i) { i. ~int(); } After: void F(int& i) { i.~int(); } Also, some cleanups. llvm-svn: 220269
* clang-format: Fix overloaded operator edge case.Daniel Jasper2014-10-201-0/+4
| | | | | | | | | | | | | | | | Before: template <class F> void Call(F f) { f.template operator() <int>(); } After: template <class F> void Call(F f) { f.template operator()<int>(); } llvm-svn: 220202
* clang-format: [ObjC] Fix using selector names as macro arguments.Daniel Jasper2014-10-201-0/+5
| | | | | | | | | | Before: [self aaaaa:MACRO(a, b :, c :)]; After: [self aaaaa:MACRO(a, b:, c:)]; llvm-svn: 220197
* clang-format: Fix indentation of struct definitions with array init.Daniel Jasper2014-10-201-6/+2
| | | | | | | | | | | | | | | | | | | | Before: struct { int x; int y; } points[] = { {1, 2}, {2, 3}, }; After: struct { int x; int y; } points[] = { {1, 2}, {2, 3}, }; llvm-svn: 220195
* clang-format: Prefer breaking before trailing return arrows.Daniel Jasper2014-10-171-1/+1
| | | | | | | | | | | | Before: auto SomeFunction( A aaaaaaaaaaaaaaaaaaaaa) const -> decltype(f(aaaaaaaaaaaaaaaaaaaaa)) {} After: auto SomeFunction(A aaaaaaaaaaaaaaaaaaaaa) const -> decltype(f(aaaaaaaaaaaaaaaaaaaaa)) {} llvm-svn: 220043
* clang-format: [Java] Don't break immediately after "throws".Daniel Jasper2014-10-171-0/+6
| | | | | | | | | | | | Before: public void doSooooooooooooooooooooooooooomething() throws LooooooooooooooooooooooooooooongException {} After: public void doSooooooooooooooooooooooooooomething() throws LooooooooooooooooooooooooooooongException {} llvm-svn: 220041
* clang-format: Fix behavior with comments before conditional expressionsDaniel Jasper2014-10-161-0/+3
| | | | | | | | | | | | | | | Before: SomeFunction(aaaaaaaaaaaaaaaaa, // comment. ccccccccccccccccc ? aaaaaaaaaaaaaaaaaaaa : bbbbbbbbbbbbbbbbbbbb); After: SomeFunction(aaaaaaaaaaaaaaaaa, // comment. ccccccccccccccccc ? aaaaaaaaaaaaaaaaaaaa : bbbbbbbbbbbbbbbbbbbb); llvm-svn: 219921
* clang-format: [ObjC] Fix method expression detection.Daniel Jasper2014-10-161-1/+9
| | | | | | | | | | Before: return (a)[foo bar : baz]; After: return (a)[foo bar:baz]; llvm-svn: 219919
* clang-format: [ObjC] Wrap ObjC method declarations before annotations.Daniel Jasper2014-10-111-0/+5
| | | | | | | | | | | | | Before: - (instancetype)initXxxxxxxxxxxxxxxxxxxxxxxxx:(id<x>)x y:(id<yyyyyyyyyyyyyyyyyyyy>) y NS_DESIGNATED_INITIALIZER; After: - (instancetype)initXxxxxxxxxxxxxxxxxxxxxxxxx:(id<x>)x y:(id<yyyyyyyyyyyyyyyyyyyy>)y NS_DESIGNATED_INITIALIZER; llvm-svn: 219564
* clang-format: If in doubt, assume '+' is a binary operator.Daniel Jasper2014-10-061-2/+3
| | | | | | | | | | Before: #define LENGTH(x, y) (x) - (y)+1 After: #define LENGTH(x, y) (x) - (y) + 1 llvm-svn: 219119
* clang-format: [JS] Support AllowShortFunctionsOnASingleLine.Daniel Jasper2014-09-301-0/+7
| | | | | | | | | Specifically, this also counts for stuff like (with style "inline"): var x = function() { return 1; }; llvm-svn: 218689
* clang-format: [JS] add space before operator 'in'.Daniel Jasper2014-09-191-0/+3
| | | | | | | | | | Before: return ('aaa')in bbbb; After: return ('aaa') in bbbb; llvm-svn: 218119
* clang-format: Allow unbroken ::: in inline assembly.Daniel Jasper2014-09-161-0/+2
| | | | | | | | | | | | Before: asm volatile("nop" :: : "memory"); After: asm volatile("nop" ::: "memory"); Patch by Eugene Toder. Thank you. llvm-svn: 217883
* clang-format: Add option to break before non-assignment operators.Daniel Jasper2014-09-151-5/+10
| | | | | | | | | This will allow: int aaaaaaaaaaaaaa = bbbbbbbbbbbbbb + ccccccccccccccc; llvm-svn: 217757
* clang-format: [JS] JavaScript does not have the */&/&& madness.Daniel Jasper2014-09-051-0/+3
| | | | | | | | | | | | | Before: e&& e.SomeFunction(); After: e && e.SomeFunction(); Yeah, this might be useful for C++, too, but it is not such a frequent pattern there (plus the fix is much harder). llvm-svn: 217237
* clang-format: [JS] Fix indentation in dict literals.Daniel Jasper2014-09-051-2/+6
| | | | | | | | | | | | | | | | | | Before: return { 'finish': // a }; After: return { 'finish': // a }; llvm-svn: 217235
* clang-format: [JS] Supprot "catch" as function name.Daniel Jasper2014-09-041-1/+3
| | | | | | | | | | Before: someObject.catch (); After: someObject.catch(); llvm-svn: 217158
* clang-format: [JS] Support comments in dict literals.Daniel Jasper2014-09-041-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | Before: var stuff = { // comment for update update : false, // comment for update modules : false, // comment for update tasks : false }; After: var stuff = { // comment for update update : false, // comment for update modules : false, // comment for update tasks : false }; llvm-svn: 217157
* clang-format: Add an option 'SpaceAfterCStyleCast'.Daniel Jasper2014-09-031-2/+3
| | | | | | | | | | | | | | | | | This permits to add a space after closing parenthesis of a C-style cast. Defaults to false to preserve old behavior. Fixes llvm.org/PR19982. Before: (int)i; After: (int) i; Patch by Marek Kurdej. llvm-svn: 217022
* clang-format: Fix unary operator detection in corner case.Daniel Jasper2014-08-291-2/+1
| | | | | | | | | | Before: decltype(* ::std::declval<const T &>()) void F(); After: decltype(*::std::declval<const T &>()) void F(); llvm-svn: 216724
* clang-format: Fix regression in formatting of braced initializers.Daniel Jasper2014-08-271-1/+3
| | | | | | | | | | | | Before: Node n{1, Node{1000}, // 2}; After: Node n{1, Node{1000}, // 2}; llvm-svn: 216540
* clang-format: New option SpacesInSquareBrackets.Daniel Jasper2014-08-261-4/+9
| | | | | | | | | | | | | | | | Before: int a[5]; a[3] += 42; After: int a[ 5 ]; a[ 3 ] += 42; Fixes LLVM bug #17887 (http://llvm.org/bugs/show_bug.cgi?id=17887). Patch by Marek Kurdej, thank you! llvm-svn: 216449
* clang-format: Improve handling of block comments in braced lists.Daniel Jasper2014-08-261-11/+11
| | | | | | | | | | | | Before: std::vector<int> v = { 1, 0 /* comment */ }; After: std::vector<int> v = {1, 0 /* comment */}; llvm-svn: 216445
* clang-format: Understand sequenced casts.Daniel Jasper2014-08-251-2/+3
| | | | | | | | | | | | This fixed llvm.org/PR20712. Before: int i = (int)(int) -2; After: int i = (int)(int)-2; llvm-svn: 216378
* clang-format: Prefer breaking after return type over template paramDaniel Jasper2014-08-151-0/+2
| | | | | | | | | | | | | | Before: typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa aaaaaaaaaa< aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bool *aaaaaaaaaaaaaaaaaa, bool *aa) {} After: typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa aaaaaaaaaa<aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( bool *aaaaaaaaaaaaaaaaaa, bool *aa) {} llvm-svn: 215693
* clang-format: [proto] Understand text-format nesting without :Daniel Jasper2014-08-151-4/+6
| | | | | | | | | | | | | | | | | Before: option (MyProto.options) = { field_c : "OK" msg_field{field_d : 123} }; After: option (MyProto.options) = { field_c : "OK" msg_field{field_d : 123} }; (Note that the colon after "msg_field" is optional). llvm-svn: 215692
* clang-format: Fix AlwaysBreakAfterDefinitionReturnType in Stroutrup styleDaniel Jasper2014-08-141-1/+3
| | | | | | | | | | | | | | | | | | | | | Before: template <class T> T *f(T &c) // Problem here: no line break before f { return NULL; } After: template <class T> T * f(T &c) { return NULL; } Patch by Marek Kurdej, thank you! llvm-svn: 215633
* clang-format: Support chained dereferenced assignments.Daniel Jasper2014-08-141-1/+2
| | | | | | | | | | Before: x = * a(x) = *a(y); After: x = *a(x) = *a(y); llvm-svn: 215632
* clang-format: Support breaking arguments of function type typedefs.Daniel Jasper2014-08-141-3/+4
| | | | | | | | | | | | | Before: typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)( const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 215631
* Fix crasher bug in clang-format.Manuel Klimek2014-08-131-1/+4
| | | | llvm-svn: 215549
* clang-format: Understand #defines defining system includes.Daniel Jasper2014-08-131-2/+12
| | | | | | | | | | Before: #define MY_IMPORT < a / b > After: #define MY_IMPORT <a/b> llvm-svn: 215527
* clang-format: Avoid bad line break.Daniel Jasper2014-08-121-2/+3
| | | | | | | | | | | | | Before: int aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa); After: int aaaaaaaaaaaaaaaaaaaaaaaaaaaaa( const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa); llvm-svn: 215442
* clang-format: Prefer not to put lambdas on a single line.Daniel Jasper2014-08-081-0/+2
| | | | | | | | | | | | | | Before: string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() { SomeOtherFunctioooooooooooooooooooooooooon(); }); After: string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() { SomeOtherFunctioooooooooooooooooooooooooon(); }); llvm-svn: 215197
* clang-format: Correct SBPO_Always-behavior after function-like keywordsDaniel Jasper2014-08-061-1/+1
| | | | | | | | | | | | | | | | | Before: auto f (int x) -> decltype(x) { return sizeof(x); } int g () noexcept(someCall ()); static_assert(sizeof(char) == 1, "Your compiler is broken"); After: auto f (int x) -> decltype (x) { return sizeof (x); } int g () noexcept (someCall ()); static_assert (sizeof (char) == 1, "Your compiler is broken"); This fixes llvm.org/PR20559. Patch by Roman Kashitsyn, thank you! llvm-svn: 214969
* [PR19983] SBPO_Always not covering all the cases.Chad Rosier2014-08-051-1/+1
| | | | | | | Patch by "Roman Kashitsyn" <romankashicin@gmail.com>. Phabricator revision: http://reviews.llvm.org/D4788 llvm-svn: 214904
* clang-format: Add option to always break after a function's return type.Daniel Jasper2014-08-051-0/+5
| | | | | | | | | | This is required for GNU coding style, among others. Also update the configuration documentation. Modified from an original patch by Jarkko Hietaniemi, thank you! llvm-svn: 214858
OpenPOWER on IntegriCloud