clang-format: Fix corner case in ObjC interface definitions.

In
  @implementation ObjcClass
  - (void)method;
  {
  }
  @end
the ObjC compiler seems to accept the superfluous comma after "method",
but clang-format used to assert on the subsequent "{".

This fixes llvm.org/PR16604.

llvm-svn: 189453
This commit is contained in:
Daniel Jasper
2013-08-28 08:04:23 +00:00
parent fce1b03ee7
commit a15da3068d
2 changed files with 11 additions and 1 deletions

View File

@@ -1030,7 +1030,13 @@ void UnwrappedLineParser::parseObjCUntilAtEnd() {
addUnwrappedLine();
break;
}
parseStructuralElement();
if (FormatTok->is(tok::l_brace)) {
parseBlock(/*MustBeDeclaration=*/false);
// In ObjC interfaces, nothing should be following the "}".
addUnwrappedLine();
} else {
parseStructuralElement();
}
} while (!eof());
}