cjdb added a comment.

In D128372#3991516 <https://reviews.llvm.org/D128372#3991516>, @MyDeveloperDay 
wrote:

> Ironically as an aside... looking back at the review because of the discource 
> article.
>
> The whole reason why I added the [[nodiscard]] checker to clang-tidy 4 years 
> ago was to cover exactly this use case...and many others like it where users 
> have a function which returns a boolean and takes no arguments are pointer or 
> reference (empty() included)
>
> https://reviews.llvm.org/D55433
>
> Shouldn't people be using this checker to add nodiscard and let the compiler 
> to the heavy lifting. Was there a use case as to why that solution doesn't 
> solve this?

That check is for library authors: this one is for library users. There are a 
non-insignificant number of cases where an unused call to `empty` pops up, 
hence the desire for this check.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128372

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

Reply via email to