Displaying 2 results from an estimated 2 matches for "llvm_nodiscard_type".
2016 Sep 02
2
Adding [[nodiscard]] to Compiler.h
Sanjoy Das <sanjoy at playingwithpointers.com> writes:
> Hi Justin,
>
> This SGTM generally, but please make the difference between
> LLVM_NODISCARD and LLVM_UNUSED_RESULT clear in the code. :)
Right, this is where it gets a little weird. LLVM_NODISCARD would be for
types, whereas LLVM_UNUSED_RESULT would be for functions. Depending on
your host compiler, using the wrong one
2016 Sep 04
6
Adding [[nodiscard]] to Compiler.h
...t; > your host compiler, using the wrong one might DTRT, but it won't across
> > all compilers.
> >
> > Do you think documenting this is sufficient, or should we try to name
> > these to better represent where they should be used?
>
> Firstly, perhaps "LLVM_NODISCARD_TYPE" would be a better name?
>
> Secondly, if we define the following when the host compiler is clang,
>
> #define LLVM_UNUSED_RESULT __attribute__((warn_unused_result))
> #define LLVM_NODISCARD_TYPE [[clang::warn_unused_result]]
>
> via some shallow manual testing, it looks l...