[PATCH] D41655: [clang-tidy] New check bugprone-unused-return-value

Kalle Huttunen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 6 02:16:39 PST 2018

khuttun marked an inline comment as done.
khuttun added inline comments.

Comment at: clang-tidy/bugprone/UnusedReturnValueCheck.cpp:69
+         "the value returned by %0 should normally be used")
+        << dyn_cast_or_null<NamedDecl>(Matched->getCalleeDecl())
+        << Matched->getSourceRange();
aaron.ballman wrote:
> In the event this returns null, the diagnostic is going to look rather odd. Because the value of the call expression is unused, this will most often trigger in a context where the method call can be inferred (especially because you're now highlighting the source range). It might make sense to simply replace the %0 with "this call expression" or somesuch in the diagnostic.
I can remove the function name from the diagnostic. Out of curiosity, in which situations could it be null?


More information about the cfe-commits mailing list