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

Martin Böhme via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 02:12:31 PDT 2016


mboehme marked an inline comment as done.

================
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;
----------------
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)?


https://reviews.llvm.org/D23842





More information about the cfe-commits mailing list