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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 06:19:10 PDT 2017


aaron.ballman added a comment.

In https://reviews.llvm.org/D33531#767640, @alexfh wrote:

> 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.


Good point on the prefix/postfix nature. This does seem like overkill.

> If we want this whitelisting be optional, we can add a boolean option specifically for these operators.

In light of a more general solution, I say we don't add any configuration option. If it turns out people want to run both of these checks at the same time a lot in practice, we can address it with a more general mechanism to express dependencies/conflicts.


Repository:
  rL LLVM

https://reviews.llvm.org/D33531





More information about the cfe-commits mailing list