djasper added inline comments. ================ Comment at: lib/Format/UnwrappedLineParser.cpp:1064 @@ +1063,3 @@ + // parseBracedList. For now, parsing matching braces ([], (), {}) is + // good enough. + if (FormatTok->is(tok::l_paren)) { ---------------- strager wrote: > djasper wrote: > > Ah, parseAngle doesn't exist here. I was thinking about the TokenAnnotator. > > > > I don't understand your comment about mid-stream. This is precisely about > > the case where the input is corrupt so that clang-format can recover and > > doesn't just parse the reset of the file input the lambda introducer. > > This is precisely about the case where the input is corrupt so that > > clang-format can recover and doesn't just parse the reset of the file input > > the lambda introducer. > > If I write this test: > > ``` > verifyFormat("return [}] {};\n"); > ``` > > I get this output: > > ``` > /Users/strager/Projects/llvm/tools/clang/unittests/Format/FormatTest.cpp:42: > Failure > Value of: IncompleteFormat > Actual: true > Expected: ExpectedIncompleteFormat > Which is: false > return [}] {}; > > > > /Users/strager/Projects/llvm/tools/clang/unittests/Format/FormatTest.cpp:65: > Failure > Value of: format(test::messUp(Code), Style) > Actual: "return [\n}] {};\n" > Expected: Code.str() > Which is: "return [}] {};\n" > ``` > > How can I fix this? So, there are two errors in the test.
1. clang-format detects that there is a syntax error and reports this. Use verifyIncompleteFormat instead of verifyFormat. 2. clang-format adds a '\n' after the opening square bracket. Add that in your test string. http://reviews.llvm.org/D11693 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits