[clang-tools-extra] [clang-doc]: Enable horizontal wrapping on longer function definitions (PR #181417)
Paul Kirth via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 13 15:59:47 PST 2026
================
@@ -456,6 +456,24 @@ static void serializeArray(const Container &Records, Object &Obj,
ItemObj["End"] = true;
RecordsArrayRef.push_back(ItemVal);
}
+ if (Key == "Params") {
+ size_t TotalLength = 0;
+ for (const auto &Val : RecordsArrayRef) {
+ if (const auto *ItemObj = Val.getAsObject()) {
+ if (auto Type = ItemObj->getString("Type"))
+ TotalLength += Type->size();
+ if (auto Name = ItemObj->getString("Name"))
+ TotalLength += Name->size();
+ TotalLength += 2; // For ', '
+ }
+ }
+ if (TotalLength > 15) {
+ Obj["IsLong"] = true;
+ }
+ else {
+ Obj["IsLong"] = false;
+ }
----------------
ilovepi wrote:
```suggestion
Obj["isLong"] = TotalLength > 15;
```
Also, see the style guide for bracing: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
Everyone struggles w/ that one, since we dont' have the clang-format set for it by default.
I'm also not sure that using an object key is a great solution to wrapping. Did you consider other alternatives?
https://github.com/llvm/llvm-project/pull/181417
More information about the cfe-commits
mailing list