[clang] [clang][NFC] Use range-based for loop and algorithms in `SemaDeclCXX.cpp` (PR #169938)

Yanzuo Liu via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 29 08:41:48 PST 2025


================
@@ -2547,8 +2547,8 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
                  diag::ext_constexpr_function_never_constant_expr)
         << isa<CXXConstructorDecl>(Dcl) << Dcl->isConsteval()
         << Dcl->getNameInfo().getSourceRange();
-    for (size_t I = 0, N = Diags.size(); I != N; ++I)
-      SemaRef.Diag(Diags[I].first, Diags[I].second);
+    for (const auto &Diag : Diags)
+      SemaRef.Diag(Diag.first, Diag.second);
----------------
zwuis wrote:

While we are here, what about using structured bindings? Ditto elsewhere.

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


More information about the cfe-commits mailing list