Have Stream::PutCStringAsRawHex8 take llvm::StringRef

This enables the function to be called with a StringRef without jumping
through any hoops. I rename the function to "PutStringAsRawHex8" to
honor the extended interface. I also remove ".c_str()" from any calls to
this function I could find.

llvm-svn: 353841
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 857f428..c4b5c69 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -622,7 +622,7 @@
     } else {
       // The thread name contains special chars, send as hex bytes.
       response.PutCString("hexname:");
-      response.PutCStringAsRawHex8(thread_name.c_str());
+      response.PutStringAsRawHex8(thread_name);
     }
     response.PutChar(';');
   }
@@ -662,7 +662,7 @@
         response.PutCString("jstopinfo:");
         StreamString unescaped_response;
         threads_info_sp->Write(unescaped_response);
-        response.PutCStringAsRawHex8(unescaped_response.GetData());
+        response.PutStringAsRawHex8(unescaped_response.GetData());
         response.PutChar(';');
       } else
         LLDB_LOG(log, "failed to prepare a jstopinfo field for pid {0}",
@@ -763,7 +763,7 @@
   if (!description.empty()) {
     // Description may contains special chars, send as hex bytes.
     response.PutCString("description:");
-    response.PutCStringAsRawHex8(description.c_str());
+    response.PutStringAsRawHex8(description);
     response.PutChar(';');
   } else if ((tid_stop_info.reason == eStopReasonException) &&
              tid_stop_info.details.exception.type) {
@@ -1340,7 +1340,7 @@
   FileSpec working_dir{m_process_launch_info.GetWorkingDirectory()};
   if (working_dir) {
     StreamString response;
-    response.PutCStringAsRawHex8(working_dir.GetCString());
+    response.PutStringAsRawHex8(working_dir.GetCString());
     return SendPacketNoLock(response.GetString());
   }
 
@@ -2425,7 +2425,7 @@
     // Return the error message.
 
     response.PutCString("error:");
-    response.PutCStringAsRawHex8(error.AsCString());
+    response.PutStringAsRawHex8(error.AsCString());
     response.PutChar(';');
   } else {
     // Range start and size.
@@ -2453,7 +2453,7 @@
     ConstString name = region_info.GetName();
     if (name) {
       response.PutCString("name:");
-      response.PutCStringAsRawHex8(name.AsCString());
+      response.PutStringAsRawHex8(name.AsCString());
       response.PutChar(';');
     }
   }