https://github.com/kazutakahirata created 
https://github.com/llvm/llvm-project/pull/102761

The use of _ requires either:

- (void)_ and curly braces, or
- [[maybe_unused]].

For simple repetitions like these, we can use traditional for loops
for readable warning-free code.


>From 68c22e9e8010c65eaff27a57d4cc5d4d84b3895a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <k...@google.com>
Date: Sat, 10 Aug 2024 09:26:13 -0700
Subject: [PATCH] [Serialization] Use traditional for loops (NFC)

The use of _ requires either:

- (void)_ and curly braces, or
- [[maybe_unused]].

For simple repetitions like these, we can use traditional for loops
for readable warning-free code.
---
 clang/lib/Serialization/ASTReader.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/clang/lib/Serialization/ASTReader.cpp 
b/clang/lib/Serialization/ASTReader.cpp
index 8ff7c82950dba..5f9cfa3cf4bfa 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -11468,10 +11468,8 @@ void 
OMPClauseReader::VisitOMPNumTeamsClause(OMPNumTeamsClause *C) {
   unsigned NumVars = C->varlist_size();
   SmallVector<Expr *, 16> Vars;
   Vars.reserve(NumVars);
-  for ([[maybe_unused]] auto _ : llvm::seq<unsigned>(NumVars)) {
-    (void)_;
+  for (unsigned I = 0; I != NumVars; ++I)
     Vars.push_back(Record.readSubExpr());
-  }
   C->setVarRefs(Vars);
 }
 
@@ -11481,10 +11479,8 @@ void 
OMPClauseReader::VisitOMPThreadLimitClause(OMPThreadLimitClause *C) {
   unsigned NumVars = C->varlist_size();
   SmallVector<Expr *, 16> Vars;
   Vars.reserve(NumVars);
-  for (auto _ : llvm::seq<unsigned>(NumVars)) {
-    (void)_;
+  for (unsigned I = 0; I != NumVars; ++I)
     Vars.push_back(Record.readSubExpr());
-  }
   C->setVarRefs(Vars);
 }
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to