Formatting: In @implementation etc lines, put a space before protocol lists.

Don't do this in Google style though:
http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml#Protocols

Most other places (function declarations, variable declarations) still get
this wrong, and since this looks very similiar to template instantiations to
the lexer (`id <MyProtocol> a = ...`), it's going to be hard to fix in some
places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172099 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index f22c0ab..d721536 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -104,6 +104,7 @@
   LLVMStyle.SplitTemplateClosingGreater = true;
   LLVMStyle.IndentCaseLabels = false;
   LLVMStyle.SpacesBeforeTrailingComments = 1;
+  LLVMStyle.ObjCSpaceBeforeProtocolList = true;
   return LLVMStyle;
 }
 
@@ -116,6 +117,7 @@
   GoogleStyle.SplitTemplateClosingGreater = false;
   GoogleStyle.IndentCaseLabels = true;
   GoogleStyle.SpacesBeforeTrailingComments = 2;
+  GoogleStyle.ObjCSpaceBeforeProtocolList = false;
   return GoogleStyle;
 }
 
@@ -974,7 +976,9 @@
       return Right.is(tok::hash);
     if (Right.is(tok::r_paren) || Right.is(tok::semi) || Right.is(tok::comma))
       return false;
-    if (Left.is(tok::kw_template) && Right.is(tok::less))
+    if (Right.is(tok::less) &&
+        (Left.is(tok::kw_template) ||
+         (CurrentLineType == LT_ObjCDecl && Style.ObjCSpaceBeforeProtocolList)))
       return true;
     if (Left.is(tok::arrow) || Right.is(tok::arrow))
       return false;