[PATCH] D23580: [GraphWriter] Change GraphWriter to use NodeRef in GraphTraits

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 11:00:33 PDT 2016


On Tue, Aug 16, 2016 at 8:42 PM Tim Shen <timshen at google.com> wrote:

> timshen added a comment.
>
> In https://reviews.llvm.org/D23580#517447, @dblaikie wrote:
>
> > what's the printer used for? Would it be best to generalize it (perhaps
> adding another extension point to the graph traits, so NodeRefs can be
> printed out - with a default implementation for pointers)?
>
>
> One usage is to print dot files.
>
> I think it's more like that GraphWriter that requires the input nodes to
> be both fulfilling GraphTraits, and printable, not that GraphTraits has an
> optional printable requirement - these are two totally orthogonal traits.
>

Fair - though I'm not sure if it's too important whether that's expressed
through graph traits or not. I guess maybe it's easier if it's separate.

But, for example, for the heavy references you wanted to implement (that
motivated all this refactoring) which, if I understand, are something like
{node number, graph reference} - printing that out would be as simple as
printing the node number. (or, if you wanted to be able to print multiple
graphs and know they are distinct, it could print both elements of the
heavy reference)

Is there just the one graph algorithm that requires print support? If it's
just one, I can understand not bothering to introduce another trait, etc
(especially if only raw pointers are used with the one printing graph
algorithm)


>
>
> https://reviews.llvm.org/D23580
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160817/f740c647/attachment.html>


More information about the llvm-commits mailing list