ADT: Prefer the LLVM_NODISCARD spelling

Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

llvm-svn: 284343
This commit is contained in:
Justin Bogner 2016-10-16 20:42:34 +00:00
parent d727738369
commit e7e65c9164
8 changed files with 11 additions and 11 deletions

View File

@ -77,7 +77,7 @@ public:
return const_iterator(getBucketsEnd(), getBucketsEnd(), *this, true); return const_iterator(getBucketsEnd(), getBucketsEnd(), *this, true);
} }
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { LLVM_NODISCARD bool empty() const {
return getNumEntries() == 0; return getNumEntries() == 0;
} }
unsigned size() const { return getNumEntries(); } unsigned size() const { return getNumEntries(); }

View File

@ -116,7 +116,7 @@ public:
} while (!V.empty() && V.back() == T()); } while (!V.empty() && V.back() == T());
} }
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { LLVM_NODISCARD T pop_back_val() {
T Ret = back(); T Ret = back();
pop_back(); pop_back();
return Ret; return Ret;

View File

@ -43,8 +43,8 @@ public:
// //
// Interface is specified by p0052r2. // Interface is specified by p0052r2.
template <typename Callable> template <typename Callable>
detail::scope_exit<typename std::decay<Callable>::type> LLVM_NODISCARD detail::scope_exit<typename std::decay<Callable>::type>
LLVM_ATTRIBUTE_UNUSED_RESULT make_scope_exit(Callable &&F) { make_scope_exit(Callable &&F) {
return detail::scope_exit<typename std::decay<Callable>::type>( return detail::scope_exit<typename std::decay<Callable>::type>(
std::forward<Callable>(F)); std::forward<Callable>(F));
} }

View File

@ -212,7 +212,7 @@ public:
vector_.pop_back(); vector_.pop_back();
} }
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { LLVM_NODISCARD T pop_back_val() {
T Ret = back(); T Ret = back();
pop_back(); pop_back();
return Ret; return Ret;

View File

@ -84,7 +84,7 @@ protected:
public: public:
typedef unsigned size_type; 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; } size_type size() const { return NumNonEmpty - NumTombstones; }
void clear() { void clear() {

View File

@ -47,7 +47,7 @@ public:
typedef size_t size_type; typedef size_t size_type;
SmallSet() {} SmallSet() {}
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { LLVM_NODISCARD bool empty() const {
return Vector.empty() && Set.empty(); return Vector.empty() && Set.empty();
} }

View File

@ -54,7 +54,7 @@ public:
return size_t((char*)CapacityX - (char*)BeginX); 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 <typename T, unsigned N> struct SmallVectorStorage; template <typename T, unsigned N> struct SmallVectorStorage;
@ -376,7 +376,7 @@ public:
this->grow(N); this->grow(N);
} }
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { LLVM_NODISCARD T pop_back_val() {
T Result = ::std::move(this->back()); T Result = ::std::move(this->back());
this->pop_back(); this->pop_back();
return Result; return Result;

View File

@ -124,10 +124,10 @@ public:
} }
/// Check if the list is empty in constant time. /// 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. /// 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()); return std::distance(begin(), end());
} }