[PATCH] D49756: Add maybe-unused attribute to a variable.

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 24 13:41:22 PDT 2018


nickdesaulniers created this revision.
Herald added a subscriber: llvm-commits.

Mark a variable as maybe-unused to prevent a -Wunused-but-set-variable
warning in optimized builds where asserts are removed.Test/first commit
to check setup and understand patch submission process.


Repository:
  rL LLVM

https://reviews.llvm.org/D49756

Files:
  lib/IR/SafepointIRVerifier.cpp


Index: lib/IR/SafepointIRVerifier.cpp
===================================================================
--- lib/IR/SafepointIRVerifier.cpp
+++ lib/IR/SafepointIRVerifier.cpp
@@ -84,7 +84,7 @@
   bool hasLiveIncomingEdge(const PHINode *PN, const BasicBlock *InBB) const {
     assert(!isDeadBlock(InBB) && "block must be live");
     const BasicBlock* BB = PN->getParent();
-    bool Listed = false;
+    [[maybe_unused]] bool Listed = false;
     for (const_pred_iterator PredIt(BB), End(BB, true); PredIt != End; ++PredIt) {
       if (InBB == *PredIt) {
         if (!isDeadEdge(&getEdge(PredIt)))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49756.157119.patch
Type: text/x-patch
Size: 602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180724/948512af/attachment.bin>


More information about the llvm-commits mailing list