aaron.ballman added a comment.

> When we have a function that can have its value discarded, we can use 
> [[clang::discardable]] to indicate that the `[[nodiscard]]` attribute should 
> be ignored.

Alternatively, you can scope the pragma and declarations appropriately and then 
we don't need to add a new attribute. Is there a reason that wouldn't work for 
you?

(This attribute would be interesting to consider if we added a feature flag 
like `-fdiagnose-discarded-results` where the default is as-if everything was 
declared `nodiscard` and then you could mark the APIs with 
`[[clang::discardable]]` for the few whose results don't matter. However, 
that's also a much bigger feature because system headers are a challenge.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129835

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

Reply via email to