[PATCH] D50120: [ADT] Add some documentation for GraphTraits.

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 31 20:44:38 PDT 2018


dberris added inline comments.


================
Comment at: llvm/include/llvm/ADT/GraphTraits.h:28-30
+// GraphTraits is not designed in the most convenient and intuitive way, as it
+// started with simple and limited scenarios (aka BasicBlock), and over time
+// evolved to facncier applications (e.g. CFG and DomTree).
----------------
Typo: "facncier"

Also, this could be a simpler sentence without "value judgments". Something like:

```
// This template evolved from supporting `BasicBlock` to also later supporting
// more complex types (e.g. CFG and DomTree).
```


================
Comment at: llvm/include/llvm/ADT/GraphTraits.h:32-35
+// One of the common "fancy" uses of GraphTraits is to create a view of a
+// physical graph. The view interprets the physical graph slightly differently
+// without incurring significant memory footprint. Such application is possible
+// by hacking on NodeRef. LoopBodyTraits is a good example.
----------------
I suggest simplifying as well, maybe like:

```
// GraphTraits can be used to create a view over a graph interpreting it
// differently without requiring a copy of the original graph. This could
// be used for working with NodeRef's and loop bodies (see LoopBodyTraits
// for one example).
```


https://reviews.llvm.org/D50120





More information about the llvm-commits mailing list