beb03938e9 
								
							 
						 
						
							
							
								
								clang-format: [Java] Support formatting qualified annotations.  
							
							... 
							
							
							
							llvm-svn: 225559 
							
						 
						
							2015-01-09 23:25:06 +00:00  
				
					
						
							
							
								 
						
							
								d05d3a8919 
								
							 
						 
						
							
							
								
								clang-format: Force line break between "endl" and "<<".  
							
							... 
							
							
							
							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 
							
						 
						
							2015-01-08 13:56:57 +00:00  
				
					
						
							
							
								 
						
							
								b13135bc08 
								
							 
						 
						
							
							
								
								clang-format: Improve template parameter detection.  
							
							... 
							
							
							
							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 
							
						 
						
							2015-01-08 08:48:21 +00:00  
				
					
						
							
							
								 
						
							
								4953210478 
								
							 
						 
						
							
							
								
								clang-format: Understand single-line comments at the end of blocks.  
							
							... 
							
							
							
							This prevents clang-format from moving/aligning the comment in the
snippet:
  void f() {
    int i; // some comment
    // some unrelated comment
  }
llvm-svn: 225352 
							
						 
						
							2015-01-07 14:00:11 +00:00  
				
					
						
							
							
								 
						
							
								6a9682038f 
								
							 
						 
						
							
							
								
								clang-format: Fix unary operator detection.  
							
							... 
							
							
							
							Before:
  ** outparam = 1;
After:
  **outparam = 1;
llvm-svn: 225349 
							
						 
						
							2015-01-07 12:19:53 +00:00  
				
					
						
							
							
								 
						
							
								77ef2be2e4 
								
							 
						 
						
							
							
								
								clang-format: [Java] Fix incorrect detection of cast.  
							
							... 
							
							
							
							After:
  return (a instanceof List<?>) ? aaaaaaaaaaaaaaaaaaaaaaa(
                                      aaaaaaaaaaaaaaaaaaaaa)
                                : aaaaaaaaaaaaaaaaaaaaaaa;
After:
  return (a instanceof List<?>)
      ? aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)
      : aaaaaaaaaaaaaaaaaaaaaaa;
llvm-svn: 225161 
							
						 
						
							2015-01-05 10:33:39 +00:00  
				
					
						
							
							
								 
						
							
								5f1fa85e5b 
								
							 
						 
						
							
							
								
								clang-format: [Java] Fix incorrect recognition of annonymous classes.  
							
							... 
							
							
							
							Before:
  someFunction(new Runnable() { public void run() { System.out.println(42);
  }
  });
After:
  someFunction(new Runnable() {
    public void run() {
      System.out.println(42);
    }
  });
llvm-svn: 225142 
							
						 
						
							2015-01-04 20:40:51 +00:00  
				
					
						
							
							
								 
						
							
								428f0b1430 
								
							 
						 
						
							
							
								
								clang-format: Re-enable comment re-indentation for Java/JS.  
							
							... 
							
							
							
							This was broken by r224120.
llvm-svn: 225130 
							
						 
						
							2015-01-04 09:11:17 +00:00  
				
					
						
							
							
								 
						
							
								3a623dbd2a 
								
							 
						 
						
							
							
								
								clang-format: Fix incorrect detection of ObjC "in" keyword.  
							
							... 
							
							
							
							Before:
  for (auto v : in [1]) { ..
After:
  for (auto v : in[1]) { ..
llvm-svn: 224513 
							
						 
						
							2014-12-18 12:11:01 +00:00  
				
					
						
							
							
								 
						
							
								0580ff0ec6 
								
							 
						 
						
							
							
								
								clang-format: Fix incorrect calculation of token lenghts.  
							
							... 
							
							
							
							This led, e.g. to break JavaScript regex literals too early.
llvm-svn: 224419 
							
						 
						
							2014-12-17 09:11:08 +00:00  
				
					
						
							
							
								 
						
							
								732b6bd4d1 
								
							 
						 
						
							
							
								
								Don't break single-line raw string literals.  
							
							... 
							
							
							
							Reviewers: djasper
Reviewed By: djasper
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D6636 
llvm-svn: 224223 
							
						 
						
							2014-12-14 20:47:11 +00:00  
				
					
						
							
							
								 
						
							
								ff2437fe84 
								
							 
						 
						
							
							
								
								Don't break string literals in Java and JavaScript.  
							
							... 
							
							
							
							The proper way to break string literals in these languages is by inserting a "+"
between parts which we don't support yet. So we disable string literal breaking
until then.
llvm-svn: 224120 
							
						 
						
							2014-12-12 13:03:22 +00:00  
				
					
						
							
							
								 
						
							
								11a0ac66e1 
								
							 
						 
						
							
							
								
								clang-format: Revamp nested block formatting.  
							
							... 
							
							
							
							This fixed llvm.org/PR21804 and hopefully a few other strange cases.
Before:
    if (blah_blah(whatever, whatever, [] {
      doo_dah();
      doo_dah();
    })) {
    }
    }
After:
    if (blah_blah(whatever, whatever, [] {
          doo_dah();
          doo_dah();
        })) {
    }
    }
llvm-svn: 224112 
							
						 
						
							2014-12-12 09:40:58 +00:00  
				
					
						
							
							
								 
						
							
								238462627e 
								
							 
						 
						
							
							
								
								clang-format: Add a test for PR19603 which seems fixed (maybe by r221338?).  
							
							... 
							
							
							
							llvm-svn: 223850 
							
						 
						
							2014-12-09 23:22:35 +00:00  
				
					
						
							
							
								 
						
							
								a536df4b28 
								
							 
						 
						
							
							
								
								clang-format: Indent correctly in conditional expressions after return.  
							
							... 
							
							
							
							This only applies when not aligning after the return itself (which is
commonly done for C++.
Before:
  return aaaaaaaaaa
      ? bbbbbbbbbb(
             bbbbbb)  // This is indented relative to aaaaaaaaaa.
      : b;
After:
  return aaaaaaaaaa
      ? bbbbbbbbbb(
            bbbbbb)
      : b;
llvm-svn: 223694 
							
						 
						
							2014-12-08 21:28:31 +00:00  
				
					
						
							
							
								 
						
							
								211e1329cc 
								
							 
						 
						
							
							
								
								clang-format: [Java] Always break after annotations of multiline decls.  
							
							... 
							
							
							
							Before:
  @Mock DataLoader loooooooooooooooooooooooader =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
After:
  @Mock
  DataLoader loooooooooooooooooooooooader =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
llvm-svn: 223688 
							
						 
						
							2014-12-08 20:08:04 +00:00  
				
					
						
							
							
								 
						
							
								3431b75069 
								
							 
						 
						
							
							
								
								clang-format: Support commas in lambda return types.  
							
							... 
							
							
							
							Before:
  auto next_pair = [](A * a) -> pair<A*, A*>{};
After:
  auto next_pair = [](A* a) -> pair<A*, A*>{};
llvm-svn: 223652 
							
						 
						
							2014-12-08 13:22:37 +00:00  
				
					
						
							
							
								 
						
							
								55aed6777f 
								
							 
						 
						
							
							
								
								clang-format: Don't merge lines with comments.  
							
							... 
							
							
							
							Before:
  int f() { // comment return 42; }
After:
  int f() { // comment
    return 42;
  }
This fixes llvm.org/PR21769.
llvm-svn: 223609 
							
						 
						
							2014-12-07 16:44:49 +00:00  
				
					
						
							
							
								 
						
							
								31f6c54733 
								
							 
						 
						
							
							
								
								clang-format: Support NS_OPTIONS, CF_ENUM and CF_OPTIONS.  
							
							... 
							
							
							
							This fixes llvm.org/PR21756.
llvm-svn: 223458 
							
						 
						
							2014-12-05 10:42:21 +00:00  
				
					
						
							
							
								 
						
							
								a4e55f4d1e 
								
							 
						 
						
							
							
								
								clang-format: [JS] Don't put top-level dict literals on a single line.  
							
							... 
							
							
							
							These are often used for enums which apparently are easier to read if
formatted with one element per line.
llvm-svn: 223367 
							
						 
						
							2014-12-04 16:07:17 +00:00  
				
					
						
							
							
								 
						
							
								86ee0b6daa 
								
							 
						 
						
							
							
								
								clang-format: More restrictively classify import declarations.  
							
							... 
							
							
							
							Before:
  import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
  import::SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                       aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 223345 
							
						 
						
							2014-12-04 08:57:27 +00:00  
				
					
						
							
							
								 
						
							
								c095663ec1 
								
							 
						 
						
							
							
								
								clang-format: Fix fake parentheses placement with comments.  
							
							... 
							
							
							
							Before:
  return (a > b
          // comment1
      // comment2
      || c);
After:
  return (a > b
      // comment1
      // comment2
      || c);
llvm-svn: 223234 
							
						 
						
							2014-12-03 14:02:59 +00:00  
				
					
						
							
							
								 
						
							
								8379107afe 
								
							 
						 
						
							
							
								
								clang-format: Fix expression parser not closing stuff at end of stmt.  
							
							... 
							
							
							
							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 
							
						 
						
							2014-12-03 13:20:49 +00:00  
				
					
						
							
							
								 
						
							
								3219e43c94 
								
							 
						 
						
							
							
								
								clang-format: Add option to suppress operator alignment.  
							
							... 
							
							
							
							With alignment:
  int aaaaaa = aa
               + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                     * cccccccccccccccccccccccccccccccc;
Without alignment:
  int aaaaaa = aa
      + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
          * cccccccccccccccccccccccccccccccc;
This fixes llvm.org/PR21666.
llvm-svn: 223117 
							
						 
						
							2014-12-02 13:24:51 +00:00  
				
					
						
							
							
								 
						
							
								8c6e9ef676 
								
							 
						 
						
							
							
								
								clang-format: precedence-based indentation when breaking before operators.  
							
							... 
							
							
							
							Before:
  bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
               == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                  + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
               && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                  > ccccccccccccccccccccccccccccccccccccccccc;
After:
  bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                       + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                       + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                   == aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                              * bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                          + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
               && aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                          * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                      > ccccccccccccccccccccccccccccccccccccccccc;
Not particularly pretty, but can probably help to uncover bugs. And if this
bugs somebody, parentheses can help.
llvm-svn: 223111 
							
						 
						
							2014-12-02 09:46:56 +00:00  
				
					
						
							
							
								 
						
							
								41368e9e07 
								
							 
						 
						
							
							
								
								clang-format: [JS] Contract fewer functions to a single line.  
							
							... 
							
							
							
							Before:
  var someVariable =
      function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); };
After:
  var someVariable = function(x) {
    return x.zIsTooLongForOneLineWithTheDeclarationLine();
  };
llvm-svn: 222893 
							
						 
						
							2014-11-27 15:37:42 +00:00  
				
					
						
							
							
								 
						
							
								4087432f8b 
								
							 
						 
						
							
							
								
								clang-format: [JS] Try not to break in container literals.  
							
							... 
							
							
							
							Before:
  var obj = {
    fooooooooo:
        function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }
  };
After:
  var obj = {
    fooooooooo: function(x) {
      return x.zIsTooLongForOneLineWithTheDeclarationLine();
    }
  };
llvm-svn: 222892 
							
						 
						
							2014-11-27 15:24:48 +00:00  
				
					
						
							
							
								 
						
							
								7912123893 
								
							 
						 
						
							
							
								
								clang-format: [JS] new and delete are valid function names.  
							
							... 
							
							
							
							Before:
  someObject.new ();
  someObject.delete ();
After:
  someObject.new();
  someObject.delete();
llvm-svn: 222890 
							
						 
						
							2014-11-27 14:55:17 +00:00  
				
					
						
							
							
								 
						
							
								53c38f4e79 
								
							 
						 
						
							
							
								
								clang-format: [JS] Make Closure module detection more narrow.  
							
							... 
							
							
							
							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 
							
						 
						
							2014-11-27 14:46:03 +00:00  
				
					
						
							
							
								 
						
							
								13404dad0d 
								
							 
						 
						
							
							
								
								clang-format: Don't use column layout with AlignAfterOpenBrackets.  
							
							... 
							
							
							
							This fixes llvm.org/PR21676.
llvm-svn: 222886 
							
						 
						
							2014-11-27 14:40:48 +00:00  
				
					
						
							
							
								 
						
							
								9b9e07608d 
								
							 
						 
						
							
							
								
								clang-format: [Java] Don't line-wrap package declarations.  
							
							... 
							
							
							
							This fixes llvm.org/PR21677.
llvm-svn: 222843 
							
						 
						
							2014-11-26 18:03:42 +00:00  
				
					
						
							
							
								 
						
							
								450425c980 
								
							 
						 
						
							
							
								
								clang-format: Tweak -style=Chromium for Java files.  
							
							... 
							
							
							
							For Java, don't do any of the deviations from Google Style that Chromium style
does for C++.
Chromium's Java follows Android Java style [1], which is roughly Google Java
style with an indent of 4 and a continuation indent of 8.
1: https://source.android.com/source/code-style.html 
llvm-svn: 222839 
							
						 
						
							2014-11-26 16:43:18 +00:00  
				
					
						
							
							
								 
						
							
								375815d24b 
								
							 
						 
						
							
							
								
								clang-format: [Java] Improve formatting of throws declarations.  
							
							... 
							
							
							
							Before:
  public void doSoooooooooo() throws LoooooooooongException,
      LooooooooooongException {}
After:
  public void doSoooooooooo()
      throws LoooooooooongException, LooooooooooongException {}
llvm-svn: 222829 
							
						 
						
							2014-11-26 12:31:19 +00:00  
				
					
						
							
							
								 
						
							
								4f56b0bb88 
								
							 
						 
						
							
							
								
								clang-format: [Java] Improve cast detection.  
							
							... 
							
							
							
							Before:
  a[b >> 1] = (byte)(c() << 4);
After:
  a[b >> 1] = (byte) (c() << 4);
llvm-svn: 222827 
							
						 
						
							2014-11-26 12:23:10 +00:00  
				
					
						
							
							
								 
						
							
								07013a42d2 
								
							 
						 
						
							
							
								
								clang-format: [Java] Fix breaking after annotations.  
							
							... 
							
							
							
							Before:
  @Annotation1 // comment
  @Annotation2 class C {}
After:
  @Annotation1 // comment
  @Annotation2
  class C {}
llvm-svn: 222825 
							
						 
						
							2014-11-26 11:20:43 +00:00  
				
					
						
							
							
								 
						
							
								9e709351c5 
								
							 
						 
						
							
							
								
								clang-format: Add SFS_Empty to only empty functions on a single line.  
							
							... 
							
							
							
							Activated for and tested by Google's Java style.
This fixes llvm.org/PR21667.
llvm-svn: 222819 
							
						 
						
							2014-11-26 10:43:58 +00:00  
				
					
						
							
							
								 
						
							
								e5d74867aa 
								
							 
						 
						
							
							
								
								clang-format: [Java] Support Foo.class;  
							
							... 
							
							
							
							Before:
  SomeClass.
  class.getName();
After:
  SomeClass.class.getName();
This fixes llvm.org/PR21665.
llvm-svn: 222813 
							
						 
						
							2014-11-26 08:17:08 +00:00  
				
					
						
							
							
								 
						
							
								a98b7b01be 
								
							 
						 
						
							
							
								
								clang-format: Refactoring.  
							
							... 
							
							
							
							Re-apply r222638 and r222641 without variadic templates.
llvm-svn: 222747 
							
						 
						
							2014-11-25 10:05:17 +00:00  
				
					
						
							
							
								 
						
							
								484ee9b404 
								
							 
						 
						
							
							
								
								Reverting r222638; it broke the MSVC build bots because Visual Studio 2012 does not support variadic templates. Also reverting r222641 because it was relying on 222638.  
							
							... 
							
							
							
							llvm-svn: 222656 
							
						 
						
							2014-11-24 15:42:34 +00:00  
				
					
						
							
							
								 
						
							
								79f226e780 
								
							 
						 
						
							
							
								
								clang-format: Make short case labels work with #ifs  
							
							... 
							
							
							
							Before:
  switch (a) {
  #if FOO
  case 0: return 0; #endif
  }
After:
  switch (a) {
  #if FOO
  case 0: return 0;
  #endif
  }
This fixed llvm.org/PR21544.
llvm-svn: 222642 
							
						 
						
							2014-11-23 21:45:03 +00:00  
				
					
						
							
							
								 
						
							
								325e486f9b 
								
							 
						 
						
							
							
								
								clang-format: [Java] Treat 'instanceof' like other binary operators.  
							
							... 
							
							
							
							This fixes llvm.org/PR21436.
llvm-svn: 222641 
							
						 
						
							2014-11-23 21:34:25 +00:00  
				
					
						
							
							
								 
						
							
								a0143fab5e 
								
							 
						 
						
							
							
								
								clang-format: [Java] Space before array initializers.  
							
							... 
							
							
							
							Before:
  new int[]{1, 2, 3, 4};
After:
  new int[] {1, 2, 3, 4};
llvm-svn: 222640 
							
						 
						
							2014-11-23 20:54:37 +00:00  
				
					
						
							
							
								 
						
							
								bb86d847ba 
								
							 
						 
						
							
							
								
								clang-format: Improve ObjC blocks with return type.  
							
							... 
							
							
							
							Before:
  Block b = ^int * (A * a, B * b) {}
After:
  Block b = ^int *(A *a, B *b) {}
This fixed llvm.org/PR21619.
llvm-svn: 222639 
							
						 
						
							2014-11-23 19:15:35 +00:00  
				
					
						
							
							
								 
						
							
								616de864da 
								
							 
						 
						
							
							
								
								clang-format: [JS] Support Closure's module statements.  
							
							... 
							
							
							
							These are like import statements and should not be line-wrapped. Minor
restructuring of the handling of other import statements.
llvm-svn: 222637 
							
						 
						
							2014-11-23 16:46:28 +00:00  
				
					
						
							
							
								 
						
							
								bcb55eec3a 
								
							 
						 
						
							
							
								
								clang-format: Understand more lambda return types.  
							
							... 
							
							
							
							Before:
  auto a = [&b, c ](D * d) -> D * {}
After:
 auto a = [&b, c](D* d) -> D* {}
llvm-svn: 222534 
							
						 
						
							2014-11-21 14:08:38 +00:00  
				
					
						
							
							
								 
						
							
								4b444495ed 
								
							 
						 
						
							
							
								
								clang-format: Use nested block special case for all languages.  
							
							... 
							
							
							
							Previously this was only used for JavaScript.
Before:
  functionCall({
                 int i;
                 int j;
               },
               aaaa, bbbb, cccc);
After:
  functionCall({
    int i;
    int j;
  }, aaaa, bbbb, cccc);
llvm-svn: 222531 
							
						 
						
							2014-11-21 13:38:53 +00:00  
				
					
						
							
							
								 
						
							
								d081e88e79 
								
							 
						 
						
							
							
								
								clang-format: Handle comments in short case labels.  
							
							... 
							
							
							
							With AllowShortCaseLabelsOnASingleLine set to true:
This gets now left unchanged:
  case 1:
    // comment
    return;
Whereas before it was changed into:
  case 1: // comment return;
This fixes llvm.org/PR21630.
llvm-svn: 222529 
							
						 
						
							2014-11-21 12:36:25 +00:00  
				
					
						
							
							
								 
						
							
								82c9275344 
								
							 
						 
						
							
							
								
								clang-format: [Java] Support more Java keywords.  
							
							... 
							
							
							
							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 
							
						 
						
							2014-11-21 12:19:07 +00:00  
				
					
						
							
							
								 
						
							
								8354ea84dd 
								
							 
						 
						
							
							
								
								clang-format: [Java] Basic lambda support.  
							
							... 
							
							
							
							llvm-svn: 222524 
							
						 
						
							2014-11-21 12:14:12 +00:00  
				
					
						
							
							
								 
						
							
								6cab6784b9 
								
							 
						 
						
							
							
								
								clang-format: [Java] Don't align after "return".  
							
							... 
							
							
							
							Doesn't seem to be common practice in Java.
Before:
  return aaaaaaaaaaaaaaaaaaa
         && bbbbbbbbbbbbbbbbbbb
         && ccccccccccccccccccc;
After:
  return aaaaaaaaaaaaaaaaaaa
      && bbbbbbbbbbbbbbbbbbb
      && ccccccccccccccccccc;
Patch by Harry Terkelsen.
llvm-svn: 222424 
							
						 
						
							2014-11-20 09:54:49 +00:00