[PATCH] D33531: Clang-tidy readability: avoid const value return

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 06:14:39 PDT 2017


alexfh added a comment.

In https://reviews.llvm.org/D33531#767628, @aaron.ballman wrote:

> In https://reviews.llvm.org/D33531#767059, @alexfh wrote:
>
> > > Would it make sense to silence this diagnostic in the presence of also checking for cert-dcl21-cpp for such operators?
> >
> > Currently there's no mechanism in clang-tidy to express dependencies or compatibility issues between checks. Moreover, we already have checks that are not meant to be run together, for example, readability-braces-around-statements and its google- incarnation (and other alias checks with different settings). That said, we could whitelist postfix increment and decrement operators in this check. Camillo, WDYT?
>
>
> I can imagine a generic whitelist mechanism might be useful for this check. It could even be empty by default, but the documentation could call out cert-dcl21-cpp specifically and show an example of how you can run both checks.


A generic whitelist of method/function names would make sense, if we had more use cases for it. It might also be quite tricky to implement: distinguishing between prefix and postfix increment/decrement operators would require specifying arguments, and allowing it for all types would need a support for pattern matching or optional omission of the type name on methods. All this seems to be an overkill so far. If we want this whitelisting be optional, we can add a boolean option specifically for these operators.


Repository:
  rL LLVM

https://reviews.llvm.org/D33531





More information about the cfe-commits mailing list