From: Justin Bogner Date: Sun, 16 Oct 2016 20:42:34 +0000 (+0000) Subject: ADT: Prefer the LLVM_NODISCARD spelling X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7e65c91649644a5d4976af2dddce792866255a4;p=platform%2Fupstream%2Fllvm.git ADT: Prefer the LLVM_NODISCARD spelling Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use LLVM_NODISCARD instead. llvm-svn: 284343 --- diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index f3910b1..1eb9abc 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -77,7 +77,7 @@ public: return const_iterator(getBucketsEnd(), getBucketsEnd(), *this, true); } - bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { + LLVM_NODISCARD bool empty() const { return getNumEntries() == 0; } unsigned size() const { return getNumEntries(); } diff --git a/llvm/include/llvm/ADT/PriorityWorklist.h b/llvm/include/llvm/ADT/PriorityWorklist.h index 9dd575f..511606b 100644 --- a/llvm/include/llvm/ADT/PriorityWorklist.h +++ b/llvm/include/llvm/ADT/PriorityWorklist.h @@ -116,7 +116,7 @@ public: } while (!V.empty() && V.back() == T()); } - T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { + LLVM_NODISCARD T pop_back_val() { T Ret = back(); pop_back(); return Ret; diff --git a/llvm/include/llvm/ADT/ScopeExit.h b/llvm/include/llvm/ADT/ScopeExit.h index 28a1124..4e64352 100644 --- a/llvm/include/llvm/ADT/ScopeExit.h +++ b/llvm/include/llvm/ADT/ScopeExit.h @@ -43,8 +43,8 @@ public: // // Interface is specified by p0052r2. template -detail::scope_exit::type> - LLVM_ATTRIBUTE_UNUSED_RESULT make_scope_exit(Callable &&F) { +LLVM_NODISCARD detail::scope_exit::type> +make_scope_exit(Callable &&F) { return detail::scope_exit::type>( std::forward(F)); } diff --git a/llvm/include/llvm/ADT/SetVector.h b/llvm/include/llvm/ADT/SetVector.h index 01d38a8..455f8a8 100644 --- a/llvm/include/llvm/ADT/SetVector.h +++ b/llvm/include/llvm/ADT/SetVector.h @@ -212,7 +212,7 @@ public: vector_.pop_back(); } - T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { + LLVM_NODISCARD T pop_back_val() { T Ret = back(); pop_back(); return Ret; diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h index eaed6aa..1f8571a 100644 --- a/llvm/include/llvm/ADT/SmallPtrSet.h +++ b/llvm/include/llvm/ADT/SmallPtrSet.h @@ -84,7 +84,7 @@ protected: public: typedef unsigned size_type; - bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; } + LLVM_NODISCARD bool empty() const { return size() == 0; } size_type size() const { return NumNonEmpty - NumTombstones; } void clear() { diff --git a/llvm/include/llvm/ADT/SmallSet.h b/llvm/include/llvm/ADT/SmallSet.h index aaa5ff0..07bdf0c 100644 --- a/llvm/include/llvm/ADT/SmallSet.h +++ b/llvm/include/llvm/ADT/SmallSet.h @@ -47,7 +47,7 @@ public: typedef size_t size_type; SmallSet() {} - bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { + LLVM_NODISCARD bool empty() const { return Vector.empty() && Set.empty(); } diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h index 9403579..996f56f 100644 --- a/llvm/include/llvm/ADT/SmallVector.h +++ b/llvm/include/llvm/ADT/SmallVector.h @@ -54,7 +54,7 @@ public: return size_t((char*)CapacityX - (char*)BeginX); } - bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return BeginX == EndX; } + LLVM_NODISCARD bool empty() const { return BeginX == EndX; } }; template struct SmallVectorStorage; @@ -376,7 +376,7 @@ public: this->grow(N); } - T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { + LLVM_NODISCARD T pop_back_val() { T Result = ::std::move(this->back()); this->pop_back(); return Result; diff --git a/llvm/include/llvm/ADT/simple_ilist.h b/llvm/include/llvm/ADT/simple_ilist.h index 9235bad..a1ab591 100644 --- a/llvm/include/llvm/ADT/simple_ilist.h +++ b/llvm/include/llvm/ADT/simple_ilist.h @@ -124,10 +124,10 @@ public: } /// Check if the list is empty in constant time. - bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return Sentinel.empty(); } + LLVM_NODISCARD bool empty() const { return Sentinel.empty(); } /// Calculate the size of the list in linear time. - size_type LLVM_ATTRIBUTE_UNUSED_RESULT size() const { + LLVM_NODISCARD size_type size() const { return std::distance(begin(), end()); }