This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 19/22] gcc-rich-location.[ch]: add debug methods for cpp_string_location


gcc/ChangeLog:
	* gcc-rich-location.c (cpp_string_fragment_location::debug): New.
	(cpp_string_location::debug): New.
---
 gcc/gcc-rich-location.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gcc/gcc-rich-location.c b/gcc/gcc-rich-location.c
index 003e8f0..ae0b3bb 100644
--- a/gcc/gcc-rich-location.c
+++ b/gcc/gcc-rich-location.c
@@ -190,3 +190,29 @@ gcc_rich_location::expand_caption_va (diagnostic_context *context,
   pp_clear_output_area (pp);
   return result;
 }
+
+/* Debugging method.  Print a diagnostic showing the given fragment.  */
+
+void
+cpp_string_fragment_location::debug (const char *msg) const
+{
+  rich_location richloc (get_covered_range ());
+  inform_at_rich_loc (&richloc, "%s", msg);
+}
+
+/* Debugging method.  Print diagnostic showings the fragment(s) that make
+   up the cpp_string_location.  */
+
+void
+cpp_string_location::debug () const
+{
+  char buf[64];
+  for (unsigned int i = 0; i < m_num_fraglocs; i++)
+    {
+      cpp_string_fragment_location *fragment = &m_fragloc_array[i];
+      snprintf (buf, sizeof (buf),
+		"fragment %i; %i cols per char",
+		i, fragment->m_cols_per_char);
+      fragment->debug (buf);
+    }
+}
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]