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

Danny Mösch via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 27 13:13:17 PST 2023


SimplyDanny wrote:

> I think that both IgnoreMacros and StrictMode(false) could be needed. If StrictMode is false then only returnStmt that got compoundStmt as parent should be check, to reduce impact.

Fair points. Both options are added now. However, I'm not sure about the name of the second one `StrictMode`. It doesn't imply its purpose. Do you think we should pick a more descriptive name?

I also found a case involving initializer lists that requires special treatment, because the list is seen as an expression returning `void`. This is addressed in the [last commit](https://github.com/llvm/llvm-project/pull/76249/commits/ce006f2957402a8a7bacc023cc96963b211e1290).

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


More information about the cfe-commits mailing list