[PATCH] D135822: [clang-tidy] Add option `IgnoreVoidReturnType` to `modernize-use-trailing-return-type`
Bernhard Manfred Gruber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 13 13:28:21 PDT 2022
bernhardmgruber added a comment.
Hi! I am the original author of this check. I very much welcome your contribution! Thank you for the effort!
I am not a clang tools maintainer though, so you will need someone else to review and approve this change set.
================
Comment at: clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:420-421
+ if (F->getReturnType()->isVoidType() && IgnoreVoidReturnType)
+ return;
+
----------------
I would intuitively check the cheaper condition first to benefit form short-circuit evaluation.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-trailing-return-type.rst:73-76
+.. option:: IgnoreVoidReturnType
+
+ When `true`, the check will not rewrite function signature for functions
+ with void return type. Default is `true`.
----------------
I picked up the habit to word conditions/options in a positive manner. So I would rather name the option `RewriteVoidReturnType` instead of `IgnoreVoidReturnType` and use the inverted Booleans throughout the code. The reason is that my brain parses e.g. `if (!RewriteVoidReturnType)` easierly than `if(!IgnoreVoidReturnType)` because of the double negation.
Feel free to debate me here. This is not a strong opinion.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135822/new/
https://reviews.llvm.org/D135822
More information about the cfe-commits
mailing list