[llvm] [llvm] Construct SmallVector with iterator ranges (NFC) (PR #136460)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 11:07:32 PDT 2025


================
@@ -515,9 +515,7 @@ PreservedAnalyses CGSCCToFunctionPassAdaptor::run(LazyCallGraph::SCC &C,
   FunctionAnalysisManager &FAM =
       AM.getResult<FunctionAnalysisManagerCGSCCProxy>(C, CG).getManager();
 
-  SmallVector<LazyCallGraph::Node *, 4> Nodes;
-  for (LazyCallGraph::Node &N : C)
-    Nodes.push_back(&N);
+  SmallVector<LazyCallGraph::Node *, 4> Nodes(llvm::make_pointer_range(C));
----------------
dwblaikie wrote:

is the SmallVector range-based ctor implicit (seems plausible that it should be, like const char* -> std::string is implicit, though even that's not without debate/concerns)? If so, perhaps this and similar changes should use `=` rather than `()` to denote that it's only an implicit conversion that's occurring?

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


More information about the llvm-commits mailing list