[PATCH] D121550: [clang-format] Fix crash on invalid requires expression
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 14 19:11:00 PDT 2022
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)), function parseParens, file TokenAnnotator.cpp, line 216.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: cf ./test/Driver/ignore-xcoff-visibility.cpp
...
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:216
FormatToken &OpeningParen = *CurrentToken->Previous;
assert(OpeningParen.is(tok::l_paren));
FormatToken *PrevNonComment = OpeningParen.getPreviousNonComment();
----------------
This patch either uncovers or causes an assertion failure here on a bunch of files in `clang/test`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121550/new/
https://reviews.llvm.org/D121550
More information about the cfe-commits
mailing list