summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-15 09:05:31 +0000
committerDaniel Jasper <djasper@google.com>2015-05-15 09:05:31 +0000
commitcdb58b2e4537a5369015327cf5b210e582b115a5 (patch)
tree2abcb543c4a9e3b33724d514d34a63ef85aa73cf /clang/lib/Format
parent7e9776b55949f8fdbfdee1a66ec8aa04289436bc (diff)
downloadbcm5719-llvm-cdb58b2e4537a5369015327cf5b210e582b115a5.tar.gz
bcm5719-llvm-cdb58b2e4537a5369015327cf5b210e582b115a5.zip
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
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 130e2c3b2ac..c2992223791 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1922,8 +1922,13 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
}
if (Left.is(TT_UnaryOperator))
return Right.is(TT_BinaryOperator);
+
+ // If the next token is a binary operator or a selector name, we have
+ // incorrectly classified the parenthesis as a cast. FIXME: Detect correctly.
if (Left.is(TT_CastRParen))
- return Style.SpaceAfterCStyleCast || Right.is(TT_BinaryOperator);
+ return Style.SpaceAfterCStyleCast ||
+ Right.isOneOf(TT_BinaryOperator, TT_SelectorName);
+
if (Left.is(tok::greater) && Right.is(tok::greater)) {
return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
(Style.Standard != FormatStyle::LS_Cpp11 || Style.SpacesInAngles);
OpenPOWER on IntegriCloud