[PATCH] D68707: [clang-format] throws an incorrect assertion in consumeToken() formatting the MSVC stl
Mitchell via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 08:44:49 PDT 2019
mitchell-stellar added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:847
case tok::kw_while:
- assert(!Line.startsWith(tok::hash));
- if (Tok->is(tok::kw_if) && CurrentToken &&
- CurrentToken->isOneOf(tok::kw_constexpr, tok::identifier))
- next();
- if (CurrentToken && CurrentToken->is(tok::l_paren)) {
- next();
- if (!parseParens(/*LookForDecls=*/true))
- return false;
+ if (!Line.startsWith(tok::hash)) {
+ if (Tok->is(tok::kw_if) && CurrentToken &&
----------------
It's not clear to me whether or not the token should be consumed. The previous assertion leads me to think no, and in that case, I think this should be
```
if (Line.startsWith(tok::hash))
return false;
```
A comment on this would also be helpful.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68707/new/
https://reviews.llvm.org/D68707
More information about the cfe-commits
mailing list