[clang] 4ce2f98 - [Serialization] Use traditional for loops (NFC) (#102761)

via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 10 10:49:45 PDT 2024


Author: Kazu Hirata
Date: 2024-08-10T10:49:39-07:00
New Revision: 4ce2f988b28445dadd067e6990aa6fb3db81a184

URL: https://github.com/llvm/llvm-project/commit/4ce2f988b28445dadd067e6990aa6fb3db81a184
DIFF: https://github.com/llvm/llvm-project/commit/4ce2f988b28445dadd067e6990aa6fb3db81a184.diff

LOG: [Serialization] Use traditional for loops (NFC) (#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.

Added: 
    

Modified: 
    clang/lib/Serialization/ASTReader.cpp

Removed: 
    


################################################################################
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);
 }
 


        


More information about the cfe-commits mailing list