[llvm] r284343 - ADT: Prefer the LLVM_NODISCARD spelling

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 16 13:42:34 PDT 2016


Author: bogner
Date: Sun Oct 16 15:42:34 2016
New Revision: 284343

URL: http://llvm.org/viewvc/llvm-project?rev=284343&view=rev
Log:
ADT: Prefer the LLVM_NODISCARD spelling

Update functions annotated with LLVM_ATTRIBUTE_UNUSED_RESULT to use
LLVM_NODISCARD instead.

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

Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Sun Oct 16 15:42:34 2016
@@ -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(); }

Modified: llvm/trunk/include/llvm/ADT/PriorityWorklist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PriorityWorklist.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PriorityWorklist.h (original)
+++ llvm/trunk/include/llvm/ADT/PriorityWorklist.h Sun Oct 16 15:42:34 2016
@@ -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;

Modified: llvm/trunk/include/llvm/ADT/ScopeExit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ScopeExit.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ScopeExit.h (original)
+++ llvm/trunk/include/llvm/ADT/ScopeExit.h Sun Oct 16 15:42:34 2016
@@ -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));
 }

Modified: llvm/trunk/include/llvm/ADT/SetVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SetVector.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SetVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SetVector.h Sun Oct 16 15:42:34 2016
@@ -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;

Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Sun Oct 16 15:42:34 2016
@@ -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() {

Modified: llvm/trunk/include/llvm/ADT/SmallSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallSet.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallSet.h Sun Oct 16 15:42:34 2016
@@ -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();
   }
 

Modified: llvm/trunk/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallVector.h Sun Oct 16 15:42:34 2016
@@ -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;

Modified: llvm/trunk/include/llvm/ADT/simple_ilist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/simple_ilist.h?rev=284343&r1=284342&r2=284343&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/simple_ilist.h (original)
+++ llvm/trunk/include/llvm/ADT/simple_ilist.h Sun Oct 16 15:42:34 2016
@@ -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());
   }
 




More information about the llvm-commits mailing list