[PATCH] D93427: [test] Cleanup some CGSCCPassManager tests

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 16:58:39 PST 2020


rnk added inline comments.


================
Comment at: llvm/unittests/Analysis/CGSCCPassManagerTest.cpp:1809
+
+    for (LazyCallGraph::Node *N : Nodes) {
+      Function &F = N->getFunction();
----------------
aeubanks wrote:
> rnk wrote:
> > What do you think of this as an alternative code pattern for safe iteration of the nodes?
> >   for (... N : std::vector<LazyCallGraph::Node*>(C.begin(), C.end())) { ... }
> I initially attempted something like that, the issue is that `C.begin()`/`end()` return references and not pointers.
Well, we could make it happen with mapped_iterator, or perhaps just encapsulating the vector construction into a function that returns the right std::vector.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93427/new/

https://reviews.llvm.org/D93427



More information about the llvm-commits mailing list