forked from OSchip/llvm-project
				
			Fix spacing after binary operator as macro parameter.
Before: COMPARE(a, == , b); After: COMPARE(a, ==, b); llvm-svn: 176241
This commit is contained in:
		
							parent
							
								
									4c9300e630
								
							
						
					
					
						commit
						d8ffcfa9b8
					
				| 
						 | 
					@ -1048,7 +1048,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
 | 
				
			||||||
           Tok.Parent->Type == TT_TemplateCloser &&
 | 
					           Tok.Parent->Type == TT_TemplateCloser &&
 | 
				
			||||||
           Style.Standard != FormatStyle::LS_Cpp11;
 | 
					           Style.Standard != FormatStyle::LS_Cpp11;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (Tok.Type == TT_BinaryOperator || Tok.Parent->Type == TT_BinaryOperator)
 | 
					  if (Tok.Type == TT_BinaryOperator ||
 | 
				
			||||||
 | 
					      (Tok.Parent->Type == TT_BinaryOperator && Tok.isNot(tok::comma)))
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  if (Tok.Parent->Type == TT_TemplateCloser && Tok.is(tok::l_paren))
 | 
					  if (Tok.Parent->Type == TT_TemplateCloser && Tok.is(tok::l_paren))
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1709,6 +1709,10 @@ TEST_F(FormatTest, UnderstandsTemplateParameters) {
 | 
				
			||||||
  verifyFormat("template <typename T> void f() {}");
 | 
					  verifyFormat("template <typename T> void f() {}");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_F(FormatTest, UnderstandsBinaryOperators) {
 | 
				
			||||||
 | 
					  verifyFormat("COMPARE(a, ==, b);");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_F(FormatTest, UnderstandsUnaryOperators) {
 | 
					TEST_F(FormatTest, UnderstandsUnaryOperators) {
 | 
				
			||||||
  verifyFormat("int a = -2;");
 | 
					  verifyFormat("int a = -2;");
 | 
				
			||||||
  verifyFormat("f(-1, -2, -3);");
 | 
					  verifyFormat("f(-1, -2, -3);");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue