[clang-tools-extra] [clang-tidy] Replace /* ... */ single-line comments with // ... comments (PR #124319)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 07:48:00 PST 2025


================
@@ -0,0 +1,40 @@
+.. title:: clang-tidy - use-cpp-style-comments
+
+readability-use-cpp-style-comments
+==================================
+
+Replace C-style comments with C++-style comments.
+C-style comments (``/* ... */``) are inherited from C, while C++ introduces 
+``//`` as a more concise, readable, and less error-prone alternative. Modern C++ 
+guidelines recommend using C++-style comments for consistency and 
+maintainability. This check identifies and replaces C-style comments with 
+equivalent C++-style comments.
+
+Examples:
+
+Input:
+.. code-block::c++
+
+  /* This is a single-line comment */
+  int x = 42;  /* Inline comment */
+
+  /* This is a
+  multi-line comment */
+
+Output:
+.. code-block::c++
----------------
EugeneZelenko wrote:

Ditto.

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


More information about the cfe-commits mailing list