clang-format: Prevent ObjC code from confusing the braced-init detection

This was leading to bad formatting, e.g.:
Before:
  f(^{
      @autoreleasepool {
        if (a) {
          g();
  }
  }
  });

After:
  f(^{
      @autoreleasepool {
        if (a) {
          g();
        }
      }
  });

llvm-svn: 203777
This commit is contained in:
Daniel Jasper 2014-03-13 10:11:17 +00:00
parent e8bd672d31
commit ac7e34e778
2 changed files with 9 additions and 0 deletions

View File

@ -357,6 +357,7 @@ void UnwrappedLineParser::calculateBraceTypes() {
LBraceStack.pop_back();
}
break;
case tok::at:
case tok::semi:
case tok::kw_if:
case tok::kw_while:

View File

@ -8062,6 +8062,14 @@ TEST_F(FormatTest, FormatsBlocks) {
" // ...\n"
" int i;\n"
" }];");
verifyFormat("f(^{\n"
" @autoreleasepool {\n"
" if (a) {\n"
" g();\n"
" }\n"
" }\n"
"});");
}
TEST_F(FormatTest, SupportsCRLF) {