graphviz.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Helper code for graphviz output.
  2. Copyright (C) 2019-2020 Free Software Foundation, Inc.
  3. Contributed by David Malcolm <dmalcolm@redhat.com>.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_GRAPHVIZ_H
  17. #define GCC_GRAPHVIZ_H
  18. #include "pretty-print.h" /* for ATTRIBUTE_GCC_PPDIAG. */
  19. /* A class for writing .dot output to a pretty_printer with
  20. indentation to show nesting. */
  21. class graphviz_out {
  22. public:
  23. graphviz_out (pretty_printer *pp);
  24. void print (const char *fmt, ...)
  25. ATTRIBUTE_GCC_PPDIAG(2,3);
  26. void println (const char *fmt, ...)
  27. ATTRIBUTE_GCC_PPDIAG(2,3);
  28. void indent () { m_indent++; }
  29. void outdent () { m_indent--; }
  30. void write_indent ();
  31. void begin_tr ();
  32. void end_tr ();
  33. void begin_td ();
  34. void end_td ();
  35. void begin_trtd ();
  36. void end_tdtr ();
  37. pretty_printer *get_pp () const { return m_pp; }
  38. private:
  39. pretty_printer *m_pp;
  40. int m_indent;
  41. };
  42. #endif /* GCC_GRAPHVIZ_H */