[llvm] 2829486 - [IR] Ignore the return value of std::remove_if (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 01:15:14 PDT 2023


Author: Jie Fu
Date: 2023-08-17T16:13:34+08:00
New Revision: 2829486a8b4b50ba3f63ae445d28f9c6f50a963b

URL: https://github.com/llvm/llvm-project/commit/2829486a8b4b50ba3f63ae445d28f9c6f50a963b
DIFF: https://github.com/llvm/llvm-project/commit/2829486a8b4b50ba3f63ae445d28f9c6f50a963b.diff

LOG: [IR] Ignore the return value of std::remove_if (NFC)

/Users/jiefu/llvm-project/llvm/lib/IR/Instructions.cpp:166:3: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
  std::remove_if(const_cast<block_iterator>(block_begin()),
  ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Added: 
    

Modified: 
    llvm/lib/IR/Instructions.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 59f6f5e119e828..31c3d30065f5f6 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -163,7 +163,7 @@ void PHINode::removeIncomingValueIf(function_ref<bool(unsigned)> Predicate,
     U.set(nullptr);
 
   // Remove incoming blocks.
-  std::remove_if(const_cast<block_iterator>(block_begin()),
+  (void)std::remove_if(const_cast<block_iterator>(block_begin()),
                  const_cast<block_iterator>(block_end()), [&](BasicBlock *&BB) {
                    return RemoveIndices.contains(&BB - block_begin());
                  });


        


More information about the llvm-commits mailing list