This revision was automatically updated to reflect the committed changes. Closed by commit rGd9abcdd9f471: [clang-format] Fix ObjC method indent after f7f9f94b (authored by krasimir).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D99063/new/ https://reviews.llvm.org/D99063 Files: clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/FormatTestObjC.cpp Index: clang/unittests/Format/FormatTestObjC.cpp =================================================================== --- clang/unittests/Format/FormatTestObjC.cpp +++ clang/unittests/Format/FormatTestObjC.cpp @@ -977,6 +977,19 @@ " performSelectorOnMainThread:@selector(loadAccessories)\n" " withObject:nil\n" " waitUntilDone:false];"); + + // The appropriate indentation is used after a block statement. + Style.ContinuationIndentWidth = 4; + verifyFormat( + "void aaaaaaaaaaaaaaaaaaaaa(int c) {\n" + " if (c) {\n" + " f();\n" + " }\n" + " [dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\n" + " eeeeeeeeeeeeeeeeeeeeeeeeeeeee:^(fffffffffffffff gggggggg) {\n" + " f(SSSSS, c);\n" + " }];\n" + "}"); } TEST_F(FormatTestObjC, ObjCAt) { Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -649,7 +649,6 @@ nextToken(); Line->Level = InitialLevel; - FormatTok->setBlockKind(BK_Block); if (PPStartHash == PPEndHash) { Line->MatchingOpeningBlockLineIndex = OpeningLineIndex;
Index: clang/unittests/Format/FormatTestObjC.cpp =================================================================== --- clang/unittests/Format/FormatTestObjC.cpp +++ clang/unittests/Format/FormatTestObjC.cpp @@ -977,6 +977,19 @@ " performSelectorOnMainThread:@selector(loadAccessories)\n" " withObject:nil\n" " waitUntilDone:false];"); + + // The appropriate indentation is used after a block statement. + Style.ContinuationIndentWidth = 4; + verifyFormat( + "void aaaaaaaaaaaaaaaaaaaaa(int c) {\n" + " if (c) {\n" + " f();\n" + " }\n" + " [dddddddddddddddddddddddddddddddddddddddddddddddddddddddd\n" + " eeeeeeeeeeeeeeeeeeeeeeeeeeeee:^(fffffffffffffff gggggggg) {\n" + " f(SSSSS, c);\n" + " }];\n" + "}"); } TEST_F(FormatTestObjC, ObjCAt) { Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -649,7 +649,6 @@ nextToken(); Line->Level = InitialLevel; - FormatTok->setBlockKind(BK_Block); if (PPStartHash == PPEndHash) { Line->MatchingOpeningBlockLineIndex = OpeningLineIndex;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits