[PATCH] D73775: [clang-tidy] Cover cases like (b && c && b) in the redundant expression check

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 06:05:32 PST 2020


aaron.ballman added a comment.

In D73775#1856848 <https://reviews.llvm.org/D73775#1856848>, @alexeyr wrote:

> In D73775#1856765 <https://reviews.llvm.org/D73775#1856765>, @aaron.ballman wrote:
>
> > In D73775#1851553 <https://reviews.llvm.org/D73775#1851553>, @alexeyr wrote:
> >
> > > Also I am not sure why, but the ranges added to the diagnostic in lines 1222-1226 don't show up in the message.
> >
> >
> > Do you mean that there are no squiggly underlines under the range, or something else? Passing in a range to the diagnostics engine gives it something to put an underline under, as in what's under the -12 in: https://godbolt.org/z/GeQzYg
>
>
> Yes, exactly. I expect to see the underlines, but don't; only the `^` in the location provided to `diag` call.


The only time I've seen that happen is when the range is invalid. I'm guessing you'll have to step through the diagnostics code to see what's going on.



================
Comment at: clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp:1242
+    StringRef Message =
+        Call ? "Overloaded operator has equivalent nested operands"
+             : "Operator has equivalent nested operands";
----------------
Diagnostics in clang tidy are not capitalized, so this should be `overloaded operator` and `operator`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73775/new/

https://reviews.llvm.org/D73775





More information about the cfe-commits mailing list