diff options
author | David Malcolm <dmalcolm@redhat.com> | 2024-07-24 18:07:51 -0400 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-07-28 19:05:53 +0200 |
commit | 4dbb4af7aafdd67eb4d8247c83e92d2d1e9bbbd7 (patch) | |
tree | 72bad2c9ac737086577c1e6134bdaaa41c437d8e | |
parent | ea94dde1aa58bd337772f74787f821b34f866c4a (diff) | |
download | gcc-4dbb4af7aafdd67eb4d8247c83e92d2d1e9bbbd7.zip gcc-4dbb4af7aafdd67eb4d8247c83e92d2d1e9bbbd7.tar.gz gcc-4dbb4af7aafdd67eb4d8247c83e92d2d1e9bbbd7.tar.bz2 |
json: add dump overload for easier debugging
This has saved me a lot of typing in the debugger.
gcc/ChangeLog:
* json.cc (value::dump): New overload, taking no params.
* json.h (value::dump): New decl.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
-rw-r--r-- | gcc/json.cc | 10 | ||||
-rw-r--r-- | gcc/json.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/json.cc b/gcc/json.cc index b3106f3..53edca5 100644 --- a/gcc/json.cc +++ b/gcc/json.cc @@ -90,6 +90,16 @@ value::dump (FILE *outf, bool formatted) const pp_flush (&pp); } +/* A convenience function for debugging. + Dump to stderr with formatting, and a trailing newline. */ + +void +value::dump () const +{ + dump (stderr, true); + fprintf (stderr, "\n"); +} + /* class json::object, a subclass of json::value, representing an ordered collection of key/value pairs. */ @@ -83,6 +83,7 @@ class value virtual void print (pretty_printer *pp, bool formatted) const = 0; void dump (FILE *, bool formatted) const; + void DEBUG_FUNCTION dump () const; }; /* Subclass of value for objects: a collection of key/value pairs |