[clang] [Serialization] Use traditional for loops (NFC) (PR #102761)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 10 10:12:06 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-modules
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/102761.diff
1 Files Affected:
- (modified) clang/lib/Serialization/ASTReader.cpp (+2-6)
``````````diff
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);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/102761
More information about the cfe-commits
mailing list