[clang-tools-extra] [clang-tidy] Add check readability-return-expression-in-void-function (PR #76249)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 22 09:54:50 PST 2023


Danny =?utf-8?q?Mösch?= <danny.moesch at icloud.com>,
Danny =?utf-8?q?Mösch?= <danny.moesch at icloud.com>,
Danny =?utf-8?q?Mösch?= <danny.moesch at icloud.com>,
Danny =?utf-8?q?Mösch?= <danny.moesch at icloud.com>,
Danny =?utf-8?q?Mösch?= <danny.moesch at icloud.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/76249 at github.com>


================
@@ -0,0 +1,30 @@
+.. title:: clang-tidy - readability-avoid-return-with-void-value
+
+readability-avoid-return-with-void-value
+========================================
+
+Complains about statements returning expressions of type ``void``. It can be
+confusing if a function returns an expression even though its return type is
+``void``.
----------------
PiotrZSL wrote:

consider: "Void function is intended to perform a task without producing a return value. Including a return value in such functions can lead to confusion and may miscommunicate the function's intended behavior." or something similar.

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


More information about the cfe-commits mailing list