llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Balázs Benics (steakhal)

<details>
<summary>Changes</summary>

FYI `llvm::append_range()` does a `reserve` inside if the range supports 
`size()`.

Assisted-By: Claude Code

---
Full diff: https://github.com/llvm/llvm-project/pull/246880.diff


16 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp (+3-10) 
- (modified) clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp (+4-6) 
- (modified) clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp (+4-4) 
- (modified) clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (+9-14) 
- (modified) clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp (+4-5) 
- (modified) 
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp 
(+5-7) 
- (modified) clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp 
(+8-8) 
- (modified) clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp (+5-6) 
- (modified) clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp 
(+10-12) 
- (modified) clang/lib/StaticAnalyzer/Core/BugReporter.cpp (+2-7) 
- (modified) clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (+1-1) 
- (modified) clang/lib/StaticAnalyzer/Core/DynamicType.cpp (+4-8) 
- (modified) clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (+1-1) 
- (modified) clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp (+6-9) 
- (modified) clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (+5-6) 
- (modified) clang/lib/StaticAnalyzer/Core/ProgramState.cpp (+2-3) 


``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
index 24c56c4ee2ebcb..7aa6599d4d0d7e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/AnalyzerStatsChecker.cpp
@@ -65,17 +65,10 @@ void AnalyzerStatsChecker::checkEndAnalysis(ExplodedGraph 
&G,
   // Get the CFG and the Decl of this block.
   C = RootSF->getCFG();
 
-  unsigned total = 0, unreachable = 0;
-
   // Find CFGBlocks that were not covered by any node
-  for (CFG::const_iterator I = C->begin(); I != C->end(); ++I) {
-    const CFGBlock *CB = *I;
-    ++total;
-    // Check if the block is unreachable
-    if (!reachable.count(CB)) {
-      ++unreachable;
-    }
-  }
+  unsigned total = llvm::size(*C);
+  auto IsUnreachable = [&](const CFGBlock *CB) { return !reachable.count(CB); 
};
+  unsigned unreachable = llvm::count_if(*C, IsUnreachable);
 
   // We never 'reach' the entry block, so correct the unreachable count
   unreachable--;
diff --git a/clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
index 2889629de2c4bc..feab839032136a 100644
--- a/clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp
@@ -77,12 +77,10 @@ class InnerPointerChecker
                                      PathSensitiveBugReport &BR) override;
 
     bool isSymbolTracked(ProgramStateRef State, SymbolRef Sym) {
-      RawPtrMapTy Map = State->get<RawPtrMap>();
-      for (const auto &Entry : Map) {
-        if (Entry.second.contains(Sym))
-          return true;
-      }
-      return false;
+      auto ContainsSym = [&](const auto &Entry) {
+        return Entry.second.contains(Sym);
+      };
+      return llvm::any_of(State->get<RawPtrMap>(), ContainsSym);
     }
   };
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp 
b/clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp
index 7074e715d789b4..8164bb51751059 100644
--- a/clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp
@@ -69,10 +69,10 @@ std::vector<const MemRegion *> 
lifetime_modeling::getDanglingRegionsAfterReturn(
     SVal Val, ProgramStateRef State, CheckerContext &C) {
   std::vector<const MemRegion *> Regions;
   if (auto *SourceSet = State->get<LifetimeBoundMap>(Val)) {
-    for (const MemRegion *Region : *SourceSet) {
-      if (isDanglingStackSource(Region, State, C))
-        Regions.push_back(Region);
-    }
+    auto IsDangling = [&](const MemRegion *Region) {
+      return isDanglingStackSource(Region, State, C);
+    };
+    llvm::copy_if(*SourceSet, std::back_inserter(Regions), IsDangling);
   }
   return Regions;
 }
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 517a31ba48a8cd..dac2aab94d998e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -1170,11 +1170,8 @@ class EscapeTrackedCallback final : public SymbolVisitor 
{
 
     // scanReachableSymbols is expensive, so we use a single visitor for all
     // roots
-    SmallVector<const MemRegion *, 10> Regions;
+    SmallVector<const MemRegion *, 10> Regions = llvm::to_vector<10>(Roots);
     EscapeTrackedCallback Visitor(State);
-    for (const MemRegion *R : Roots) {
-      Regions.push_back(R);
-    }
     State->scanReachableSymbols(Regions, Visitor);
     return Visitor.State;
   }
@@ -1230,11 +1227,11 @@ bool MallocChecker::isFreeingOwnershipAttrCall(const 
CallEvent &Call) {
 
 bool MallocChecker::isFreeingOwnershipAttrCall(const FunctionDecl *Func) {
   if (Func->hasAttrs()) {
-    for (const auto *I : Func->specific_attrs<OwnershipAttr>()) {
+    auto IsFreeing = [](const OwnershipAttr *I) {
       OwnershipAttr::OwnershipKind OwnKind = I->getOwnKind();
-      if (OwnKind == OwnershipAttr::Takes || OwnKind == OwnershipAttr::Holds)
-        return true;
-    }
+      return OwnKind == OwnershipAttr::Takes || OwnKind == 
OwnershipAttr::Holds;
+    };
+    return llvm::any_of(Func->specific_attrs<OwnershipAttr>(), IsFreeing);
   }
   return false;
 }
@@ -1253,12 +1250,10 @@ bool MallocChecker::isAllocatingOwnershipAttrCall(const 
CallEvent &Call) {
 }
 
 bool MallocChecker::isAllocatingOwnershipAttrCall(const FunctionDecl *Func) {
-  for (const auto *I : Func->specific_attrs<OwnershipAttr>()) {
-    if (I->getOwnKind() == OwnershipAttr::Returns)
-      return true;
-  }
-
-  return false;
+  auto IsAllocating = [](const OwnershipAttr *I) {
+    return I->getOwnKind() == OwnershipAttr::Returns;
+  };
+  return llvm::any_of(Func->specific_attrs<OwnershipAttr>(), IsAllocating);
 }
 
 bool MallocChecker::isMemCall(const CallEvent &Call) const {
diff --git a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
index 82edc12b8c5779..04198b4904da9e 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
@@ -271,11 +271,10 @@ static ProgramStateRef removeFromState(ProgramStateRef 
State,
 
 static bool isAnyBaseRegionReported(ProgramStateRef State,
                                     const MemRegion *Region) {
-  for (auto &E : State->get<TrackedRegionMap>()) {
-    if (Region->isSubRegionOf(E.first) && E.second.isReported())
-      return true;
-  }
-  return false;
+  auto IsReportedBase = [&](const auto &E) {
+    return Region->isSubRegionOf(E.first) && E.second.isReported();
+  };
+  return llvm::any_of(State->get<TrackedRegionMap>(), IsReportedBase);
 }
 
 static const MemRegion *unwrapRValueReferenceIndirection(const MemRegion *MR) {
diff --git 
a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
 
b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
index f7ad599346f8a4..5588b064581b04 100644
--- 
a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ 
b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -502,16 +502,14 @@ RefCountReportVisitor::VisitNode(const ExplodedNode *N, 
BugReporterContext &BRC,
     if (const CallExpr *CE = dyn_cast<CallExpr>(S)) {
       // Iterate through the parameter expressions and see if the symbol
       // was ever passed as an argument.
-      for (auto AI = CE->arg_begin(), AE = CE->arg_end(); AI != AE; ++AI) {
-
+      auto IsTrackedSymbol = [&](const Expr *Arg) {
         // Retrieve the value of the argument.  Is it the symbol
         // we are interested in?
-        if (CurrSt->getSValAsScalarOrLoc(*AI, SF).getAsLocSymbol() != Sym)
-          continue;
-
-        // We have an argument.  Get the effect!
+        return CurrSt->getSValAsScalarOrLoc(Arg, SF).getAsLocSymbol() == Sym;
+      };
+      // We have an argument.  Get the effect!
+      if (llvm::any_of(CE->arguments(), IsTrackedSymbol))
         DeallocSent = true;
-      }
     } else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(S)) {
       if (const Expr *R = ME->getInstanceReceiver()) {
         if (CurrSt->getSValAsScalarOrLoc(R, SF).getAsLocSymbol() == Sym) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
index d5ff3a2b168339..8d1a3317ebed57 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -802,14 +802,14 @@ class StdLibraryFunctionsChecker
     // Once we know the exact type of the function then do validation check on
     // all the given constraints.
     bool validateByConstraints(const FunctionDecl *FD) const {
-      for (const SummaryCase &Case : Cases)
-        for (const ValueConstraintPtr &Constraint : Case.getConstraints())
-          if (!Constraint->checkValidity(FD))
-            return false;
-      for (const ValueConstraintPtr &Constraint : ArgConstraints)
-        if (!Constraint->checkValidity(FD))
-          return false;
-      return true;
+      auto IsValid = [&](const ValueConstraintPtr &Constraint) {
+        return Constraint->checkValidity(FD);
+      };
+      auto IsCaseValid = [&](const SummaryCase &Case) {
+        return llvm::all_of(Case.getConstraints(), IsValid);
+      };
+      return llvm::all_of(Cases, IsCaseValid) &&
+             llvm::all_of(ArgConstraints, IsValid);
     }
   };
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index 528e41ec16d9ce..f900744d35ddf1 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -812,14 +812,13 @@ class NoStreamStateChangeVisitor final : public 
NoOwnershipChangeVisitor {
     using namespace clang::ast_matchers;
 
     auto Matches = match(findAll(callExpr().bind("call")), *Body, ACtx);
-    for (BoundNodes Match : Matches) {
-      if (const auto *Call = Match.getNodeAs<CallExpr>("call"))
-        if (isClosingCallAsWritten(*Call))
-          return true;
-    }
+    auto IsClosingCallAsWritten = [this](const BoundNodes &Match) {
+      const auto *Call = Match.getNodeAs<CallExpr>("call");
+      return Call && isClosingCallAsWritten(*Call);
+    };
     // TODO: Ownership might change with an attempt to store stream object, not
     // only through closing it. Check for attempted stores as well.
-    return false;
+    return llvm::any_of(Matches, IsClosingCallAsWritten);
   }
 
   bool hasResourceStateChanged(ProgramStateRef CallEnterState,
diff --git a/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
index 84b744fac751e7..65af61e53a7226 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -125,18 +125,16 @@ void 
UnreachableCodeChecker::checkEndAnalysis(ExplodedGraph &G,
     // FIXME: This should be extended to include other unreachable markers,
     // such as llvm_unreachable.
     if (!CB->empty()) {
-      bool foundUnreachable = false;
-      for (CFGBlock::const_iterator ci = CB->begin(), ce = CB->end();
-           ci != ce; ++ci) {
-        if (std::optional<CFGStmt> S = (*ci).getAs<CFGStmt>())
-          if (const CallExpr *CE = dyn_cast<CallExpr>(S->getStmt())) {
-            if (CE->getBuiltinCallee() == Builtin::BI__builtin_unreachable ||
-                CE->isBuiltinAssumeFalse(Eng.getContext())) {
-              foundUnreachable = true;
-              break;
-            }
-          }
-      }
+      auto IsUnreachableMarker = [&](const CFGElement &Elem) {
+        std::optional<CFGStmt> S = Elem.getAs<CFGStmt>();
+        if (!S)
+          return false;
+        const auto *CE = dyn_cast<CallExpr>(S->getStmt());
+        return CE &&
+               (CE->getBuiltinCallee() == Builtin::BI__builtin_unreachable ||
+                CE->isBuiltinAssumeFalse(Eng.getContext()));
+      };
+      bool foundUnreachable = llvm::any_of(*CB, IsUnreachableMarker);
       if (foundUnreachable)
         continue;
     }
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp 
b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index c0ade4e5f85708..526781591ba2ee 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2131,11 +2131,7 @@ void BugType::anchor() {}
 
 LLVM_ATTRIBUTE_USED static bool
 isDependency(const CheckerRegistryData &Registry, StringRef CheckerName) {
-  for (const std::pair<StringRef, StringRef> &Pair : Registry.Dependencies) {
-    if (Pair.second == CheckerName)
-      return true;
-  }
-  return false;
+  return is_contained(make_second_range(Registry.Dependencies), CheckerName);
 }
 
 LLVM_ATTRIBUTE_USED static bool isHidden(const CheckerRegistryData &Registry,
@@ -2714,8 +2710,7 @@ BugPathInfo *BugPathGetter::getNextBugPath() {
 
     // Find the next predeccessor node.  We choose the node that is marked
     // with the lowest BFS number.
-    OrigN = *std::min_element(OrigN->pred_begin(), OrigN->pred_end(),
-                              PriorityCompare<false>(PriorityMap));
+    OrigN = *min_element(OrigN->preds(), PriorityCompare<false>(PriorityMap));
   }
 
   CurrentBugPath.BugPath = std::move(GNew);
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp 
b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
index 38d1cab8ff71e9..4054363cb48f91 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -740,7 +740,7 @@ bool NoStoreFuncVisitor::prettyPrintRegionName(const 
RegionVector &FieldChain,
     R = cast<SubRegion>(R)->getSuperRegion();
   }
   std::reverse(RegionSequence.begin(), RegionSequence.end());
-  RegionSequence.append(FieldChain.begin(), FieldChain.end());
+  llvm::append_range(RegionSequence, FieldChain);
 
   StringRef Sep;
   for (const MemRegion *R : RegionSequence) {
diff --git a/clang/lib/StaticAnalyzer/Core/DynamicType.cpp 
b/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
index fb6dfd92646066..e6e9f8d863d240 100644
--- a/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
+++ b/clang/lib/StaticAnalyzer/Core/DynamicType.cpp
@@ -238,16 +238,12 @@ static raw_ostream &printJsonContainer(const ContainerTy 
&Container,
 
   ++Space;
   Out << '[' << NL;
-  for (auto I = Container.begin(); I != Container.end(); ++I) {
-    const auto &Element = *I;
-
+  auto PrintElement = [&](const auto &Element) {
     Indent(Out, Space, IsDot) << "{ ";
     printJson(Element, Out, NL, Space, IsDot) << " }";
-
-    if (std::next(I) != Container.end())
-      Out << ',';
-    Out << NL;
-  }
+  };
+  llvm::interleave(Container, PrintElement, [&] { Out << ',' << NL; });
+  Out << NL;
 
   --Space;
   return Indent(Out, Space, IsDot) << "]";
diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp 
b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
index 50b341c13a4cc8..0f207555cb2788 100644
--- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -474,7 +474,7 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
     }
 
     // Visit our predecessors and enqueue them.
-    WL1.append(N->Preds.begin(), N->Preds.end());
+    llvm::append_range(WL1, N->Preds);
   }
 
   // We didn't hit the root? Return with a null pointer for the new graph.
diff --git a/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp 
b/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
index 02e076219b612b..567ed64f7cdb3f 100644
--- a/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
+++ b/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
@@ -195,11 +195,9 @@ static bool isCapturedByReference(ExplodedNode *N, const 
DeclRefExpr *DR) {
 
 static bool isFoundInStmt(const Stmt *S, const VarDecl *VD) {
   if (const DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
-    for (const Decl *D : DS->decls()) {
-      // Once we reach the declaration of the VD we can return.
-      if (D->getCanonicalDecl() == VD)
-        return true;
-    }
+    auto IsVD = [&](const Decl *D) { return D->getCanonicalDecl() == VD; };
+    // Once we reach the declaration of the VD we can return.
+    return llvm::any_of(DS->decls(), IsVD);
   }
   return false;
 }
@@ -239,10 +237,9 @@ static bool isPossiblyEscaped(ExplodedNode *N, const 
DeclRefExpr *DR) {
 
     if (const auto *SS = dyn_cast<SwitchStmt>(S)) {
       if (const auto *CST = dyn_cast<CompoundStmt>(SS->getBody())) {
-        for (const Stmt *CB : CST->body()) {
-          if (isFoundInStmt(CB, VD))
-            return false;
-        }
+        auto DeclaresVD = [&](const Stmt *CB) { return isFoundInStmt(CB, VD); 
};
+        if (llvm::any_of(CST->body(), DeclaresVD))
+          return false;
       }
     }
 
diff --git a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp 
b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
index ee6b613e579f14..94f9ad38e912cb 100644
--- a/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
+++ b/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
@@ -254,8 +254,7 @@ void PlistPrinter::ReportControlFlow(raw_ostream &o,
   ++indent;
   Indent(o, indent) << "<array>\n";
   ++indent;
-  for (PathDiagnosticControlFlowPiece::const_iterator I=P.begin(), E=P.end();
-       I!=E; ++I) {
+  for (const PathDiagnosticLocationPair &Edge : P) {
     Indent(o, indent) << "<dict>\n";
     ++indent;
 
@@ -264,12 +263,12 @@ void PlistPrinter::ReportControlFlow(raw_ostream &o,
     // logic for clients.
     Indent(o, indent) << "<key>start</key>\n";
     SourceRange StartEdge(
-        SM.getExpansionLoc(I->getStart().asRange().getBegin()));
+        SM.getExpansionLoc(Edge.getStart().asRange().getBegin()));
     EmitRange(o, SM, Lexer::getAsCharRange(StartEdge, SM, LangOpts), FM,
               indent + 1);
 
     Indent(o, indent) << "<key>end</key>\n";
-    SourceRange EndEdge(SM.getExpansionLoc(I->getEnd().asRange().getBegin()));
+    SourceRange 
EndEdge(SM.getExpansionLoc(Edge.getEnd().asRange().getBegin()));
     EmitRange(o, SM, Lexer::getAsCharRange(EndEdge, SM, LangOpts), FM,
               indent + 1);
 
@@ -349,8 +348,8 @@ void PlistPrinter::ReportCall(raw_ostream &o, const 
PathDiagnosticCallPiece &P,
     ReportPiece(o, *callEnterWithinCaller, indent, depth,
                 /*includeControlFlow*/ true);
 
-  for (PathPieces::const_iterator I = P.path.begin(), E = 
P.path.end();I!=E;++I)
-    ReportPiece(o, **I, indent, depth, /*includeControlFlow*/ true);
+  for (const auto &Piece : P.path)
+    ReportPiece(o, *Piece, indent, depth, /*includeControlFlow*/ true);
 
   --depth;
 
diff --git a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp 
b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
index eaa623a3a9e121..5ff32d73225164 100644
--- a/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ProgramState.cpp
@@ -75,9 +75,8 @@ ProgramStateManager::ProgramStateManager(ASTContext &Ctx,
 
 
 ProgramStateManager::~ProgramStateManager() {
-  for (GDMContextsTy::iterator I=GDMContexts.begin(), E=GDMContexts.end();
-       I!=E; ++I)
-    I->second.second(I->second.first);
+  for (const auto &[Key, Ctx] : GDMContexts)
+    Ctx.second(Ctx.first);
 }
 
 ProgramStateRef ProgramStateManager::removeDeadBindingsFromEnvironmentAndStore(

``````````

</details>


https://github.com/llvm/llvm-project/pull/246880
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to