[clang] [clang-format] Fix annotating paren after in (PR #206810)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 21:59:29 PDT 2026
================
@@ -2821,8 +2821,10 @@ class AnnotatingParser {
// If there is an identifier (or with a few exceptions a keyword) right
// before the parentheses, this is unlikely to be a cast.
if (LeftOfParens->Tok.getIdentifierInfo() &&
- LeftOfParens->isNoneOf(Keywords.kw_in, tok::kw_return, tok::kw_case,
- tok::kw_delete, tok::kw_throw)) {
+ (LeftOfParens->isNoneOf(Keywords.kw_in, tok::kw_return, tok::kw_case,
+ tok::kw_delete, tok::kw_throw) ||
+ (LeftOfParens->Previous &&
+ LeftOfParens->Previous->is(tok::period)))) {
----------------
owenca wrote:
```suggestion
(LeftOfParens->isNoneOf(TT_ObjCForIn, tok::kw_return, tok::kw_case,
tok::kw_delete, tok::kw_throw) {
```
Not sure if we still need the `||` part you added, though.
https://github.com/llvm/llvm-project/pull/206810
More information about the cfe-commits
mailing list