[clang-tools-extra] [clang-doc]: Enable horizontal wrapping on longer function definitions (PR #181417)

Samrudh Nelli via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 14 04:55:18 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;
+    }
----------------
SamrudhNelli wrote:

The alternatives would be approaches 2) and 3) below. 
2) would require an object key on the (function name + return type) length.
3) does not require an object key.

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


More information about the cfe-commits mailing list