[clang-tools-extra] 47a40e8 - Fix #41439: Update the documentation with the correct information. (#69377)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 08:12:25 PST 2023


Author: Da-Viper
Date: 2023-12-04T17:12:21+01:00
New Revision: 47a40e80c553b07a08f0f17fd68c12ae9b9a2a67

URL: https://github.com/llvm/llvm-project/commit/47a40e80c553b07a08f0f17fd68c12ae9b9a2a67
DIFF: https://github.com/llvm/llvm-project/commit/47a40e80c553b07a08f0f17fd68c12ae9b9a2a67.diff

LOG: Fix #41439: Update the documentation with the correct information. (#69377)

Fixes #41439

The documentation is update to say it is allowed to have omitted
parameter names if the variable is not used

Added: 
    

Modified: 
    clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst
index 8d28c0aa02169..73677a48605f4 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst
@@ -10,7 +10,16 @@ Guide:
 
 https://google.github.io/styleguide/cppguide.html#Function_Declarations_and_Definitions
 
-All parameters should be named, with identical names in the declaration and
-implementation.
+All parameters should have the same name in both the function declaration and definition.
+If a parameter is not utilized, its name can be commented out in a function definition.
+
+.. code-block:: c++
+
+    int doingSomething(int a, int b, int c);
+
+    int doingSomething(int a, int b, int /*c*/) {
+        // Ok: the third param is not used
+        return a + b;
+    }
 
 Corresponding cpplint.py check name: `readability/function`.


        


More information about the cfe-commits mailing list