From d4e3f0bc43205bf10b41789a07343fa25b94dc63 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 21 Oct 2016 21:01:12 +0000 Subject: [PATCH] Support: Annotate Error and Expected<> with LLVM_NODISCARD It's always a mistake to ignore return values with Error or Expected types. llvm-svn: 284884 --- include/llvm/Support/Error.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/llvm/Support/Error.h b/include/llvm/Support/Error.h index afd2660f39c..d228a0fbdbc 100644 --- a/include/llvm/Support/Error.h +++ b/include/llvm/Support/Error.h @@ -135,7 +135,7 @@ private: /// *All* Error instances must be checked before destruction, even if /// they're moved-assigned or constructed from Success values that have already /// been checked. This enforces checking through all levels of the call stack. -class Error { +class LLVM_NODISCARD Error { // ErrorList needs to be able to yank ErrorInfoBase pointers out of this // class to add to the error list. @@ -611,7 +611,7 @@ private: /// Error cannot be copied, this class replaces getError() with /// takeError(). It also adds an bool errorIsA() method for testing the /// error class type. -template class Expected { +template class LLVM_NODISCARD Expected { template friend class Expected; static const bool isRef = std::is_reference::value; typedef ReferenceStorage::type> wrap;