HazardyKnusperkeks marked 3 inline comments as done. HazardyKnusperkeks added inline comments.
================ Comment at: clang/lib/Format/UnwrappedLineParser.cpp:2835-2841 + // FIXME: We need an annotation on the paren to really know if it is a + // function call: + // ... foo() && requires ... + // or a declaration: + // void foo() && requires ... + // there is no distinction possible right now. We go for the latter, + // because it's more likely to appear in code. ---------------- HazardyKnusperkeks wrote: > Quuxplusone wrote: > > I think it's weird that your heuristic parses backward rather than forward. > > I would think that the next token //after// the `requires` keyword tells > > you what it is with pretty high probability: > > `requires requires` — it's a clause > > `requires identifier` — it's a clause > > `requires {` — it's an expression > > `requires (` — unclear, apply further heuristics > > > > Or are those heuristics already present in trunk, and this PR is just > > dealing with the "unclear" case? > That would be so much better, but I can't easily look forward. `Next` is > still `nullptr`, until I call `nextToken()`, but then I'm already moved along. > > But this got me thinking, at least for the easy stuff I can just go forward > and don't start on the keyword in `parseRequiresClause()` and > `parseRequiresExpression()`. The paren case is more tricky, but I will try > something. Present in main everything is a clause, except for requires expressions in a constraint expression. So the stuff where you use the requires expression in a "normal" boolean expression are misparsed and thus most likely misformatted. There is actually a `peekToken()`, let's see if this is better. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D119138/new/ https://reviews.llvm.org/D119138 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits