[PATCH] D70573: [NFC] Improve comment about inverse depth-first iterator + clang-format

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 15:24:51 PST 2019


bmahjour created this revision.
bmahjour added a reviewer: Eugene.Zelenko.
bmahjour added a project: LLVM.
Herald added subscribers: llvm-commits, dexonsmith.

Stumbled upon this comment in `GraphTraits.h` and found it a bit hard to understand. I think it would be more useful to define the equivalent of an idf_iterator entirely based on a df_iterator. Agree?

I also ran clang-format.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70573

Files:
  llvm/include/llvm/ADT/GraphTraits.h


Index: llvm/include/llvm/ADT/GraphTraits.h
===================================================================
--- llvm/include/llvm/ADT/GraphTraits.h
+++ llvm/include/llvm/ADT/GraphTraits.h
@@ -31,8 +31,7 @@
 // differently without requiring a copy of the original graph. This could
 // be achieved by carrying more data in NodeRef. See LoopBodyTraits for one
 // example.
-template<class GraphType>
-struct GraphTraits {
+template <class GraphType> struct GraphTraits {
   // Elements to provide:
 
   // typedef NodeRef           - Type of Node token in the graph, which should
@@ -88,11 +87,11 @@
 // for (; I != E; ++I) { ... }
 //
 // Which is equivalent to:
-// df_iterator<Inverse<Method*>> I = idf_begin(M), E = idf_end(M);
+// df_iterator<Inverse<Method *>> I = df_begin(Inverse<Method *>(M)),
+//                                E = df_end(Inverse<Method *>(M));
 // for (; I != E; ++I) { ... }
 //
-template <class GraphType>
-struct Inverse {
+template <class GraphType> struct Inverse {
   const GraphType &Graph;
 
   inline Inverse(const GraphType &G) : Graph(G) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70573.230548.patch
Type: text/x-patch
Size: 1081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191121/cff60b06/attachment.bin>


More information about the llvm-commits mailing list