aaron.ballman added inline comments.

================
Comment at: clang-tidy/bugprone/UnusedReturnValueCheck.cpp:62-63
+void UnusedReturnValueCheck::check(const MatchFinder::MatchResult &Result) {
+  if (const auto Matched = Result.Nodes.getNodeAs<Stmt>("match")) {
+    diag(Matched->getLocStart(), "unused return value");
+  }
----------------
`const auto Matched` -> `const auto *Matched`

You can elide the curly braces.

The diagnostic doesn't really help the user understand what's wrong with the 
code. How about "the value returned by this function should be used" and add a 
note diagnostic that says "cast expression to void to silence warning". Also, 
you should pass in the `SourceRange` for the function call expression to the 
call to `diag()` so that it highlights the call in question.


================
Comment at: test/clang-tidy/bugprone-unused-return-value.cpp:200
+  increment(1);
+}
----------------
Can you also add a test for ignoring the result of a call to 
`std::empty(SomeContainerWithAnEmptyMethod)`?


https://reviews.llvm.org/D41655



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to