summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-08-01 13:03:05 +0000
committerDaniel Jasper <djasper@google.com>2014-08-01 13:03:05 +0000
commitdcf37fbec5432495ab0f9966343ac18f8e8dff2e (patch)
tree85149797189b934ca5a13aab955431ad53c92a33 /clang/lib/Format/TokenAnnotator.cpp
parent4bfa0de5b07d3d104e3c14a550cf5c354ffc3739 (diff)
downloadbcm5719-llvm-dcf37fbec5432495ab0f9966343ac18f8e8dff2e.tar.gz
bcm5719-llvm-dcf37fbec5432495ab0f9966343ac18f8e8dff2e.zip
clang-format: Add a space in ObjC protocols.
Before: @interface Foo (HackStuff)<MyProtocol> After: @interface Foo (HackStuff) <MyProtocol> llvm-svn: 214508
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 6f77ae3d29b..0d7e6bfbcb8 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1480,7 +1480,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
if (Right.isOneOf(tok::semi, tok::comma))
return false;
if (Right.is(tok::less) &&
- (Left.is(tok::kw_template) ||
+ (Left.isOneOf(tok::kw_template, tok::r_paren) ||
(Line.Type == LT_ObjCDecl && Style.ObjCSpaceBeforeProtocolList)))
return true;
if (Left.is(tok::arrow) || Right.is(tok::arrow))
@@ -1509,13 +1509,14 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
((Left.Type != TT_PointerOrReference) && Left.isNot(tok::l_paren) &&
Style.PointerAlignment != FormatStyle::PAS_Left);
if (Right.Type == TT_FunctionTypeLParen && Left.isNot(tok::l_paren) &&
- (Left.Type != TT_PointerOrReference || Style.PointerAlignment != FormatStyle::PAS_Right))
+ (Left.Type != TT_PointerOrReference ||
+ Style.PointerAlignment != FormatStyle::PAS_Right))
return true;
if (Left.Type == TT_PointerOrReference)
return Right.Tok.isLiteral() || Right.Type == TT_BlockComment ||
((Right.Type != TT_PointerOrReference) &&
- Right.isNot(tok::l_paren) && Style.PointerAlignment != FormatStyle::PAS_Right &&
- Left.Previous &&
+ Right.isNot(tok::l_paren) &&
+ Style.PointerAlignment != FormatStyle::PAS_Right && Left.Previous &&
!Left.Previous->isOneOf(tok::l_paren, tok::coloncolon));
if (Right.is(tok::star) && Left.is(tok::l_paren))
return false;
OpenPOWER on IntegriCloud