aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-07-24 18:07:51 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-07-24 18:07:51 -0400
commit6baa26c3d6ceec1aba5f143dbfef00e24aa795bb (patch)
tree65b7dce6956ed75869c5b82c61665f41a7b08991 /gcc
parent8c71830b51e6fd10087ce3f6791de80eb1f10b96 (diff)
downloadgcc-6baa26c3d6ceec1aba5f143dbfef00e24aa795bb.zip
gcc-6baa26c3d6ceec1aba5f143dbfef00e24aa795bb.tar.gz
gcc-6baa26c3d6ceec1aba5f143dbfef00e24aa795bb.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>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/json.cc10
-rw-r--r--gcc/json.h1
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. */
diff --git a/gcc/json.h b/gcc/json.h
index 97c6811..ad4f8c44 100644
--- a/gcc/json.h
+++ b/gcc/json.h
@@ -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