ADT: Prefer the LLVM_NODISCARD spelling
authorJustin Bogner <mail@justinbogner.com>
Sun, 16 Oct 2016 20:42:34 +0000 (20:42 +0000)
committerJustin Bogner <mail@justinbogner.com>
Sun, 16 Oct 2016 20:42:34 +0000 (20:42 +0000)
Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

llvm-svn: 284343

llvm/include/llvm/ADT/DenseMap.h
llvm/include/llvm/ADT/PriorityWorklist.h
llvm/include/llvm/ADT/ScopeExit.h
llvm/include/llvm/ADT/SetVector.h
llvm/include/llvm/ADT/SmallPtrSet.h
llvm/include/llvm/ADT/SmallSet.h
llvm/include/llvm/ADT/SmallVector.h
llvm/include/llvm/ADT/simple_ilist.h

index f3910b1..1eb9abc 100644 (file)
@@ -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(); }
index 9dd575f..511606b 100644 (file)
@@ -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;
index 28a1124..4e64352 100644 (file)
@@ -43,8 +43,8 @@ public:
 //
 // Interface is specified by p0052r2.
 template <typename Callable>
-detail::scope_exit<typename std::decay<Callable>::type>
-    LLVM_ATTRIBUTE_UNUSED_RESULT make_scope_exit(Callable &&F) {
+LLVM_NODISCARD detail::scope_exit<typename std::decay<Callable>::type>
+make_scope_exit(Callable &&F) {
   return detail::scope_exit<typename std::decay<Callable>::type>(
       std::forward<Callable>(F));
 }
index 01d38a8..455f8a8 100644 (file)
@@ -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;
index eaed6aa..1f8571a 100644 (file)
@@ -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() {
index aaa5ff0..07bdf0c 100644 (file)
@@ -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();
   }
 
index 9403579..996f56f 100644 (file)
@@ -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 <typename T, unsigned N> 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;
index 9235bad..a1ab591 100644 (file)
@@ -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());
   }