[clang] [clang-format] add option to bin-pack keyworded parameters (PR #131605)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 17 12:52:31 PDT 2025


================
@@ -116,6 +116,18 @@ static bool isCppAttribute(bool IsCpp, const FormatToken &Tok) {
   return AttrTok && AttrTok->startsSequence(tok::r_square, tok::r_square);
 }
 
+static bool isParametersKeyword(
+    const FormatToken &Tok,
+    const FormatStyle::FunctionDeclarationWithKeywords *declaration) {
+  if (!declaration)
+    return false;
+
+  for (auto &Keyword : declaration->Keywords)
+    if (Tok.TokenText == Keyword)
+      return true;
+  return false;
----------------
HazardyKnusperkeks wrote:

```suggestion
  return std::find(declaration->Keywords.begin(), declaration->Keywords.end(), Tok.TokenText) != declaration->Keywords.end();
```

https://github.com/llvm/llvm-project/pull/131605


More information about the cfe-commits mailing list