[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-15 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment. In D121550#3381903 , @owenpan wrote: > Nvm. See https://github.com/llvm/llvm-project/issues/54384. Phew. I thought I needed a fix for the fix, for the fix, for the fix. Repository: rG LLVM Github Monorepo CHANGES

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-15 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. Nvm. See https://github.com/llvm/llvm-project/issues/54384. Comment at: clang/lib/Format/TokenAnnotator.cpp:216 FormatToken &OpeningParen = *CurrentToken->Previous; assert(OpeningParen.is(tok::l_paren)); FormatToken *PrevNonComment = Open

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-14 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment. After applying this patch, we got a different assertion failure on a bunch of files in `clang/test`, e.g.: ~/llvm-project/clang$ for f in $(find . -name \*.cpp -o -name \*.c) ; do clang-format $f > /dev/null ; done Assertion failed: (OpeningParen.is(tok::l_paren)),

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-14 Thread Björn Schäpers via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGacd17a2be81a: [clang-format] Fix crash on invalid requires expression (authored by HazardyKnusperkeks). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121550/

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-13 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius added a comment. LGTM. And thanks for splitting the patch. Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:335 + + // Invalid Code, but we don't want to crash. See http://llvm.org/PR54350. + Tokens = annotate("bool r10 = requires (struct new_struct { int x;

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:215 +assert(CurrentToken->Previous && "Unknown previous token"); +FormatToken &OpeningParen = *CurrentToken->Previous; +assert(OpeningParen.is(tok::l_paren)); cu

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks updated this revision to Diff 414956. HazardyKnusperkeks marked 2 inline comments as done. HazardyKnusperkeks added a comment. Split rename and bug fix CHANGES SINCE LAST ACTION https://reviews.llvm.org/D121550/new/ https://reviews.llvm.org/D121550 Files: clang/lib/Forma

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-13 Thread Marek Kurdej via Phabricator via cfe-commits
curdeius accepted this revision. curdeius added inline comments. This revision is now accepted and ready to land. Comment at: clang/lib/Format/TokenAnnotator.cpp:215 +assert(CurrentToken->Previous && "Unknown previous token"); +FormatToken &OpeningParen = *CurrentToken->P

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:424-425 - if (CurrentToken->is(tok::l_brace)) -Left->setType(TT_Unknown); // Not TT_ObjCBlockLParen + if (CurrentToken->is(tok::l_brace) && OpeningParen.is(TT_ObjCBlockL

[PATCH] D121550: [clang-format] Fix crash on invalid requires expression

2022-03-13 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks created this revision. HazardyKnusperkeks added reviewers: owenpan, curdeius, MyDeveloperDay. HazardyKnusperkeks added a project: clang-format. Herald added a project: All. HazardyKnusperkeks requested review of this revision. Herald added a project: clang. Herald added a subscri