summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-format: [Java] Support formatting qualified annotations.Nico Weber2015-01-091-18/+29
| | | | llvm-svn: 225559
* clang-format: Force line break between "endl" and "<<".Daniel Jasper2015-01-081-28/+26
| | | | | | | | | | | | | | | | This makes piped output easier to read in many instances. Before: llvm::errs() << aaaa << std::endl << bbbb << std::endl; After: llvm::errs() << aaaa << std::endl << bbbb << std::endl; Also fix a few instance of "don't use else after return" as per the coding standards. llvm-svn: 225444
* clang-format: Improve template parameter detection.Daniel Jasper2015-01-081-2/+5
| | | | | | | | | | Before: struct A < std::enable_if<sizeof(T2) <sizeof(int32)>::type>; After: struct A<std::enable_if<sizeof(T2) < sizeof(int32)>::type>; llvm-svn: 225435
* clang-format: Fix unary operator detection.Daniel Jasper2015-01-071-4/+4
| | | | | | | | | | Before: ** outparam = 1; After: **outparam = 1; llvm-svn: 225349
* clang-format: [Java] Fix incorrect detection of cast.Daniel Jasper2015-01-051-0/+2
| | | | | | | | | | | | | | After: return (a instanceof List<?>) ? aaaaaaaaaaaaaaaaaaaaaaa( aaaaaaaaaaaaaaaaaaaaa) : aaaaaaaaaaaaaaaaaaaaaaa; After: return (a instanceof List<?>) ? aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa) : aaaaaaaaaaaaaaaaaaaaaaa; llvm-svn: 225161
* clang-format: Fix incorrect detection of ObjC "in" keyword.Daniel Jasper2014-12-181-1/+2
| | | | | | | | | | Before: for (auto v : in [1]) { .. After: for (auto v : in[1]) { .. llvm-svn: 224513
* clang-format: [Java] Always break after annotations of multiline decls.Daniel Jasper2014-12-081-2/+0
| | | | | | | | | | | | | Before: @Mock DataLoader loooooooooooooooooooooooader = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; After: @Mock DataLoader loooooooooooooooooooooooader = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; llvm-svn: 223688
* clang-format: [JS] Don't put top-level dict literals on a single line.Daniel Jasper2014-12-041-0/+3
| | | | | | | These are often used for enums which apparently are easier to read if formatted with one element per line. llvm-svn: 223367
* clang-format: More restrictively classify import declarations.Daniel Jasper2014-12-041-1/+2
| | | | | | | | | | | Before: import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 223345
* clang-format: Fix fake parentheses placement with comments.Daniel Jasper2014-12-031-1/+1
| | | | | | | | | | | | | | | | Before: return (a > b // comment1 // comment2 || c); After: return (a > b // comment1 // comment2 || c); llvm-svn: 223234
* clang-format: Fix expression parser not closing stuff at end of stmt.Daniel Jasper2014-12-031-10/+11
| | | | | | | | | | | | | | Uncovered by a Java test case: Before: public some.package.Type someFunction( // comment int parameter) {} After: public some.package.Type someFunction( // comment int parameter) {} llvm-svn: 223228
* clang-format: [JS] Contract fewer functions to a single line.Daniel Jasper2014-11-271-2/+3
| | | | | | | | | | | | | Before: var someVariable = function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }; After: var someVariable = function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }; llvm-svn: 222893
* clang-format: [JS] Try not to break in container literals.Daniel Jasper2014-11-271-0/+2
| | | | | | | | | | | | | | | | | Before: var obj = { fooooooooo: function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); } }; After: var obj = { fooooooooo: function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); } }; llvm-svn: 222892
* clang-format: [JS] new and delete are valid function names.Daniel Jasper2014-11-271-3/+2
| | | | | | | | | | | | Before: someObject.new (); someObject.delete (); After: someObject.new(); someObject.delete(); llvm-svn: 222890
* clang-format: [JS] Make Closure module detection more narrow.Daniel Jasper2014-11-271-1/+2
| | | | | | | | | | | Before: var MyLongClassName = goog.module.get('my.long.module.name.followedBy.MyLongClassName'); After: var MyLongClassName = goog.module.get('my.long.module.name.followedBy.MyLongClassName'); llvm-svn: 222888
* clang-format: [Java] Don't line-wrap package declarations.Daniel Jasper2014-11-261-2/+4
| | | | | | This fixes llvm.org/PR21677. llvm-svn: 222843
* clang-format: [Java] Improve formatting of throws declarations.Daniel Jasper2014-11-261-2/+3
| | | | | | | | | | | | Before: public void doSoooooooooo() throws LoooooooooongException, LooooooooooongException {} After: public void doSoooooooooo() throws LoooooooooongException, LooooooooooongException {} llvm-svn: 222829
* clang-format: [Java] Improve cast detection.Daniel Jasper2014-11-261-3/+7
| | | | | | | | | | Before: a[b >> 1] = (byte)(c() << 4); After: a[b >> 1] = (byte) (c() << 4); llvm-svn: 222827
* clang-format: [Java] Fix breaking after annotations.Daniel Jasper2014-11-261-1/+2
| | | | | | | | | | | | | Before: @Annotation1 // comment @Annotation2 class C {} After: @Annotation1 // comment @Annotation2 class C {} llvm-svn: 222825
* clang-format: Refactoring.Daniel Jasper2014-11-251-265/+257
| | | | | | Re-apply r222638 and r222641 without variadic templates. llvm-svn: 222747
* Reverting r222638; it broke the MSVC build bots because Visual Studio 2012 ↵Aaron Ballman2014-11-241-258/+266
| | | | | | does not support variadic templates. Also reverting r222641 because it was relying on 222638. llvm-svn: 222656
* clang-format: [Java] Treat 'instanceof' like other binary operators.Daniel Jasper2014-11-231-2/+4
| | | | | | This fixes llvm.org/PR21436. llvm-svn: 222641
* clang-format: [Java] Space before array initializers.Daniel Jasper2014-11-231-0/+2
| | | | | | | | | | Before: new int[]{1, 2, 3, 4}; After: new int[] {1, 2, 3, 4}; llvm-svn: 222640
* clang-format: Improve ObjC blocks with return type.Daniel Jasper2014-11-231-1/+1
| | | | | | | | | | | | Before: Block b = ^int * (A * a, B * b) {} After: Block b = ^int *(A *a, B *b) {} This fixed llvm.org/PR21619. llvm-svn: 222639
* clang-format: Refactoring.Daniel Jasper2014-11-231-266/+256
| | | | | | | Provide more overloads to simplify testing the type of a token. No functional changes intended. llvm-svn: 222638
* clang-format: [JS] Support Closure's module statements.Daniel Jasper2014-11-231-19/+28
| | | | | | | 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-1/+4
| | | | | | | | | | Before: auto a = [&b, c ](D * d) -> D * {} After: auto a = [&b, c](D* d) -> D* {} llvm-svn: 222534
* clang-format: [Java] Support more Java keywords.Daniel Jasper2014-11-211-2/+3
| | | | | | | | | | | | | | | | | | Before: public final<X> Foo foo() { } public abstract<X> Foo foo(); After: public final <X> Foo foo() { } public abstract <X> Foo foo(); Patch by Harry Terkelsen. Thank you. llvm-svn: 222527
* clang-format: [Java] Basic lambda support.Daniel Jasper2014-11-211-0/+7
| | | | llvm-svn: 222524
* clang-format: [Java] Don't force break before generic type method.Daniel Jasper2014-11-201-0/+1
| | | | | | | | | | | | | | | Before: Foo.bar() .<X> baz(); After: Foo.bar() .<X>baz(); Patch by Harry Terkelsen. llvm-svn: 222423
* clang-format: Add option to disable alignment after opening bracketsDaniel Jasper2014-11-181-2/+5
| | | | | | | | | | | | | | Before: SomeFunction(parameter, parameter); After: SomeFunction(parameter, parameter); Patch by Harry Terkelsen, thank you! llvm-svn: 222284
* clang-format: Fix space between generic type parameter and squareDaniel Jasper2014-11-181-0/+2
| | | | | | | | | | | | | | bracket Before: public Foo<X, Y> [] foos; After: public Foo<X, Y>[] foos; Patch by Harry Terkelsen. Thank you! llvm-svn: 222283
* clang-format: Fix more incorrect pointer detection.Daniel Jasper2014-11-171-1/+1
| | | | | | | | | | Before: Constructor() : a(a), b(c, d *e) {} After: Constructor() : a(a), b(c, d * e) {} llvm-svn: 222158
* clang-format: Fix regression introduced in r221609.Daniel Jasper2014-11-171-1/+2
| | | | | | | | | | Before: void f() { f(a, c *d); } After: void f() { f(a, c * d); } llvm-svn: 222128
* clang-format: [Java] Further improve generics formatting.Daniel Jasper2014-11-141-1/+2
| | | | llvm-svn: 222011
* clang-format: Correctly detect multiplication in ctor initializer.Daniel Jasper2014-11-141-1/+1
| | | | | | | | | | Before: Constructor() : a(a), area(width *height) {} After: Constructor() : a(a), area(width * height) {} llvm-svn: 222010
* clang-format: Support assignments as conditional operands.Daniel Jasper2014-11-141-3/+5
| | | | | | | | | | | | | | | | | | | | | Before: return a != b // comment ? a : a = a != b // comment ? a = b : a; After: return a != b // comment ? a : a = a != b // comment ? a = b : a; llvm-svn: 221987
* clang-format: Improve indentation of comments in expressions.Daniel Jasper2014-11-141-2/+5
| | | | | | | | | | | | | | | | | | | | | 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
* clang-format: [Java] Fix line break behavior of class declarations.Daniel Jasper2014-11-141-6/+13
| | | | | | | | | Change breaking preferences: 1. Break before "extends" 2. Break before "implements" 3. Break within the implements list. llvm-svn: 221981
* clang-format: [Java] Improve generic return type formatting.Daniel Jasper2014-11-141-1/+2
| | | | | | | | | | Before: public<R> ArrayList<R> get() { After: public <R> ArrayList<R> get() { llvm-svn: 221979
* clang-format: [Java] Improve formatting of generics.Daniel Jasper2014-11-141-8/+6
| | | | | | | | | | Before: Function < F, ? extends T > function; After: Function<F, ? extends T> function; llvm-svn: 221976
* clang-format: Improve handling of comments in binary expressions.Daniel Jasper2014-11-111-2/+1
| | | | | | | | | | | | | | | | | Before: b = a && // Comment b.c && d; After: b = a && // Comment b.c && d; This fixes llvm.org/PR21535. llvm-svn: 221727
* clang-format: Preserve trailing-comma logic even with comments.Daniel Jasper2014-11-111-14/+15
| | | | | | | | | | | | | | | Before: vector<int> SomeVector = {// aaa 1, 2, }; After: vector<int> SomeVector = { // aaa 1, 2, }; llvm-svn: 221699
* clang-format: Fix pointer formatting.Daniel Jasper2014-11-101-0/+1
| | | | | | | | | Before: void f(Bar* a = nullptr, Bar * b); After: void f(Bar* a = nullptr, Bar* b); llvm-svn: 221609
* clang-format: [Java] Never treat @interface as annotation.Nico Weber2014-11-101-1/+2
| | | | | | | | | '@' followed by any keyword can't be an annotation, but @interface is currently the only combination of '@' and a keyword that's allowed, so limit it to this case. `@interface Foo` without a leading `public` was misformatted prior to this patch. llvm-svn: 221607
* clang-format: Use identifier table for keywords in other languages.Daniel Jasper2014-11-041-26/+24
| | | | | | | | | 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 line breaks.Daniel Jasper2014-11-041-0/+4
| | | | | | | | | | | | | | | | Before: @SomeAnnotation() abstract class aaaaaaaaa<a> extends bbbbbbbbbbbb<b> implements cccccccccccc { } After: @SomeAnnotation() abstract class aaaaaaaaa<a> extends bbbbbbbbbbbb<b> implements cccccccccccc { } llvm-svn: 221256
* clang-format: [Java] Fix more generics formatting.Daniel Jasper2014-11-031-1/+1
| | | | | | | | | | Before: < T extends B > T getInstance(Class<T> type); After: <T extends B> T getInstance(Class<T> type); llvm-svn: 221124
* clang-format: [Java] Fix static generic methods.Daniel Jasper2014-11-031-0/+2
| | | | | | | | | | Before: public static<R> ArrayList<R> get() {} After: public static <R> ArrayList<R> get() {} llvm-svn: 221122
* clang-format: [Java] Fix class declaration formatting.Daniel Jasper2014-11-031-3/+5
| | | | | | | | | | | | | | | | Before: @SomeAnnotation() abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc { } After: @SomeAnnotation() abstract class aaaaaaaaaaaa extends bbbbbbbbbbbbbbb implements cccccccccccc { } llvm-svn: 221121
OpenPOWER on IntegriCloud