[clang] [clang-format] Fix Macros configuration not working with try/catch expansions (PR #184891)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 6 12:20:15 PST 2026
================
@@ -1593,6 +1593,12 @@ void UnwrappedLineParser::parseStructuralElement(
// field/method declaration.
break;
}
+ // In C, `try` is not a keyword; treat it as an identifier.
+ if (Style.isCpp() && FormatTok->is(tok::kw_try) &&
+ !Tokens->peekNextToken(/*SkipComment=*/true)
+ ->isOneOf(tok::l_brace, tok::colon, tok::hash)) {
----------------
HazardyKnusperkeks wrote:
```suggestion
Tokens->peekNextToken(/*SkipComment=*/true)
->isNoneOf(tok::l_brace, tok::colon, tok::hash)) {
```
https://github.com/llvm/llvm-project/pull/184891
More information about the cfe-commits
mailing list