[clang] 27bba42 - [clang] Use range-based for loops (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 4 00:31:45 PDT 2023


Author: Kazu Hirata
Date: 2023-09-04T00:31:37-07:00
New Revision: 27bba42fc9e7674c6a8936c14e9614f3d7a30a85

URL: https://github.com/llvm/llvm-project/commit/27bba42fc9e7674c6a8936c14e9614f3d7a30a85
DIFF: https://github.com/llvm/llvm-project/commit/27bba42fc9e7674c6a8936c14e9614f3d7a30a85.diff

LOG: [clang] Use range-based for loops (NFC)

Added: 
    

Modified: 
    clang/lib/Parse/ParseObjc.cpp
    clang/lib/Sema/SemaPseudoObject.cpp
    clang/utils/TableGen/RISCVVEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 38448a0825617ac..c0261c462b8834e 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -65,10 +65,10 @@ Parser::ParseObjCAtDirectives(ParsedAttributes &DeclAttrs,
   case tok::objc_implementation:
     break;
   default:
-    llvm::for_each(DeclAttrs, [this](const auto &Attr) {
+    for (const auto &Attr : DeclAttrs) {
       if (Attr.isGNUAttribute())
         Diag(Tok.getLocation(), diag::err_objc_unexpected_attr);
-    });
+    }
   }
 
   Decl *SingleDecl = nullptr;

diff  --git a/clang/lib/Sema/SemaPseudoObject.cpp b/clang/lib/Sema/SemaPseudoObject.cpp
index 408f71044fa306f..1ac895e4eb1c86c 100644
--- a/clang/lib/Sema/SemaPseudoObject.cpp
+++ b/clang/lib/Sema/SemaPseudoObject.cpp
@@ -1451,7 +1451,8 @@ MSPropertyOpBuilder::getBaseMSProperty(MSPropertySubscriptExpr *E) {
 
 Expr *MSPropertyOpBuilder::rebuildAndCaptureObject(Expr *syntacticBase) {
   InstanceBase = capture(RefExpr->getBaseExpr());
-  llvm::for_each(CallArgs, [this](Expr *&Arg) { Arg = capture(Arg); });
+  for (Expr *&Arg : CallArgs)
+    Arg = capture(Arg);
   syntacticBase = Rebuilder(S, [=](Expr *, unsigned Idx) -> Expr * {
                     switch (Idx) {
                     case 0:

diff  --git a/clang/utils/TableGen/RISCVVEmitter.cpp b/clang/utils/TableGen/RISCVVEmitter.cpp
index d2c3d70ac1f0121..41025926058ed07 100644
--- a/clang/utils/TableGen/RISCVVEmitter.cpp
+++ b/clang/utils/TableGen/RISCVVEmitter.cpp
@@ -264,13 +264,14 @@ void SemaSignatureTable::init(ArrayRef<SemaRecord> SemaRecords) {
 
   assert(!SemaRecords.empty());
 
-  llvm::for_each(SemaRecords, [&](const SemaRecord &SR) {
+  for (const SemaRecord &SR : SemaRecords) {
     InsertToSignatureSet(SR.Prototype);
     InsertToSignatureSet(SR.Suffix);
     InsertToSignatureSet(SR.OverloadedSuffix);
-  });
+  }
 
-  llvm::for_each(Signatures, [this](auto &Sig) { insert(Sig); });
+  for (auto &Sig : Signatures)
+    insert(Sig);
 }
 
 void SemaSignatureTable::insert(ArrayRef<PrototypeDescriptor> Signature) {


        


More information about the cfe-commits mailing list