d492b5ec03 
								
							 
						 
						
							
							
								
								clang-format: [JS] Array literal detection  fix   #4 .  
							
							... 
							
							
							
							llvm-svn: 238873 
							
						 
						
							2015-06-02 21:57:51 +00:00  
				
					
						
							
							
								 
						
							
								40432cee93 
								
							 
						 
						
							
							
								
								clang-format: [JS] Array literal detection  fix   #3 .  
							
							... 
							
							
							
							llvm-svn: 238839 
							
						 
						
							2015-06-02 15:04:29 +00:00  
				
					
						
							
							
								 
						
							
								4284e3623c 
								
							 
						 
						
							
							
								
								clang-format: [JS] Fix another regression when detecting array literals.  
							
							... 
							
							
							
							llvm-svn: 238835 
							
						 
						
							2015-06-02 14:20:08 +00:00  
				
					
						
							
							
								 
						
							
								5ce80de4de 
								
							 
						 
						
							
							
								
								clang-format: [JS] Fix regression of detecting array literals.  
							
							... 
							
							
							
							llvm-svn: 238832 
							
						 
						
							2015-06-02 13:56:43 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								3273930d9a 
								
							 
						 
						
							
							
								
								clang-format: Fix false positive in function annotation detection.  
							
							... 
							
							
							
							llvm-svn: 238285 
							
						 
						
							2015-05-27 04:55:47 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								f090f031bc 
								
							 
						 
						
							
							
								
								clang-format: Support function annotations in macros.  
							
							... 
							
							
							
							Before:
  DEPRECATED("Use NewClass::NewFunction instead.") string
      OldFunction(const string ¶meter) {}
After:
  DEPRECATED("Use NewClass::NewFunction instead.")
  string OldFunction(const string ¶meter) {}
llvm-svn: 237562 
							
						 
						
							2015-05-18 09:47:22 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								62c78f5474 
								
							 
						 
						
							
							
								
								clang-format: Prevent assertion discovered by fuzzer.  
							
							... 
							
							
							
							llvm-svn: 236578 
							
						 
						
							2015-05-06 08:58:57 +00:00  
				
					
						
							
							
								 
						
							
								4d9ec17f1e 
								
							 
						 
						
							
							
								
								clang-format: Prevent exponential runtime in token annotator.  
							
							... 
							
							
							
							llvm-svn: 236577 
							
						 
						
							2015-05-06 08:38:24 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								66cb8c503f 
								
							 
						 
						
							
							
								
								clang-format: NFC: Delete FormatToken::IsForEachMacro. Use a TokenType instead.  
							
							... 
							
							
							
							llvm-svn: 236415 
							
						 
						
							2015-05-04 09:22:29 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								d9309774a6 
								
							 
						 
						
							
							
								
								clang-format: [JS] Support index signature types.  
							
							... 
							
							
							
							Patch by Martin Probst.
llvm-svn: 234754 
							
						 
						
							2015-04-13 15:03:30 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								354aa51587 
								
							 
						 
						
							
							
								
								clang-format: [js] Support ES6 module imports.  
							
							... 
							
							
							
							Patch by Martin Probst.
llvm-svn: 229863 
							
						 
						
							2015-02-19 16:07:32 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								fac2371be3 
								
							 
						 
						
							
							
								
								clang-format: Add support for SEH __try / __except / __finally blocks.  
							
							... 
							
							
							
							This lets clang-format format
    __try {
    } __except(0) {
    }
and
    __try {
    } __finally {
    }
correctly. __try and __finally are keywords if `LangOpts.MicrosoftExt` is set,
so this turns this on.  This also enables a few other keywords, but it
shouldn't overly perturb regular clang-format operation.  __except is a
context-sensitive keyword, so `AdditionalKeywords` needs to be passed around to
a few more places.
Fixes PR22321.
llvm-svn: 228148 
							
						 
						
							2015-02-04 15:26:27 +00:00  
				
					
						
							
							
								 
						
							
								7509216a41 
								
							 
						 
						
							
							
								
								clang-format: Fix incorrect classification of "*".  
							
							... 
							
							
							
							Before:
  *a = b *c;
After:
  *a = b * c;
llvm-svn: 226923 
							
						 
						
							2015-01-23 19:04:49 +00:00  
				
					
						
							
							
								 
						
							
								d1debfc2bb 
								
							 
						 
						
							
							
								
								clang-format: Fix bad memory access.  
							
							... 
							
							
							
							llvm-svn: 226680 
							
						 
						
							2015-01-21 18:04:02 +00:00  
				
					
						
							
							
								 
						
							
								9b79efb51f 
								
							 
						 
						
							
							
								
								clang-format: Fix crasher on weird comments.  
							
							... 
							
							
							
							Crashing input:
  /\
  / comment
llvm-svn: 226454 
							
						 
						
							2015-01-19 11:49:32 +00:00  
				
					
						
							
							
								 
						
							
								193cdd381b 
								
							 
						 
						
							
							
								
								clang-format: Fix crasher on incomplete condition compilation.  
							
							... 
							
							
							
							Previously crashing input:
  void f(
  #if A
      );
  #else
  #endif
llvm-svn: 226451 
							
						 
						
							2015-01-19 10:52:16 +00:00  
				
					
						
							
							
								 
						
							
								e189d46512 
								
							 
						 
						
							
							
								
								clang-format: [Java] Support try blocks with resources.  
							
							... 
							
							
							
							Before:
  try
    (SomeResource rs = someFunction()) {
      Something();
    }
After:
  try (SomeResource rs = someFunction()) {
    Something();
  }
llvm-svn: 225973 
							
						 
						
							2015-01-14 10:48:41 +00:00  
				
					
						
							
							
								 
						
							
								190fbda6de 
								
							 
						 
						
							
							
								
								clang-format: [Java] Prefer not to break in parameter annotations.  
							
							... 
							
							
							
							Before:
  boolean someFunction(@Param(aaaaaaaaaaaaaaaa)
                       String aaaaa,
      String bbbbbbbbbbbbbbb) {}
After:
  boolean someFunction(
      @Param(aaaaaaaaaaaaaaaa) String aaaaa,
      String bbbbbbbbbbbbbbb) {}
llvm-svn: 225971 
							
						 
						
							2015-01-14 10:36:31 +00:00  
				
					
						
							
							
								 
						
							
								16dbe0bc44 
								
							 
						 
						
							
							
								
								clang-format: [Java] Understand "import static".  
							
							... 
							
							
							
							llvm-svn: 225965 
							
						 
						
							2015-01-14 10:02:49 +00:00  
				
					
						
							
							
								 
						
							
								404658aede 
								
							 
						 
						
							
							
								
								clang-format: [Java] Don't let annotations confuse return type analysis.  
							
							... 
							
							
							
							Before:
  @Test 
  ReturnType
  doSomething(String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {}
After:
  @Test 
  ReturnType doSomething(
      String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {}
llvm-svn: 225964 
							
						 
						
							2015-01-14 10:00:20 +00:00  
				
					
						
							
							
								 
						
							
								3e1bd1407b 
								
							 
						 
						
							
							
								
								clang-format: [Java] Don't line-wrap before annotations' l_parens.  
							
							... 
							
							
							
							Before:
  @SomeAnnotation
  (aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;
After:
  @SomeAnnotation(
      aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;
llvm-svn: 225963 
							
						 
						
							2015-01-14 09:51:32 +00:00  
				
					
						
							
							
								 
						
							
								a831c58e53 
								
							 
						 
						
							
							
								
								clang-format: [Java] Don't get confused by leading annotations.  
							
							... 
							
							
							
							Before:
  @Test(a)
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaa);
After:
  @Test(a)
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa);
llvm-svn: 225962 
							
						 
						
							2015-01-14 09:47:57 +00:00  
				
					
						
							
							
								 
						
							
								ed50166b6b 
								
							 
						 
						
							
							
								
								clang-format: [Java] Detect `native` keyword.  
							
							... 
							
							
							
							Before:
  public native<X> Foo foo();
After:
  public native <X> Foo foo();
llvm-svn: 225839 
							
						 
						
							2015-01-13 22:32:50 +00:00  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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  
				
					
						
							
							
								 
						
							
								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