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

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 17 12:53:00 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tidy

Author: None (Da-Viper)

<details>
<summary>Changes</summary>

Fixes #<!-- -->41439

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

---
Full diff: https://github.com/llvm/llvm-project/pull/69377.diff


1 Files Affected:

- (modified) clang-tools-extra/docs/clang-tidy/checks/readability/named-parameter.rst (+7-2) 


``````````diff
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 8d28c0aa02169a7..7e7099b3df251d1 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,12 @@ 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.
+A parameter name may be omitted only if the parameter is not used in the
+function's definition.
+
+.. code-block:: c++
+int doingSomething(int a, int b, int) {  // Ok: the third paramet is not used
+    return a + b;
+}
 
 Corresponding cpplint.py check name: `readability/function`.

``````````

</details>


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


More information about the cfe-commits mailing list