clang-format: [Proto] Support extending message.
Before:
  extend.foo.Bar {
  }
After:
  extend .foo.Bar {
  }
llvm-svn: 253667
			
			
This commit is contained in:
		
							parent
							
								
									1f73ba6053
								
							
						
					
					
						commit
						d8d9839ae6
					
				| 
						 | 
				
			
			@ -553,6 +553,7 @@ struct AdditionalKeywords {
 | 
			
		|||
 | 
			
		||||
    kw_mark = &IdentTable.get("mark");
 | 
			
		||||
 | 
			
		||||
    kw_extend = &IdentTable.get("extend");
 | 
			
		||||
    kw_option = &IdentTable.get("option");
 | 
			
		||||
    kw_optional = &IdentTable.get("optional");
 | 
			
		||||
    kw_repeated = &IdentTable.get("repeated");
 | 
			
		||||
| 
						 | 
				
			
			@ -597,6 +598,7 @@ struct AdditionalKeywords {
 | 
			
		|||
  IdentifierInfo *kw_mark;
 | 
			
		||||
 | 
			
		||||
  // Proto keywords.
 | 
			
		||||
  IdentifierInfo *kw_extend;
 | 
			
		||||
  IdentifierInfo *kw_option;
 | 
			
		||||
  IdentifierInfo *kw_optional;
 | 
			
		||||
  IdentifierInfo *kw_repeated;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1949,7 +1949,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
 | 
			
		|||
  } else if (Style.Language == FormatStyle::LK_Proto) {
 | 
			
		||||
    if (Right.is(tok::period) &&
 | 
			
		||||
        Left.isOneOf(Keywords.kw_optional, Keywords.kw_required,
 | 
			
		||||
                     Keywords.kw_repeated))
 | 
			
		||||
                     Keywords.kw_repeated, Keywords.kw_extend))
 | 
			
		||||
      return true;
 | 
			
		||||
    if (Right.is(tok::l_paren) &&
 | 
			
		||||
        Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,5 +162,10 @@ TEST_F(FormatTestProto, FormatsService) {
 | 
			
		|||
               "};");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_F(FormatTestProto, ExtendingMessage) {
 | 
			
		||||
  verifyFormat("extend .foo.Bar {\n"
 | 
			
		||||
               "}");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // end namespace tooling
 | 
			
		||||
} // end namespace clang
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue