Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
After: int (^Block1) (int, int) = ^(int i, int j)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171959
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Current.Type == TT_Unknown) {
if (Current.is(tok::star) || Current.is(tok::amp)) {
Current.Type = determineStarAmpUsage(Current, IsRHS);
- } else if (Current.is(tok::minus) || Current.is(tok::plus)) {
- Current.Type = determinePlusMinusUsage(Current);
+ } else if (Current.is(tok::minus) || Current.is(tok::plus) ||
+ Current.is(tok::caret)) {
+ Current.Type = determinePlusMinusCaretUsage(Current);
} else if (Current.is(tok::minusminus) || Current.is(tok::plusplus)) {
Current.Type = determineIncrementUsage(Current);
} else if (Current.is(tok::exclaim)) {
return TT_PointerOrReference;
}
- TokenType determinePlusMinusUsage(const AnnotatedToken &Tok) {
+ TokenType determinePlusMinusCaretUsage(const AnnotatedToken &Tok) {
// At the start of the line, +/- specific ObjectiveC method declarations.
if (Tok.Parent == NULL)
return TT_ObjCMethodSpecifier;
*\brief block declaration
*/
int (^Block) (int i, int j);
-// CHECK: <Declaration>int ( ^ Block) (int, int)</Declaration>
+// CHECK: <Declaration>int (^Block) (int, int)</Declaration>
/**
*\brief block declaration
*/
int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; };
-// CHECK: <Declaration>int ( ^ Block1) (int, int) = ^ (int i, int j) {\n}</Declaration>
+// CHECK: <Declaration>int (^Block1) (int, int) = ^(int i, int j) {\n}</Declaration>
*\brief block declaration
*/
int (^Block) (int i, int j);
-// CHECK: <Declaration>int ( ^ Block) (int, int)</Declaration>
+// CHECK: <Declaration>int (^Block) (int, int)</Declaration>
/**
*\brief block declaration
*/
int (^Block1) (int i, int j) = ^(int i, int j) { return i + j; };
-// CHECK: <Declaration>int ( ^ Block1) (int, int) = ^ (int i, int j) {\n}</Declaration>
+// CHECK: <Declaration>int (^Block1) (int, int) = ^(int i, int j) {\n}</Declaration>
"outRange8:(NSRange) out_range8 outRange9:(NSRange) out_range9;"));
}
+TEST_F(FormatTest, FormatObjCBlocks) {
+ verifyFormat("int (^Block) (int, int);");
+ verifyFormat("int (^Block1) (int, int) = ^(int i, int j)");
+}
+
TEST_F(FormatTest, ObjCAt) {
verifyFormat("@autoreleasepool");
verifyFormat("@catch");