Commit Graph

1467 Commits

Author SHA1 Message Date
Daniel Jasper d492b5ec03 clang-format: [JS] Array literal detection fix #4.
llvm-svn: 238873
2015-06-02 21:57:51 +00:00
Daniel Jasper 1feab0f95e clang-format: Don't try to detect C++ lambdas in other languages.
llvm-svn: 238845
2015-06-02 15:31:37 +00:00
Daniel Jasper 199d0c9e76 clang-format: [JS] Fix incorrect line length calculation.
llvm-svn: 238841
2015-06-02 15:14:21 +00:00
Daniel Jasper 40432cee93 clang-format: [JS] Array literal detection fix #3.
llvm-svn: 238839
2015-06-02 15:04:29 +00:00
Daniel Jasper 4284e3623c clang-format: [JS] Fix another regression when detecting array literals.
llvm-svn: 238835
2015-06-02 14:20:08 +00:00
Daniel Jasper 5ce80de4de clang-format: [JS] Fix regression of detecting array literals.
llvm-svn: 238832
2015-06-02 13:56:43 +00:00
Manuel Klimek 21b4117a12 Remove error message when using the fallback style.
llvm-svn: 238822
2015-06-02 11:52:15 +00:00
Daniel Jasper 1699eca119 clang-format: [JS] Making arrow function wrapping more consistent.
Before:
  someFunction(() =>
               {
                 doSomething();  // break
               })
      .doSomethingElse(  // break
          );

After:
  someFunction(() => {
    doSomething();  // break
  })
      .doSomethingElse(  // break
          );

This is still bad, but at least it is consistent with what we do for other
function literals. Added corresponding tests.

llvm-svn: 238736
2015-06-01 09:56:32 +00:00
Benjamin Kramer c7551a4843 [Format] Move UnwrappedLines instead of copying.
No functional change intended.

llvm-svn: 238673
2015-05-31 11:18:05 +00:00
Daniel Jasper be520bd1a6 clang-format: NFC. Cleanup after r237895.
Specifically adhere to LLVM Coding Standards (no 'else' after
return/break/continue) and remove yet another implementation of
paren counting. We already have enough of those in the
UnwrappedLineParser.

No functional changes intended.

llvm-svn: 238672
2015-05-31 08:51:54 +00:00
Daniel Jasper cd8d4ff985 clang-format: [JS] Fix line breaks in computed property names.
Before:
  let foo = {
    [someLongKeyHere]: 1,
    someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3,
    lastLongKey: 4
  };

After:
  let foo = {
    [someLongKeyHere]: 1,
    someOtherLongKeyHere: 2,
    [keyLongEnoughToWrap]: 3,
    lastLongKey: 4
  };

llvm-svn: 238671
2015-05-31 08:40:37 +00:00
Daniel Jasper 8c42d445e3 clang-format: [JS] Support ES6 computed property names.
Before:
  var x = {
        [a]: 1,
    b: 2
  };

After:
  var x = {
    [a]: 1,
    b: 2
  };

llvm-svn: 238544
2015-05-29 06:19:49 +00:00
Benjamin Kramer ddf1cda2c2 [Format] Skip creating temporary std::strings when filling another string.
No functional change intended.

llvm-svn: 238466
2015-05-28 19:55:49 +00:00
Daniel Jasper f841d3a6c1 clang-format: Lower binding strengths created by the [] created by ObjC
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.

Specific test case in JavaScript:
Before:
  var aaaaa: List<
      SomeThing> = [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];

After:
  var aaaaa: List<SomeThing> = [
    new SomeThingAAAAAAAAAAAA(),
    new SomeThingBBBBBBBBB()
  ];

llvm-svn: 238400
2015-05-28 07:21:50 +00:00
Daniel Jasper 3e0dcc27d5 clang-format: [JS] Fix incorrect detection of ternary expressions.
A definintion like this could not be formatted at all:
  constructor({aa}: {
    aa?: string,
    aaaaaaaa?: string,
    aaaaaaaaaaaaaaa?: boolean,
    aaaaaa?: List<string>
  }) {
  }

llvm-svn: 238291
2015-05-27 05:37:40 +00:00
Daniel Jasper 3273930d9a clang-format: Fix false positive in function annotation detection.
llvm-svn: 238285
2015-05-27 04:55:47 +00:00
Daniel Jasper 0843434e74 clang-format: Guard the bin-packing in braced lists on BinPackArguments
instead of BinPackParameters. Braced lists are used as constructor
calls in many places and so the bin-packing should follow what is done
for other calls and not what is done for function declarations.

llvm-svn: 238184
2015-05-26 07:26:26 +00:00
Daniel Jasper 0805199185 clang-format: [JS] Support ES6 spread operator.
Specifically, don't add a space before it.

Before:
  someFunction(... a);
  var x = [1, 2, ... a];

After:
  someFunction(...a);
  var x = [1, 2, ...a];

llvm-svn: 238183
2015-05-26 07:18:56 +00:00
Daniel Jasper 1a02822704 clang-format: Fix child-formatting in macros.
This fixes a case where the column limit was incorrectly calculated
leading to a macro like this:

  #define A                                       \
    [] {                                          \
      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(        \
          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); \
    }

exceeding the column limit.

llvm-svn: 238182
2015-05-26 07:03:42 +00:00
Manuel Klimek 79e06081a3 clang-format: [JS] Better support for fat arrows.
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to
more easily recognize and format fat arrow functions.
Improves function parsing to better recognize formal parameter
lists and return type declarations.
Recognizes arrow functions and parse function bodies as child blocks.

Patch by Martin Probst.

llvm-svn: 237895
2015-05-21 12:23:34 +00:00
Anders Waldenborg b09075a240 clang-format: Add space in function pointers with SpaceBeforeParens=Always
"void (*my_function)(void)" should become "void (*my_function) (void)" when
SpaceBeforeParens is set to 'Always'

Differential Revision: http://reviews.llvm.org/D9835

llvm-svn: 237704
2015-05-19 16:54:26 +00:00
Daniel Jasper 9310166a63 clang-format: Improve *-detection.
Before:
  S << a *(10);

After:
  S << a * (10);

This fixes llvm.org/PR16500.

llvm-svn: 237690
2015-05-19 12:29:27 +00:00
Daniel Jasper d6e09e85f9 clang-format: Improve for-loop formatting.
Before:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator I =
           Container.begin(),
                                                          E = Container.end();
       I != E; ++I)

After:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator
           I = Container.begin(),
           E = Container.end();
       I != E; ++I)

This fixes llvm.org/PR23544.

llvm-svn: 237688
2015-05-19 11:51:39 +00:00
Daniel Jasper fa3f8fbed8 clang-format: Support #include_next
Before:
  #include_next < test.h >

After:
  #include_next <test.h>

This fixes llvm.org/PR23500

llvm-svn: 237686
2015-05-19 11:22:29 +00:00
Daniel Jasper f5e5ee6d69 clang-format: Correctly detect casts to qualified types.
Before:
  ns::E f() { return (ns::E) - 1; }

After:
  ns::E f() { return (ns::E)-1; }

This fixes llvm.org/PR23503.

llvm-svn: 237684
2015-05-19 11:18:39 +00:00
Daniel Jasper ed41f774fc clang-format: Fix regression caused by r237244.
Before:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.
          aaaaaaaa];

After:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa
          .aaaaaaaa];

This merely papers over the fact that we aren't parsing ObjC method calls
correctly. Also, the indentation is weird.

llvm-svn: 237681
2015-05-19 11:06:33 +00:00
Daniel Jasper 3c883d1dcc clang-format: Fix another regression caused by r237565.
Before:
  class C : test {
    class D : test{void f(){int i{2};
  }
  }
  ;
  }
  ;

After:
  class C : test {
    class D : test {
      void f() { int i{2}; }
    };
  };

llvm-svn: 237569
2015-05-18 14:49:19 +00:00
Daniel Jasper cec9ffd2a2 clang-format: Fix regression introduced by r237565.
Before:
  class C : public D {
    SomeClass SC { 2 };
  };

After:
  class C : public D {
    SomeClass SC{2};
  };

llvm-svn: 237568
2015-05-18 14:12:24 +00:00
Daniel Jasper 47bbda0939 clang-format: Improve detection of macros annotating functions.
Before:
  ASSERT("aaaaaaaaaaaaaaa")
      << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

After:
  ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                            << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

Also cleanup implementation a bit and only mark closing parenthesis of
these annotations.

llvm-svn: 237567
2015-05-18 13:47:23 +00:00
Daniel Jasper adba2aadf2 clang-format: Allow braced initializers in template arguments of class
specializations.

Before:
  template <class T>
      struct S < std::is_arithmetic<T> {
  } > {};

After:
  template <class T> struct S<std::is_arithmetic<T>{}> {};

llvm-svn: 237565
2015-05-18 12:52:00 +00:00
Daniel Jasper f090f031bc clang-format: Support function annotations in macros.
Before:
  DEPRECATED("Use NewClass::NewFunction instead.") string
      OldFunction(const string &parameter) {}

After:
  DEPRECATED("Use NewClass::NewFunction instead.")
  string OldFunction(const string &parameter) {}

llvm-svn: 237562
2015-05-18 09:47:22 +00:00
Daniel Jasper 0928553eec clang-format: Properly align ObjC string literals.
Before:
  NSString s = @"a"
               "b"
               "c";
  NSString s = @"a"
               @"b"
                @"c";

After:
  NSString s = @"a"
                "b"
                "c";
  NSString s = @"a"
               @"b"
               @"c";

This fixes llvm.org/PR23536.

llvm-svn: 237538
2015-05-17 08:13:23 +00:00
Daniel Jasper 2fd16632bc clang-format: Improve line wrapping around << operators.
Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
just a single such pair, as that doesn't help much.

Before:
  llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa,
                                              aaaaaaaaa);

After:
  llvm::errs() << "aaaaaaaaaaaa: "
               << aaaaaaa(aaaaaaaaa, aaaaaaaaa);

Also remove old test case that was testing actual behavior any more.

llvm-svn: 237535
2015-05-17 07:27:09 +00:00
Daniel Jasper 3ca283ada3 clang-format: Slightly change format decisions around macro annotations.
Before:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      GUARDED_BY(aaaaaaaaaaaa) = aaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
      aaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 237430
2015-05-15 09:58:11 +00:00
Daniel Jasper 731dde91db clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.

llvm-svn: 237427
2015-05-15 09:41:59 +00:00
Daniel Jasper cdb58b2e45 clang-format: Add missing space before ObjC selector.
Before:
  [self aaaaa:(1 + 2)bbbbb:3];

After:
  [self aaaaa:(1 + 2) bbbbb:3];

llvm-svn: 237424
2015-05-15 09:05:31 +00:00
Daniel Jasper c4144ea418 clang-format: Improve nested block / lambda indentation when wrapping
before binary/ternary operators.

Basically, it doesn't seem right to indent a nested block aligned to a
binary or ternary operator.

Before:
  int i = aaaaaa ? 1  //
                 : [] {
                   return 2;  //
                 }();
  llvm::errs() << "number of twos is "
               << std::count_if(v.begin(), v.end(), [](int x) {
                 return x == 2;  // force break
               });

After:
  int i = aaaaaa ? 1  //
                 : [] {
                     return 2;  //
                   }();
  llvm::errs() << "number of twos is "
               << std::count_if(v.begin(), v.end(), [](int x) {
                    return x == 2;  // force break
                  });

llvm-svn: 237263
2015-05-13 16:09:21 +00:00
Daniel Jasper 3a26a8db5d clang-format: Fix incorrect */& classification.
Before:
  void f() { f(new a(), c *d); }

After:
  void f() { f(new a(), c * d); }

llvm-svn: 237249
2015-05-13 12:54:30 +00:00
Daniel Jasper e60cba1337 clang-format: Fix semicolon less macro-detection.
It was fooled by the comment.

Before:
  SOME_UNRELATED_MACRO
      /*static*/ int i;

After:
  SOME_UNRELATED_MACRO
  /*static*/ int i;

llvm-svn: 237246
2015-05-13 11:35:53 +00:00
Daniel Jasper a7b142603d clang-format: [ObjC] Further improve wrapping of methods calls without inputs.
Before:
  [aaaaaaaaaaaaaaaaaaaaaaa
      .aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa] aaaaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa]
      aaaaaaaaaaaaaaaaaaaaaa];

llvm-svn: 237244
2015-05-13 10:23:03 +00:00
Daniel Jasper a2a4d9c049 clang-format: [ObjC] Make IndentWrappedFunctionNames work with ObjC functions
llvm-svn: 237241
2015-05-13 09:38:25 +00:00
Daniel Jasper 0ad2814c89 clang-format: Prefer formatting local lambdas like functions.
Before:
  auto my_lambda =
      [](const string &some_parameter) { return some_parameter.size(); };

After:
  auto my_lambda = [](const string &some_parameter) {
    return some_parameter.size();
  };

llvm-svn: 237235
2015-05-13 08:47:16 +00:00
Daniel Jasper 60c270764e clang-format: Support column layout with comment after {.
Before:
  vector<int> iiiiiiiiiiiiiii = {                      //
      1111111111, 2222222222, 33333333333, 4444444444, //
      111111111, 222222222, 3333333333, 444444444,     //
      11111111, 22222222, 333333333, 44444444};

After:
  vector<int> iiiiiiiiiiiiiii = {                      //
      1111111111, 2222222222, 33333333333, 4444444444, //
      111111111,  222222222,  3333333333,  444444444,  //
      11111111,   22222222,   333333333,   44444444};

llvm-svn: 237233
2015-05-13 08:16:00 +00:00
Daniel Jasper 56807c19ac clang-format: Make member introduced in r237108 const.
llvm-svn: 237114
2015-05-12 11:14:06 +00:00
Daniel Jasper 99b5a4648c clang-format: Fix */& detection for lambdas in macros.
Before:
  #define MACRO() [](A * a) { return 1; }

After:
  #define MACRO() [](A *a) { return 1; }

llvm-svn: 237109
2015-05-12 10:20:32 +00:00
Daniel Jasper 5fc133e71e clang-format: Fix hanging nested blocks in macros.
Before:
  #define MACRO()                     \
    Debug(aaa, /* force line break */ \
          {                           \
      int i;                          \
      int j;                          \
          })

After:
  #define MACRO()                     \
    Debug(aaa, /* force line break */ \
          {                           \
            int i;                    \
            int j;                    \
          })

llvm-svn: 237108
2015-05-12 10:16:02 +00:00
Manuel Klimek 3d3ea84a4f Refactor clang-format's formatter.
Summary:
a) Pull out a class LevelIndentTracker whose responsibility is to keep track
   of the indent of levels across multiple annotated lines.
b) Put all responsibility for merging lines into the LineJoiner; make the
   LineJoiner iterate over the lines so we never operate on a line that might
   be merged later; this makes the interface safer to use.
c) Move formatting of the end-of-file whitespace into formatFirstToken.

Fix bugs that became obvious after the refactoring:
1. We would not format lines with offsets correctly inside nested blocks if
   only the outer expression was affected:
   int x = s({ // clang-format only this line
     class X {
       public:
    // ^ this starts at the non-modified indnent level; previously we would
    //   not fix this, now we correctly outdent it.
       void f();
     };
   });
2. We would incorrectly align comments across lines that do not have comments
   for lines with nested blocks:
   int expression; // with comment
   int x = s({
     int y; // comment
     int z; // we would incorrectly align this comment with the comment on
            // 'expression'
   });

llvm-svn: 237104
2015-05-12 09:23:57 +00:00
Daniel Jasper 015c7a91f1 clang-format: Support aligning ObjC string literals.
Before:
  NSString s = @"aaaa"
      @"bbbb";

After:
  NSString s = @"aaaa"
               @"bbbb";

llvm-svn: 237000
2015-05-11 15:15:48 +00:00
Daniel Jasper d9ff035de8 clang-format: Appease the buildbots by including climits.
llvm-svn: 236995
2015-05-11 13:52:13 +00:00
Daniel Jasper d57843d4e3 clang-format: Improve column layout.
Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This automatically handles the corner cases of a single column
and a single row so that the actualy implementation becomes simpler.

Before:
  vector<int> x = {1,
                   aaaaaaaaaaaaaaaaaaaaaa,
                   2,
                   bbbbbbbbbbbbbbbbbbbbbb,
                   3,
                   cccccccccccccccccccccc};

After:
  vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa,
                   2, bbbbbbbbbbbbbbbbbbbbbb,
                   3, cccccccccccccccccccccc};

llvm-svn: 236992
2015-05-11 13:35:40 +00:00
Daniel Jasper 790d4f975e clang-format: Don't merge subsequent lines into _asm blocks.
Before:
  _asm {
  } int i;

After:
  _asm {
  }
  int i;

llvm-svn: 236985
2015-05-11 11:59:46 +00:00
Daniel Jasper ec05fc7b16 clang-format: [JS] Clean up export declaration parsing.
NFC intended.

llvm-svn: 236982
2015-05-11 09:14:50 +00:00
Daniel Jasper 668c7bb34f clang-format: [JS] Parse exported functions as free-standing.
Before:
  export function foo() {} export function bar() {}

After:
  export function foo() {
  }
  export function bar() {
  }

llvm-svn: 236978
2015-05-11 09:03:10 +00:00
Manuel Klimek d3585dbd1a Refactor the formatter of clang-format.
Pull various parts of the UnwrappedLineFormatter into their own
abstractions. NFC.

There are two things left for subsequent changes (to keep this
reasonably small)
- the UnwrappedLineFormatter now has a bad name
- the UnwrappedLineFormatter::format function is still too large

llvm-svn: 236974
2015-05-11 08:21:35 +00:00
Daniel Jasper 173504e494 clang-format: Improve wrapping of << operators.
Before:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaa)
               << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

Also, cleanup and simplify the operator wrapping logic.

llvm-svn: 236960
2015-05-10 21:15:07 +00:00
Daniel Jasper c6366077ed clang-format: Preserve line break before } in __asm { ... }.
Some compilers ignore everything after a semicolon in such inline asm
blocks and thus, the closing brace must not be moved to the previous
line.

llvm-svn: 236946
2015-05-10 08:42:04 +00:00
Daniel Jasper f0fd1c66df clang-format: Fix bug in escaped newline calculation.
This prevents clang-format from inadvertently joining stuff into macro
definitions as reported in llvm.org/PR23466.

llvm-svn: 236944
2015-05-10 08:00:25 +00:00
Daniel Jasper e4c16c7ce3 clang-format: Several improvements around formatting braced lists.
In particular:
* If the difference between the longest and shortest element, we copped
  out of column format completely. Now, we instead allow to arrange
  these in a single column, essentially enforcing a one-per-line format.
* Allow column layout even if there are braced lists. Especially, if
  there are many short lists, this can be beneficial. The bad case,
  where there is a long nested init list is usually caught as we now
  limit the length difference of the longest and shortest element.

llvm-svn: 236851
2015-05-08 13:51:14 +00:00
Daniel Jasper 7325aee167 clang-format: [JS] Avoid bad line-warp around "function".
Before:
  someLooooooooongFunction(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, function(
                                              aaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {
        // code
      });

After:
  someLooooooooongFunction(
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      function(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {
        // code
      });

llvm-svn: 236813
2015-05-08 08:38:52 +00:00
Daniel Jasper 69694b0691 clang-format: [JS] Fix regex literal detection.
Before:
  var regex = /= / ;

After:
  var regex = /=/;

llvm-svn: 236811
2015-05-08 07:55:13 +00:00
Daniel Jasper 9c95013e8f clang-format: Improve r236597, Properly indent method calls without inputs.
Before:
  [aaaaaaaaaaaa(aaaaaa)
          aaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaa(aaaaaa)
      aaaaaaaaaaaaaaaaaaaa];

llvm-svn: 236730
2015-05-07 14:19:59 +00:00
Manuel Klimek ec5c3db7ac Implements a way to retrieve information about whether some lines were not formatted due to syntax errors.
llvm-svn: 236722
2015-05-07 12:26:30 +00:00
Daniel Jasper 036181471c clang-format: Don't indent 'signals' as access specifier if it isn't one
Before:
  {
  signals.set(0);
  }

After:
  {
    signals.set(0);
  }

llvm-svn: 236630
2015-05-06 19:21:23 +00:00
Daniel Jasper 1fe0d5ca59 clang-format: Merge labels and subsequent semicolons.
E.g.:

  default:;

This can be used to get around restrictions as to what can follow a
label. It fixes llvm.org/PR19648.

llvm-svn: 236604
2015-05-06 15:19:47 +00:00
Daniel Jasper 112b50e6b6 clang-format: Allow ternary expressions inside template parameters if
the template parameters aren't inside an expression context.

This fixes llvm.org/PR23270.

llvm-svn: 236603
2015-05-06 14:53:50 +00:00
Daniel Jasper e92bf6f141 clang-format: Consider operator precedence as penalty when breaking
before operators.

This fixes llvm.org/23382.

llvm-svn: 236602
2015-05-06 14:23:38 +00:00
Daniel Jasper 04785d0488 clang-format: Accept slightly more record declarations.
This fixes llvm.org/PR23397.

llvm-svn: 236599
2015-05-06 14:03:02 +00:00
Daniel Jasper 2746a308c2 clang-format: Fix bad wrapping of ObjC method exprs.
Before:
  [aaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa:
      aaaaaaaa aaa:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaaaaaaaaaaaaaaa
      aaaaaaaaaaaaaaaaa:aaaaaaaa
                    aaa:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];

Note that this might now violate the column limit and we probably need an
alternative way of indenting these then. However, that is still strictly better
than the messy formatting that clang-format did before.

llvm-svn: 236598
2015-05-06 13:13:03 +00:00
Daniel Jasper eb53668c35 clang-format: Properly indent method calls without inputs.
Before:
  [aaaaaaaaaaa
          aaaaaaa];

After:
  [aaaaaaaaaaa
      aaaaaaa];

llvm-svn: 236597
2015-05-06 12:48:06 +00:00
Manuel Klimek 24a8f55857 Remove deprecated version of reformat.
llvm-svn: 236594
2015-05-06 12:12:22 +00:00
Manuel Klimek 20e0af6b62 Remove all computation of structural errors in clang-format's line parser.
We were already ignoring those already.

llvm-svn: 236591
2015-05-06 11:56:29 +00:00
Daniel Jasper e2408e37db clang-format: Fix another assertion discovered by the fuzzer.
In the process, fix an old todo that I don't really know how to write
tests for. The problem is that Clang's lexer creates very strange token
sequences for these. However, the new approach seems generally better
and easier to read so I am submitting it nonetheless.

llvm-svn: 236589
2015-05-06 11:16:43 +00:00
Daniel Jasper 62c78f5474 clang-format: Prevent assertion discovered by fuzzer.
llvm-svn: 236578
2015-05-06 08:58:57 +00:00
Daniel Jasper 4d9ec17f1e clang-format: Prevent exponential runtime in token annotator.
llvm-svn: 236577
2015-05-06 08:38:24 +00:00
Daniel Jasper 6d9b88dd99 clang-format: Fix bug in multiline comment wrapping.
Splitting:
  /**
   * multiline block comment
   *
   */

Before:
  /**
   * multiline block
   *comment
   *
   */

After:
  /**
   * multiline block
   * comment
   *
   */

The reason was that the empty line inside the comment (with just the "*") was
confusing the comment breaking logic.

llvm-svn: 236573
2015-05-06 07:17:22 +00:00
Daniel Jasper 9326f91922 clang-format: [JS] support optional methods.
Optional methods use ? tokens like this:

  interface X { y?(): z; }

It seems easiest to detect and disambiguate these from ternary
expressions by checking if the code is in a declaration context. Turns
out that that didn't quite work properly for interfaces in Java and JS,
and for JS file root contexts.

Patch by Martin Probst, thank you.

llvm-svn: 236488
2015-05-05 08:40:32 +00:00
Daniel Jasper 2964749cfa clang-format: [JS] Do not collapse short interfaces.
Patch by Martin Probst.

llvm-svn: 236485
2015-05-05 08:12:50 +00:00
Daniel Jasper 66cb8c503f clang-format: NFC: Delete FormatToken::IsForEachMacro. Use a TokenType instead.
llvm-svn: 236415
2015-05-04 09:22:29 +00:00
Daniel Jasper 3cea45d079 clang-format: NFC: Use default member initializers and other cleanups.
llvm-svn: 236413
2015-05-04 08:51:40 +00:00
Daniel Jasper de7ca75ca0 clang-format: Force aligning different brackets relative to each other.
Before:
  void SomeFunction(vector< // break
      int> v);

After:
  void SomeFunction(vector< // break
                        int> v);

llvm-svn: 236412
2015-05-04 07:39:00 +00:00
Daniel Jasper f69b922e57 clang-format: [JS] Fix calculation of template string width.
OriginalColumn might not be set, so fall back to Location and SourceMgr
in case it is missing. Also initialize end column in case the token is
multi line, but it's the ` token itself that starts the multi line.

Patch by Martin Probst, thank you!

llvm-svn: 236383
2015-05-02 08:05:38 +00:00
Daniel Jasper d22190632c clang-format: [JS] Fix templated parameter default values.
Parameters can have templated types and default values (= ...), which is
another location in which a template closer should be followed by
whitespace.

Patch by Martin Probst, thank you.

llvm-svn: 236382
2015-05-02 07:54:58 +00:00
Daniel Jasper e9f5357f49 clang-format: Don't merge short else blocks.
Before (with the appropriate flags settings):
  if (a) {
    f();
  } else { g(); }

Before (with other appropriate flags settings):
  if (a) { f(); } else {
    g();
  }

After:
  if (a) {
    f();
  } else {
    g();
  }

llvm-svn: 236217
2015-04-30 09:24:17 +00:00
Daniel Jasper a4499133b1 clang-format: Add ability to align assignment operators.
In Objective-C some style guides use a style where assignment operators are
aligned, in an effort to increase code readability. This patch adds an option
to the format library which allows this functionality. It is disabled by
default for all the included styles, so it must be explicitly enabled.

The option will change code such as:
  - (void)method {
      NSNumber *one = @1;
      NSNumber *twentyFive = @25;
  }

to:
  - (void)method {
      NSNumber *one        = @1;
      NSNumber *twentyFive = @25;
  }

Patch by Matt Oakes. Thank you!

Accidentally reformatted all the tests...

llvm-svn: 236100
2015-04-29 13:06:49 +00:00
Daniel Jasper eb45cb7cf9 clang-format: Fix selective indentaiton in nested blocks.
Buggy case:
  someFunction(
      [] {
        // comment
        int i; // invoke formatting here.
      },       // force line break
      aaa);

llvm-svn: 236091
2015-04-29 08:29:26 +00:00
Daniel Jasper 775954be1e clang-format: Don't wrap after short first segments of builder calls.
Before:
  a()
      .aaaaa()
      .aaaaa()
      .aaaaa();

After:
  a().aaaaa()
      .aaaaa()
      .aaaaa();

llvm-svn: 235707
2015-04-24 10:08:09 +00:00
Daniel Jasper de0d1f3c26 clang-format: More selectively detect QT's "signals".
llvm-svn: 235702
2015-04-24 07:50:34 +00:00
Daniel Jasper 0faa9136fa clang-format: Properly detect variable declarations with ObjC.
Before:
  LoooooooooooooooooooooooooooooooooooooooongType
  LoooooooooooooooooooooooooooooooooooooongVariable([A a]);

After:
  LoooooooooooooooooooooooooooooooooooooooongType
      LoooooooooooooooooooooooooooooooooooooongVariable([A a]);

llvm-svn: 235599
2015-04-23 13:58:40 +00:00
Daniel Jasper caf84fe21e clang-format: Allow splitting "= default" and "= delete".
Otherwise, this can violate the column limit.

llvm-svn: 235592
2015-04-23 12:59:09 +00:00
Daniel Jasper 532a031422 clang-format: Don't add unwanted space when creating new arrays.
Before:
  char** newargv = new char* [argc];

After:
  char** newargv = new char*[argc];

llvm-svn: 235583
2015-04-23 10:23:53 +00:00
Daniel Jasper 1b998815a0 clang-format: [Proto] Don't linewrap top-level options.
They are very similar to import statements.

llvm-svn: 235582
2015-04-23 09:54:10 +00:00
Daniel Jasper 289afc071e clang-format: Support nested block formatting with ColumnLimit=0.
llvm-svn: 235580
2015-04-23 09:23:17 +00:00
Daniel Jasper ee4a8a140a clang-format: Fix for #pragma option formatting.
Adapted patch from Sergey Razmetov. Thank you.

llvm-svn: 235492
2015-04-22 09:45:42 +00:00
Daniel Jasper e4ab49e8d3 clang-format: Fix incorrect multi-var declstmt detection.
This is now obvious as the pointer alignment behavior was changed.

Before (even with pointer alignment "Left"):
  MACRO Constructor(const int &i) : a(a), b(b) {}

After:
  MACRO Constructor(const int& i) : a(a), b(b) {}

llvm-svn: 235301
2015-04-20 12:54:29 +00:00
Daniel Jasper 0d6ac27b86 clang-format: [JS] handle comments in template strings.
Patch by Martin Probst. Thank you.

llvm-svn: 235078
2015-04-16 08:20:51 +00:00
Daniel Jasper 20e15563ff clang-format: Undo r214508. It was essentially always removing the
space where we already had the flag ObjCSpaceBeforeProtocolList to
control it. I don't know what I was thinking.

llvm-svn: 235076
2015-04-16 07:02:19 +00:00
Daniel Jasper 2b1865c251 clang-format: Determine "in" as a keyword in ObjC for loops more precisely
Before:
  for (int i = 0; i < in [a]; ++i) ..

After:
  for (int i = 0; i < in[a]; ++i) ..

Also do some related cleanups.

llvm-svn: 234980
2015-04-15 07:26:18 +00:00
Daniel Jasper d9309774a6 clang-format: [JS] Support index signature types.
Patch by Martin Probst.

llvm-svn: 234754
2015-04-13 15:03:30 +00:00
Daniel Jasper a74f5072e1 clang-format: [JS] support optionality markers in JS types.
Patch by Martin Probst. Thank you.

llvm-svn: 234753
2015-04-13 15:01:40 +00:00
Daniel Jasper 6a5d38d2ee clang-format: [JS] Allow periods and commata in class declarations.
Patch by Martin Probst. Thank you.

llvm-svn: 234752
2015-04-13 14:56:54 +00:00
Alexander Kornienko 34eb20725d Use 'override/final' instead of 'virtual' for overridden methods
Summary:
The patch is generated using clang-tidy misc-use-override check.

This command was used:

  tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \
    -checks='-*,misc-use-override' -header-filter='llvm|clang' -j=32 -fix

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D8926

llvm-svn: 234678
2015-04-11 02:00:23 +00:00
Daniel Jasper 53395406da clang-format: Fix regression formatting QT's "signals:" from r234318.
llvm-svn: 234320
2015-04-07 15:04:40 +00:00
Daniel Jasper 676e516354 clang-format: Don't allow labels when expecting declarations.
This fixes formatting unnamed bitfields (llvm.org/PR21999).

Before:
  struct MyStruct {
    uchar data;
  uchar:
    8;
  uchar:
    8;
    uchar other;
  };

After:
  struct MyStruct {
    uchar data;
    uchar : 8;
    uchar : 8;
    uchar other;
  };

llvm-svn: 234318
2015-04-07 14:36:33 +00:00
Daniel Jasper acf67e3ecd clang-format: Improve nested block formatting.
Before:
  functionA(functionB({
    int i;
    int j;
  }),
            aaaa, bbbb, cccc);

After:
  functionA(functionB({
              int i;
              int j;
            }),
            aaaa, bbbb, cccc);

llvm-svn: 234304
2015-04-07 08:20:35 +00:00
Daniel Jasper 9dedc775d7 clang-format: Indent relative to the ./-> and not the function name.
Before:
  aaaaaaaaaaa     //
      .aaaa(      //
           bbbb)  // This is different ..
      .aaaa(      //
          cccc);  // .. from this.

After:
  aaaaaaaaaaa     //
      .aaaa(      //
          bbbb)   // This is identical ..
      .aaaa(      //
          cccc);  // .. to this.

llvm-svn: 234300
2015-04-07 06:41:24 +00:00
Daniel Jasper 739ec534d2 clang-format: [JS] Understand object literals with only methods.
Before:
  let theObject = {someMethodName() {
    doTheThing();
    doTheOtherThing();
  },
                   someOtherMethodName() {
                     doSomething();
                     doSomethingElse();
                   }};

After:
  let theObject = {
    someMethodName() {
      doTheThing();
      doTheOtherThing();
    },
    someOtherMethodName() {
      doSomething();
      doSomethingElse();
    }
  };

llvm-svn: 234091
2015-04-04 07:56:55 +00:00
Daniel Jasper 1662bfe077 clang-format: [Proto] No alternate operator names.
llvm-svn: 234055
2015-04-03 21:15:46 +00:00
Daniel Jasper f46dec86b6 clang-format: [JS] Support getters, setters and methods in object literals.
llvm-svn: 233698
2015-03-31 14:34:15 +00:00
Daniel Jasper 02c7bca5d1 clang-format: [JS] Fix comment formatting in goog.scopes.
Before:
  goog.scope(function() {
  // test
  var x = 0;
  // test
  });

After:
  goog.scope(function() {
  // test
  var x = 0;
    // test
  });

llvm-svn: 233530
2015-03-30 09:56:50 +00:00
Daniel Jasper 05cd92922d clang-format: Force line break in trailing calls after multline exprs.
Before:
  aaaaaaaa(aaaaaaaaaa,
           bbbbbbbbbb).a();

After:
  aaaaaaaa(aaaaaaaaaa,
           bbbbbbbbbb)
      .a();

llvm-svn: 233304
2015-03-26 18:46:28 +00:00
Daniel Jasper e99c72fc2e clang-format: Fix merging of _T macros.
NewlinesBefore and HasUnescapedNewline were not properly propagated
leading to llvm.org/PR23032.

llvm-svn: 233276
2015-03-26 14:47:35 +00:00
Benjamin Kramer 53f5e893c2 Explicitly include raw_ostream.h instead of relying on transitive inclusion.
NFC.

llvm-svn: 232975
2015-03-23 18:05:43 +00:00
Daniel Jasper 414c9c6fb0 clang-format: Fix another bug in wrapping around "*".
Before:
  void aaaaa(
      aaaaaaaaaaaa* aaaaaaaaaaaaaa) {} // even violation the column limit

After:
  void aaaaa(aaaaaaaaaaaa*
                 aaaaaaaaaaaaaa) {}

llvm-svn: 232717
2015-03-19 09:40:16 +00:00
Daniel Jasper 1130981907 clang-format: Fix bad wrapping after "*" introduced in r232044.
Before:
  void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaa*
                                              const aaaaaaaaaaaa) {}

After:
  void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaaaa* const aaaaaaaaaaaa) {}

llvm-svn: 232635
2015-03-18 14:20:13 +00:00
Daniel Jasper bc46b939e6 clang-format: [JS] support cast syntax and type arguments.
Casts in TS syntax (foo = <type>bar;) should not be followed by
whitespace.

Patch by Martin Probst. Thank you.

llvm-svn: 232321
2015-03-15 13:59:51 +00:00
Daniel Jasper 60948b12bb clang-format: [JS] more precisely detect enums.
The current enum detection is overly aggressive. As NestingLevel only
applies per line (?) it classifies many if not most object literals as
enum declarations and adds superfluous line breaks into them. This
change narrows the heuristic by requiring an assignment just before the
open brace and requiring the line to start with an identifier.

Patch by Martin Probst. Thank you.

llvm-svn: 232320
2015-03-15 13:55:54 +00:00
Daniel Jasper 9ecb0e96b8 clang-format: Don't corrupt macros with open braces.
Formatting:
  #define A { {
  #define B } }

Before:
  #define A               \
    {                     \
      { #define B }       \
    }

After:
  #define A               \
    {                     \
      {
  #define B               \
    }                     \
    }

This fixes llvm.org/PR22884.

llvm-svn: 232166
2015-03-13 13:32:11 +00:00
Daniel Jasper 55ca608cdc clang-format: [OBJC] Don't indent 8 spaces in method declarations.
Before:
  - (void)aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
          (SoooooooooooooooooooooomeType *)bbbbbbbbbb;

After:
  - (void)aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
      (SoooooooooooooooooooooomeType *)bbbbbbbbbb;

llvm-svn: 232112
2015-03-12 22:13:45 +00:00
Daniel Jasper b754a747be clang-format: When putting */& next to types, also wrap before them.
Before:
  LoooooooooooongType *
      loooooooooooongVariable;

After:
  LoooooooooooongType
      *loooooooooooongVariable;

llvm-svn: 232044
2015-03-12 15:04:53 +00:00
Daniel Jasper 6acf513099 clang-format: [Java] Support anonymous classes after = and return.
Before:
  A a = new A(){public String toString(){return "NotReallyA";
  }
  }
  ;

After:
  A a = return new A() {
    public String toString() {
      return "NotReallyA";
    }
  };

This fixes llvm.org/PR22878.

llvm-svn: 232042
2015-03-12 14:44:29 +00:00
Daniel Jasper 8c68a64ec8 clang-format: Recognize the .ts (TypeScript) extension as JavaScript.
Patch by Martin Probst. Thank you.

llvm-svn: 231926
2015-03-11 14:58:38 +00:00
Daniel Jasper dc4f725673 clang-format: Fix incorrect && recognition.
Before:
  if (a &&(b = c)) ..

After:
  if (a && (b = c)) ..

llvm-svn: 231920
2015-03-11 12:59:49 +00:00
Benjamin Kramer 8407df72a3 Make helper functions static. NFC.
Found by -Wmissing-prototypes.

llvm-svn: 231668
2015-03-09 16:47:52 +00:00
Daniel Jasper ac5c97e36b clang-format: Don't remove newline if macro ends in access specifier.
I.e.:

  #define A public:

  // The new line before this line would be removed.
  int a;

llvm-svn: 231636
2015-03-09 08:13:55 +00:00
Benjamin Kramer 28b45ce151 Make constant static variables const so they can go into a read-only section
NFC.

llvm-svn: 231597
2015-03-08 16:06:46 +00:00
Daniel Jasper 98f8ae34da clang-format: Slightly change indentation rules in for loops.
There was already a TODO to double-check whether the extra indenation
makes sense. A slightly different case reveals that it is actively harmful:

  for (int i = 0; i < aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||
                      bbbbbbbbbbbbbbbbbbbb < ccccccccccccccc;
       ++i) {
  }

Here (and it is probably not a totally infrequent case, it just works out that
"i < " is four spaces and so the four space extra indentation makes the
operator precedence confusing. So, this will now instead be formatted
as:

  for (int i = 0; i < aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ||
                  bbbbbbbbbbbbbbbbbbbb < ccccccccccccccc;
       ++i) {
  }

llvm-svn: 231461
2015-03-06 10:57:12 +00:00
Manuel Klimek 2d29340095 Make sure we initialize all values in WhitespaceManager::Change.
llvm-svn: 231067
2015-03-03 14:21:48 +00:00
Daniel Jasper 0391e55650 clang-format: Fix access to uninitialized memory.
With incomplete code, we aren't guaranteed to generated changes for
every token. In that case, we need to assume that even the very first
change can continue a preprocessor directive and initialize values
accordingly.

llvm-svn: 231066
2015-03-03 13:59:49 +00:00
Daniel Jasper e662316994 clang-format: Prefer wrapping a lambda's body over the lambda's return type.
Before:
  aaaaaaaaaaaaaaaaaaaaaa(
      [](aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa)
          -> aaaaaaaaaaaaaaaaaaaaa { return aaaaaaaaaaaaaaaaa; });

After:
  aaaaaaaaaaaaaaaaaaaaaa(
      [](aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa) -> aaaaaaaaaaaaaaaaaaaaa {
        return aaaaaaaaaaaaaaaaa;
      });

llvm-svn: 230942
2015-03-02 10:35:13 +00:00
Benjamin Kramer 33335df819 Add missing include.
llvm-svn: 230910
2015-03-01 21:36:40 +00:00
Daniel Jasper bea1ab46d9 clang-format: Always align */& in multi-var DeclStmts.
Seems like the most consistent thing to do and in multi-var DeclStmts,
it is especially important to point out that the */& bind to the
identifier.

llvm-svn: 230903
2015-03-01 18:55:26 +00:00
Daniel Jasper 308062bd0d clang-format: Make trailing commas in array inits force one per line.
Before:
  NSArray *array = @[ @"a", @"a", ];

After:
  NSArray *array = @[
    @"a",
    @"a",
  ];

llvm-svn: 230741
2015-02-27 08:41:05 +00:00
Daniel Jasper b812e323fa clang-format: Make braced list formatting more consistent.
Before:
  Aaaa aaaaaaaaaaa{
      {
       a, // +1 indent weird.
       b, // trailing comma signals one per line.
      },  // trailing comma signals one per line.
  };

After:
  Aaaa aaaaaaaaaaa{
      {
          a, // better!?
          b, // trailing comma signals one per line.
      },     // trailing comma signals one per line.
  };

Interesting that this apparently was entirely untested :-(.

llvm-svn: 230627
2015-02-26 11:46:29 +00:00
Daniel Jasper beaa322c36 clang-format: Fix space of arrays of pointers to templated types.
Before:
  vector<int>(*foo_)[6];

After:
  vector<int> (*foo_)[6];

llvm-svn: 230625
2015-02-26 11:30:50 +00:00
Daniel Jasper a42de763ac clang-format: Allow breaking after "else if(" as a last resort.
This isn't generally nice, but better than violating the column limit.

llvm-svn: 230620
2015-02-26 09:49:08 +00:00
Daniel Jasper 1c22048834 clang-format: Fix spacing for function with ref-qualification ..
.. when using SpacesInCStyleCastParentheses != SpacesInParentheses.

Before:
  FormatStyle Spaces = getLLVMStyle();
  Deleted &operator=(const Deleted &)& = default;

  Spaces.SpacesInParentheses = true;
  Deleted(const Deleted &)& = default;

  Spaces.SpacesInCStyleCastParentheses = true;
  Spaces.SpacesInParentheses= false;
  Deleted( const Deleted & )& = default;

After:
  FormatStyle Spaces = getLLVMStyle();
  Deleted &operator=(const Deleted &)& = default;;

  Spaces.SpacesInParentheses= true;
  Deleted( const Deleted & )& = default;

  Spaces.SpacesInCStyleCastParentheses = true;
  Spaces.SpacesInParentheses= false;
  Deleted(const Deleted &)& = default;

Patch by Jean-Philippe Dufraigne. Thank you!

llvm-svn: 230473
2015-02-25 10:30:06 +00:00
Jacques Pienaar 411b251cea clang-format: Change location of stashed token
Commit of patch in http://reviews.llvm.org/D7871

llvm-svn: 230395
2015-02-24 23:23:24 +00:00
Jacques Pienaar 68a7dbf86d Fix merging of << at end of input.
Commit of review http://reviews.llvm.org/D7766

llvm-svn: 230061
2015-02-20 21:09:01 +00:00
Daniel Jasper a0ef4f36c8 clang-format: [js] Support template strings.
Merge template strings (marked by backticks ``).
Do not format any contents of template strings.

Patch by Martin Probst. Thank you.

llvm-svn: 230011
2015-02-20 13:47:38 +00:00
Daniel Jasper fca735cd58 clang-format: [js] Support ES6 module exports.
Patch by Martin Probst, thank you!

llvm-svn: 229865
2015-02-19 16:14:18 +00:00
Daniel Jasper 354aa51587 clang-format: [js] Support ES6 module imports.
Patch by Martin Probst.

llvm-svn: 229863
2015-02-19 16:07:32 +00:00
Daniel Jasper 6fa9ec7885 clang-format: [js] Do not fall through for JS structural elements.
Patch by Martin Probst. Thank you.

llvm-svn: 229862
2015-02-19 16:03:16 +00:00
Jacques Pienaar fc27511223 clang-format: Space and triple angle braces.
Committing patch http://reviews.llvm.org/D6800.

llvm-svn: 229783
2015-02-18 23:48:37 +00:00
Daniel Jasper 3c42dba2dc clang-format: [JS] support AtScript style annotations for JS.
Based on Java annotation support and style.

Patch by Martin Probst.

llvm-svn: 229703
2015-02-18 17:17:15 +00:00
Daniel Jasper 8370908667 clang-format: [JS] Support classes.
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
2015-02-18 17:14:05 +00:00
Daniel Jasper b10bdff337 clang-format: [JS] Support type annotations.
This patch adds support for type annotations that follow TypeScript's,
Flow's, and AtScript's syntax style.

Patch by Martin Probst, thank you.
Review: http://reviews.llvm.org/D7721

llvm-svn: 229700
2015-02-18 17:09:53 +00:00
Daniel Jasper 699631298e clang-format: Don't force a break after "endl" if everything fits on one line.
llvm-svn: 229486
2015-02-17 10:05:15 +00:00
Daniel Jasper d97d5d5cf7 clang-format: Fix crasher.
llvm-svn: 229485
2015-02-17 09:58:03 +00:00
Aaron Ballman abc1892057 Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; Clang edition.
llvm-svn: 229339
2015-02-15 22:54:08 +00:00
Benjamin Kramer c5bc3cd00b Format: Make FormatToken's isOneOf a variadic template
llvm-svn: 229326
2015-02-15 20:11:14 +00:00