[clang] Minor unused variable error for sanitizer builds (PR #132372)

via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 21 03:52:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-modules

Author: CHANDRA GHALE (chandraghale)

<details>
<summary>Changes</summary>

Fix to issue [https://github.com/llvm/llvm-project/issues/132371 ](https://github.com/llvm/llvm-project/issues/132371 )
Minor error ,  sanitizer builds are failing for unused variable.  
sanitizer-aarch64-linux/build/llvm-project/clang/lib/Serialization/ASTReader.cpp:11764:17: error: unused variable 'I' [-Werror,-Wunused-variable]
 11764 |   for (unsigned I : llvm::seq<unsigned>(NumFlags))

This was modified as part of [https://github.com/llvm/llvm-project/pull/129938](https://github.com/llvm/llvm-project/pull/129938) , which got missed. 

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


1 Files Affected:

- (modified) clang/lib/Serialization/ASTReader.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 930134bcd6501..c66ea5a2c0346 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -11761,7 +11761,7 @@ void OMPClauseReader::VisitOMPReductionClause(OMPReductionClause *C) {
   unsigned NumFlags = Record.readInt();
   SmallVector<bool, 16> Flags;
   Flags.reserve(NumFlags);
-  for (unsigned I : llvm::seq<unsigned>(NumFlags))
+  for ([[maybe_unused]] unsigned I : llvm::seq<unsigned>(NumFlags))
     Flags.push_back(Record.readInt());
   C->setPrivateVariableReductionFlags(Flags);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/132372


More information about the cfe-commits mailing list