clang-format: [ObjC] Fix spacing in block variable parameters.

Before:
  { void (^block)(Object * x); }

After:
  { void (^block)(Object *x); }

llvm-svn: 220270
This commit is contained in:
Daniel Jasper 2014-10-21 07:57:50 +00:00
parent 38efc13191
commit f1f267b447
2 changed files with 4 additions and 0 deletions

View File

@ -127,6 +127,9 @@ private:
// The first argument to a foreach macro is a declaration. // The first argument to a foreach macro is a declaration.
Contexts.back().IsForEachMacro = true; Contexts.back().IsForEachMacro = true;
Contexts.back().IsExpression = false; Contexts.back().IsExpression = false;
} else if (Left->Previous && Left->Previous->MatchingParen &&
Left->Previous->MatchingParen->Type == TT_ObjCBlockLParen) {
Contexts.back().IsExpression = false;
} }
if (StartsObjCMethodExpr) { if (StartsObjCMethodExpr) {

View File

@ -9162,6 +9162,7 @@ TEST_F(FormatTest, FormatsBlocks) {
verifyFormat("foo(^{ bar(); });"); verifyFormat("foo(^{ bar(); });");
verifyFormat("foo(a, ^{ bar(); });"); verifyFormat("foo(a, ^{ bar(); });");
verifyFormat("{ void (^block)(Object *x); }");
verifyFormat("[operation setCompletionBlock:^{ [self onOperationDone]; }];"); verifyFormat("[operation setCompletionBlock:^{ [self onOperationDone]; }];");
verifyFormat("int i = {[operation setCompletionBlock:^{ [self " verifyFormat("int i = {[operation setCompletionBlock:^{ [self "