|  | Commit message (Collapse) | Author | Age | Files | Lines | 
|---|
| | 
| 
| 
| 
| 
| 
| | This is desirable for the Chromium style guide:
http://www.chromium.org/developers/coding-style
llvm-svn: 219400 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  SomeFunction(a, a,
               // comment
                      b + x);
After:
  SomeFunction(a, a,
               // comment
               b + x);
llvm-svn: 219209 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  #define LENGTH(x, y) (x) - (y)+1
After:
  #define LENGTH(x, y) (x) - (y) + 1
llvm-svn: 219119 | 
| | 
| 
| 
| 
| 
| | NFC.
llvm-svn: 219000 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | Specifically, this also counts for stuff like (with style "inline"):
  var x = function() {
    return 1;
  };
llvm-svn: 218689 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  getSomeLongPromise(.....)
      .then(
           function(value) {
             body();
             body();
           })
      .thenCatch(function(error) {
    body();
    body();
  });
After:
  getSomeLongPromise(.....)
      .then(function(value) {
        body();
        body();
      })
      .thenCatch(function(error) {
        body();
        body();
      });
llvm-svn: 218595 | 
| | 
| 
| 
| 
| 
| 
| | Chromium's now using some c++11 language features, so it's now fine that
clang-format produces vector<vector<int>>.
llvm-svn: 218392 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  return ('aaa')in bbbb;
After:
  return ('aaa') in bbbb;
llvm-svn: 218119 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | This patch only considers the difference between the length of the
shortest and longest element, but we might want to look at other
features (token count, etc.) in future.
Before:
  std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
      aaaaaaa,      aaaaaaaaaa,
      aaaaa,        aaaaaaaaaaaaaaa,
      aaa,          aaaaaaaaaa,
      a,            aaaaaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa,
      aaaaaaa,      a};
After:
  std::vector<MyValues> aaaaaaaaaaaaaaaaaaa{
      aaaaaaa, aaaaaaaaaa, aaaaa, aaaaaaaaaaaaaaa, aaa, aaaaaaaaaa, a,
      aaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaa, aaaaaaa, a};
llvm-svn: 218111 | 
| | 
| 
| 
| 
| 
| | It has proven to not be a food idea in many case.
llvm-svn: 218107 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  asm volatile("nop" :: : "memory");
After:
  asm volatile("nop" ::: "memory");
Patch by Eugene Toder. Thank you.
llvm-svn: 217883 | 
| | 
| 
| 
| | llvm-svn: 217759 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| | This will allow:
  int aaaaaaaaaaaaaa =
      bbbbbbbbbbbbbb
      + ccccccccccccccc;
llvm-svn: 217757 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  EXPECT_CALL(SomeObject, SomeFunction(Parameter)).Times(2).WillRepeatedly(
      Return(SomeValue));
After:
  EXPECT_CALL(SomeObject, SomeFunction(Parameter))
      .Times(2)
      .WillRepeatedly(Return(SomeValue));
llvm-svn: 217687 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Summary:
http://llvm.org/bugs/show_bug.cgi?id=20892
Add support of C-style formatting enabling/disabling directives. Now the following two styles are supported:
  // clang-format on
  /* clang-format on */
The flexibility in comments (support of extra spaces and/or slashes, etc.) is deliberately avoided to simplify search in large code bases.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits, curdeius, klimek
Differential Revision: http://reviews.llvm.org/D5309
llvm-svn: 217588 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | On a single line:
  switch (a) {
  case 1: x = 1; return;
  case 2: x = 2; return;
  default: break;
  }
Not on a single line:
  switch (a) {
  case 1:
    x = 1;
    return;
  case 2:
    x = 2;
    return;
  default:
    break;
  }
This partly addresses llvm.org/PR16535. In the long run, we probably want to
lay these out in columns.
llvm-svn: 217501 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  var regex = / a\//; int i;
After:
  var regex = /a\//;
  int i;
This required pushing the Lexer into its wrapper class and generating a
new one in this specific case. Otherwise, the sequence get lexed as a
//-comment. This is hacky, but I don't know a better way (short of
supporting regex literals in the Lexer).
Pushing the Lexer down seems to make all the call sites simpler.
llvm-svn: 217444 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  return {
    a: a,
    link:
        function() {
          f();  //
        },
    link:
        function() {
          f();  //
        }
  };
After:
  return {
    a: a,
    link: function() {
      f();  //
    },
    link: function() {
      f();  //
    }
  };
llvm-svn: 217238 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  SomeFunction(function(){});
After:
  SomeFunction(function() {});
llvm-svn: 217236 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  return {
    'finish':
        //
        a
        };
After:
  return {
    'finish':
        //
        a
  };
llvm-svn: 217235 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  not. and . or . not_eq = 1;
After:
  not.and.or.not_eq = 1;
llvm-svn: 217179 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  someObject.catch ();
After:
  someObject.catch();
llvm-svn: 217158 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  decltype(* ::std::declval<const T &>()) void F();
After:
  decltype(*::std::declval<const T &>()) void F();
llvm-svn: 216724 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | ownership is explicitly done using unique_ptr.
Only those callers who are dynamically passing ownership should need the
3 argument form. Those accepting the default ("do pass ownership")
should do so explicitly with a unique_ptr now.
llvm-svn: 216614 | 
| | 
| 
| 
| | llvm-svn: 216585 | 
| | 
| 
| 
| | llvm-svn: 216565 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  Node n{1, Node{1000}, //
                2};
After:
  Node n{1, Node{1000}, //
         2};
llvm-svn: 216540 | 
| | 
| 
| 
| 
| 
| 
| 
| | Instead completely cop out of formatting them for now.
This fixes llvm.org/PR20618.
llvm-svn: 216501 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  std::vector<int> v = {
      1, 0 /* comment */
  };
After:
  std::vector<int> v = {1, 0 /* comment */};
llvm-svn: 216445 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | This fixed llvm.org/PR20712.
Before:
  int i = (int)(int) -2;
After:
  int i = (int)(int)-2;
llvm-svn: 216378 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  f(FirstToken->WhitespaceRange.getBegin().getLocWithOffset(
      First->LastNewlineOffset));
After:
  f(FirstToken->WhitespaceRange.getBegin()
        .getLocWithOffset(First->LastNewlineOffset));
llvm-svn: 216377 | 
| | 
| 
| 
| 
| 
| | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording.
llvm-svn: 215982 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  x = * a(x) = *a(y);
After:
  x = *a(x) = *a(y);
llvm-svn: 215632 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(
      const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
  typedef size_t (*aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)(
      const aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa *
          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 215631 | 
| | 
| 
| 
| 
| 
| | Modifications made by clang-tidy with minor tweaks.
llvm-svn: 215557 | 
| | 
| 
| 
| | llvm-svn: 215549 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | After (even with BinPacking = false):
  const Aaaaaa aaaaa = {
      aaaaa,  bbbbb,  ccccc,  ddddd,  eeeee,  ffffff, ggggg, hhhhhh,
      iiiiii, jjjjjj, kkkkkk, aaaaa,  bbbbb,  ccccc,  ddddd, eeeee,
      ffffff, ggggg,  hhhhhh, iiiiii, jjjjjj, kkkkkk,
  };
Before:
  <each element on its own line>
This fixes http://llvm.org/PR20623.
llvm-svn: 215529 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  #define MY_IMPORT < a / b >
After:
  #define MY_IMPORT <a/b>
llvm-svn: 215527 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  int
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(const
                                typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa);
After:
  int aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      const typename aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa);
llvm-svn: 215442 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | 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 | 
| | 
| 
| 
| 
| 
| | ScopedLineState
llvm-svn: 215294 | 
| | 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| 
| | Before:
  string abc =
      SomeFunction(aaaaaaaaaaaaa, aaaaa,
                   []() { SomeOtherFunctioooooooooooooooooooooooooon(); });
After:
  string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() {
    SomeOtherFunctioooooooooooooooooooooooooon();
  });
llvm-svn: 215197 | 
| | 
| 
| 
| | llvm-svn: 214976 |