================
@@ -0,0 +1,83 @@
+.. title:: clang-tidy - readability-trailing-comma
+
+readability-trailing-comma
+==========================
+
+Checks for presence or absence of trailing commas in enum definitions and
+initializer lists.
+
+The check can either append trailing commas where they are missing or remove
+them where they are present, based on the configured policy.
+
+Trailing commas offer several benefits:
+
+- Adding or removing elements may only changes a single line, making diffs
+  smaller and easier to read.
+- Formatters may change code to a more desired style.
+- Code generators avoid for need special handling of the last element.
+
+.. code-block:: c++
+
+  // Without trailing commas - adding "Yellow" requires modifying the "Blue" 
line
+  enum Color {
+    Red,
+    Green,
+    Blue
+  };
+
+  // With trailing commas - adding "Yellow" is a clean, single-line change
+  enum Color {
+    Red,
+    Green,
+    Blue,
+  };
+
+
+Limitations
+-----------
+
+The check currently don't analyze code inside macros.
----------------
localspook wrote:

```suggestion
The check currently doesn't analyze code inside macros.
```

https://github.com/llvm/llvm-project/pull/173669
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to