================ @@ -2452,6 +2452,44 @@ use the annotated ``[[nodiscard]]`` constructor or result in an annotated type. }]; } +def CanDiscardDocs : Documentation { + let Category = DocCatFunction; + let Heading = "candiscard"; + let Content = [{ +A function whose return type is marked with ``[[nodiscard]]`` generally cannot have +its return value discarded, even though this may be safe in some rare situations. +Clang allows an individual function to be marked with ``[[clang::candiscard]]`` +or ``__attribute__((candiscard))`` to override the effect of a ``[[nodiscard]]`` +return type. ---------------- cor3ntin wrote:
What is the motivation for exposing it as as a gnu attribute? afaik GCC does not have this behavior https://github.com/llvm/llvm-project/pull/154943 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits