summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-10-21 21:01:12 +0000
committerJustin Bogner <mail@justinbogner.com>2016-10-21 21:01:12 +0000
commit8659d16631fdd1ff519a25d6867ddd9dbda8aea9 (patch)
tree26bf928154abadfca28512e16e38b7ef58b283d0
parent3642dd3ca43cefe3d0f289858f1595fdd1aa5f0a (diff)
downloadbcm5719-llvm-8659d16631fdd1ff519a25d6867ddd9dbda8aea9.tar.gz
bcm5719-llvm-8659d16631fdd1ff519a25d6867ddd9dbda8aea9.zip
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
-rw-r--r--llvm/include/llvm/Support/Error.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index afd2660f39c..d228a0fbdbc 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/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<ErrT>() method for testing the
/// error class type.
-template <class T> class Expected {
+template <class T> class LLVM_NODISCARD Expected {
template <class OtherT> friend class Expected;
static const bool isRef = std::is_reference<T>::value;
typedef ReferenceStorage<typename std::remove_reference<T>::type> wrap;
OpenPOWER on IntegriCloud