gdb: Move definitions of std::string overloads in ui_out to the header
authorMarco Barisione <mbarisione@undo.io>
Wed, 19 May 2021 15:48:05 +0000 (16:48 +0100)
committerMarco Barisione <mbarisione@undo.io>
Wed, 19 May 2021 15:48:05 +0000 (16:48 +0100)
These methods are just trivial wrappers around the versions accepting
a char pointer.  By moving them to the header the compiler can inline
them.

gdb/ChangeLog:

* ui-out.c (ui_out::field_string): Move to ui-out.h.
(ui_out::text): Ditto.
* ui-out.h (class ui_out): Add definitions of
ui_out::field_string and ui_out::text which were previously
defined in ui-out.c.

gdb/ui-out.c
gdb/ui-out.h

index c091af6cad3815e2b556c52e32f1d65c5dcad489..982d157a932814c41789417f062533a6a28c7870 100644 (file)
@@ -527,13 +527,6 @@ ui_out::field_string (const char *fldname, const char *string,
   do_field_string (fldno, width, align, fldname, string, style);
 }
 
-void
-ui_out::field_string (const char *fldname, const std::string &string,
-                     const ui_file_style &style)
-{
-  field_string (fldname, string.c_str (), style);
-}
-
 /* VARARGS */
 void
 ui_out::field_fmt (const char *fldname, const char *format, ...)
@@ -582,12 +575,6 @@ ui_out::text (const char *string)
   do_text (string);
 }
 
-void
-ui_out::text (const std::string &string)
-{
-  text (string.c_str ());
-}
-
 void
 ui_out::call_do_message (const ui_file_style &style, const char *format,
                         ...)
index 46dfe28c1e146e81aed92ba43853175a4409b18f..ecf62e8b6012d9eb1f97531eaa69b26751a18706 100644 (file)
@@ -192,7 +192,10 @@ class ui_out
   void field_string (const char *fldname, const char *string,
                     const ui_file_style &style = ui_file_style ());
   void field_string (const char *fldname, const std::string &string,
-                    const ui_file_style &style = ui_file_style ());
+                    const ui_file_style &style = ui_file_style ())
+  {
+    field_string (fldname, string.c_str (), style);
+  }
   void field_stream (const char *fldname, string_file &stream,
                     const ui_file_style &style = ui_file_style ());
   void field_skip (const char *fldname);
@@ -204,7 +207,7 @@ class ui_out
 
   void spaces (int numspaces);
   void text (const char *string);
-  void text (const std::string &string);
+  void text (const std::string &string) { text (string.c_str ()); }
 
   /* Output a printf-style formatted string.  In addition to the usual
      printf format specs, this supports a few GDB-specific
This page took 0.029091 seconds and 4 git commands to generate.