Skip to content

[NFC] Use [[maybe_unused]] for variable used in assertion #153639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

mtrofin
Copy link
Member

@mtrofin mtrofin commented Aug 14, 2025

No description provided.

Copy link
Member Author

mtrofin commented Aug 14, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Member Author

mtrofin commented Aug 14, 2025

I meant to address this in #153305 but entered a race condition with graphite of my own doing.

@mtrofin mtrofin marked this pull request as ready for review August 14, 2025 18:22
@llvmbot
Copy link
Member

llvmbot commented Aug 14, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Mircea Trofin (mtrofin)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/153639.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp (+1-2)
diff --git a/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp b/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp
index 6719ce64b96b6..8f5ec782d5ad5 100644
--- a/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpTableToSwitch.cpp
@@ -149,9 +149,8 @@ expandToSwitch(CallBase *CB, const JumpTableTy &JT, DomTreeUpdater &DTU,
         std::numeric_limits<uint32_t>::max(), TotalCount);
 
     for (const auto &[G, C] : Targets) {
-      auto It = GuidToCounter.insert({G, C});
+      [[maybe_unused]] auto It = GuidToCounter.insert({G, C});
       assert(It.second);
-      (void)It;
     }
   }
   for (auto [Index, Func] : llvm::enumerate(JT.Funcs)) {

@mtrofin mtrofin enabled auto-merge (squash) August 14, 2025 18:24
@mtrofin mtrofin merged commit 016c301 into main Aug 14, 2025
9 checks passed
@mtrofin mtrofin deleted the users/mtrofin/08-14-_nfc_use_maybe_unused_for_variable_used_in_assertion branch August 14, 2025 18:52
mdenson pushed a commit to mdenson/llvm-project that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants