[PATCH] D23842: [CFG] Add iterator_ranges to CFG and CFGBlock.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 04:01:39 PDT 2016

alexfh added inline comments.

Comment at: include/clang/Analysis/CFG.h:526
@@ -524,1 +525,3 @@
   typedef AdjacentBlocks::const_reverse_iterator  const_pred_reverse_iterator;
+  typedef llvm::iterator_range<pred_iterator>                      pred_range;
+  typedef llvm::iterator_range<const_pred_iterator>          pred_const_range;
mboehme wrote:
> alexfh wrote:
> > Most of the time the new functions will be used in a range-based for loop. I don't think the type returned by the functions will need to be explicitly specified anywhere. I'd remove the typedefs.
> I agree the typedefs will probably never be used outside this class, but typedefs for iterator_ranges seem to be a common pattern in the Clang codebase. (EnumDecl::enumerator_range and CallExpr::arg_range are two random examples.) I assume the intent is to make the definition of the functions that return these ranges less verbose.
> Are you OK with me submitting this patch as-is (with the typedefs)?
Makes sense.


More information about the cfe-commits mailing list