[Lldb-commits] [lldb] r287152 - Don't allow direct access to StreamString's internal buffer.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 16 13:15:26 PST 2016


Author: zturner
Date: Wed Nov 16 15:15:24 2016
New Revision: 287152

URL: http://llvm.org/viewvc/llvm-project?rev=287152&view=rev
Log:
Don't allow direct access to StreamString's internal buffer.

This is a large API change that removes the two functions from
StreamString that return a std::string& and a const std::string&,
and instead provide one function which returns a StringRef.

Direct access to the underlying buffer violates the concept of
a "stream" which is intended to provide forward only access,
and makes porting to llvm::raw_ostream more difficult in the
future.

Differential Revision: https://reviews.llvm.org/D26698

Modified:
    lldb/trunk/include/lldb/Core/Error.h
    lldb/trunk/include/lldb/Core/Log.h
    lldb/trunk/include/lldb/Core/StreamGDBRemote.h
    lldb/trunk/include/lldb/Core/StreamString.h
    lldb/trunk/include/lldb/DataFormatters/FormatClasses.h
    lldb/trunk/include/lldb/Host/Host.h
    lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
    lldb/trunk/source/API/SBCommandReturnObject.cpp
    lldb/trunk/source/API/SBFrame.cpp
    lldb/trunk/source/API/SBStream.cpp
    lldb/trunk/source/API/SBTarget.cpp
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/CommandObjectHelp.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectMultiword.cpp
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Commands/CommandObjectQuit.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Commands/CommandObjectType.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/DataExtractor.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Core/EmulateInstruction.cpp
    lldb/trunk/source/Core/Error.cpp
    lldb/trunk/source/Core/Event.cpp
    lldb/trunk/source/Core/FormatEntity.cpp
    lldb/trunk/source/Core/IOHandler.cpp
    lldb/trunk/source/Core/Log.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Core/RegisterValue.cpp
    lldb/trunk/source/Core/StreamString.cpp
    lldb/trunk/source/Core/StringList.cpp
    lldb/trunk/source/Core/StructuredData.cpp
    lldb/trunk/source/Core/ValueObject.cpp
    lldb/trunk/source/DataFormatters/FormatManager.cpp
    lldb/trunk/source/DataFormatters/TypeCategory.cpp
    lldb/trunk/source/DataFormatters/TypeFormat.cpp
    lldb/trunk/source/DataFormatters/TypeSummary.cpp
    lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
    lldb/trunk/source/DataFormatters/VectorType.cpp
    lldb/trunk/source/Expression/IRExecutionUnit.cpp
    lldb/trunk/source/Expression/LLVMUserExpression.cpp
    lldb/trunk/source/Expression/Materializer.cpp
    lldb/trunk/source/Host/macosx/Host.mm
    lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
    lldb/trunk/source/Host/windows/Host.cpp
    lldb/trunk/source/Interpreter/Args.cpp
    lldb/trunk/source/Interpreter/CommandAlias.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Interpreter/CommandObject.cpp
    lldb/trunk/source/Interpreter/CommandReturnObject.cpp
    lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
    lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
    lldb/trunk/source/Interpreter/Options.cpp
    lldb/trunk/source/Interpreter/Property.cpp
    lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
    lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
    lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
    lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
    lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
    lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
    lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp
    lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.cpp
    lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
    lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
    lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
    lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
    lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
    lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
    lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
    lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
    lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
    lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
    lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
    lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
    lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
    lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
    lldb/trunk/source/Symbol/ObjectFile.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/StackFrame.cpp
    lldb/trunk/source/Target/StopInfo.cpp
    lldb/trunk/source/Target/Target.cpp
    lldb/trunk/source/Target/TargetList.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
    lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
    lldb/trunk/tools/argdumper/argdumper.cpp
    lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp

Modified: lldb/trunk/include/lldb/Core/Error.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Error.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Error.h (original)
+++ lldb/trunk/include/lldb/Core/Error.h Wed Nov 16 15:15:24 2016
@@ -245,7 +245,7 @@ public:
   /// @param err_str
   ///     The new custom error string to copy and cache.
   //------------------------------------------------------------------
-  void SetErrorString(const char *err_str);
+  void SetErrorString(llvm::StringRef err_str);
 
   //------------------------------------------------------------------
   /// Set the current error string to a formatted error string.

Modified: lldb/trunk/include/lldb/Core/Log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Log.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Log.h (original)
+++ lldb/trunk/include/lldb/Core/Log.h Wed Nov 16 15:15:24 2016
@@ -105,6 +105,7 @@ public:
   virtual ~Log();
 
   virtual void PutCString(const char *cstr);
+  virtual void PutString(llvm::StringRef str);
 
   // CLEANUP: Add llvm::raw_ostream &Stream() function.
   virtual void Printf(const char *format, ...)

Modified: lldb/trunk/include/lldb/Core/StreamGDBRemote.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StreamGDBRemote.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/StreamGDBRemote.h (original)
+++ lldb/trunk/include/lldb/Core/StreamGDBRemote.h Wed Nov 16 15:15:24 2016
@@ -42,6 +42,7 @@ public:
   /// @return
   ///     Number of bytes written.
   //------------------------------------------------------------------
+  // TODO: Convert this function to take ArrayRef<uint8_t>
   int PutEscapedBytes(const void *s, size_t src_len);
 };
 

Modified: lldb/trunk/include/lldb/Core/StreamString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/StreamString.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/StreamString.h (original)
+++ lldb/trunk/include/lldb/Core/StreamString.h Wed Nov 16 15:15:24 2016
@@ -32,15 +32,13 @@ public:
 
   bool Empty() const;
 
-  const char *GetData() const;
-
   size_t GetSize() const;
 
   size_t GetSizeOfLastLine() const;
 
-  std::string &GetString();
+  llvm::StringRef GetString() const;
 
-  const std::string &GetString() const;
+  const char *GetData() const { return m_packet.c_str(); }
 
   void FillLastLineToColumn(uint32_t column, char fill_char);
 

Modified: lldb/trunk/include/lldb/DataFormatters/FormatClasses.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/FormatClasses.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/FormatClasses.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/FormatClasses.h Wed Nov 16 15:15:24 2016
@@ -117,17 +117,16 @@ class TypeNameSpecifierImpl {
 public:
   TypeNameSpecifierImpl() : m_is_regex(false), m_type() {}
 
-  TypeNameSpecifierImpl(const char *name, bool is_regex)
+  TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex)
       : m_is_regex(is_regex), m_type() {
-    if (name)
-      m_type.m_type_name.assign(name);
+    m_type.m_type_name = name;
   }
 
   // if constructing with a given type, is_regex cannot be true since we are
   // giving an exact type to match
   TypeNameSpecifierImpl(lldb::TypeSP type) : m_is_regex(false), m_type() {
     if (type) {
-      m_type.m_type_name.assign(type->GetName().GetCString());
+      m_type.m_type_name = type->GetName().GetStringRef();
       m_type.m_type_pair.SetType(type);
     }
   }

Modified: lldb/trunk/include/lldb/Host/Host.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/Host.h (original)
+++ lldb/trunk/include/lldb/Host/Host.h Wed Nov 16 15:15:24 2016
@@ -240,6 +240,7 @@ public:
   //------------------------------------------------------------------
   static Error ShellExpandArguments(ProcessLaunchInfo &launch_info);
 
+  // TODO: Convert this function to take a StringRef.
   static Error RunShellCommand(
       const char *command,         // Shouldn't be NULL
       const FileSpec &working_dir, // Pass empty FileSpec to use the current

Modified: lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandReturnObject.h Wed Nov 16 15:15:24 2016
@@ -20,6 +20,10 @@
 #include "lldb/Core/StreamTee.h"
 #include "lldb/lldb-private.h"
 
+#include "llvm/ADT/StringRef.h"
+
+#include <memory>
+
 namespace lldb_private {
 
 class CommandReturnObject {
@@ -28,19 +32,18 @@ public:
 
   ~CommandReturnObject();
 
-  const char *GetOutputData() {
+  llvm::StringRef GetOutputData() {
     lldb::StreamSP stream_sp(m_out_stream.GetStreamAtIndex(eStreamStringIndex));
     if (stream_sp)
-      return static_cast<StreamString *>(stream_sp.get())->GetData();
-    return "";
+      return static_pointer_cast<StreamString>(stream_sp)->GetString();
+    return llvm::StringRef();
   }
 
-  const char *GetErrorData() {
+  llvm::StringRef GetErrorData() {
     lldb::StreamSP stream_sp(m_err_stream.GetStreamAtIndex(eStreamStringIndex));
     if (stream_sp)
-      return static_cast<StreamString *>(stream_sp.get())->GetData();
-    else
-      return "";
+      return static_pointer_cast<StreamString>(stream_sp)->GetString();
+    return llvm::StringRef();
   }
 
   Stream &GetOutputStream() {

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Wed Nov 16 15:15:24 2016
@@ -1918,6 +1918,7 @@ public:
   /// @return
   ///     The number of bytes that were actually written.
   //------------------------------------------------------------------
+  // TODO: change this to take an ArrayRef<uint8_t>
   size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
                      Error &error);
 

Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Wed Nov 16 15:15:24 2016
@@ -2195,6 +2195,8 @@ class TestBase(Base):
             with recording(self, trace) as sbuf:
                 print("looking at:", output, file=sbuf)
 
+        if output is None:
+            output = ""
         # The heading says either "Expecting" or "Not expecting".
         heading = "Expecting" if matching else "Not expecting"
 

Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Wed Nov 16 15:15:24 2016
@@ -59,12 +59,14 @@ const char *SBCommandReturnObject::GetOu
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
 
   if (m_opaque_ap) {
+    llvm::StringRef output = m_opaque_ap->GetOutputData();
+    ConstString result(output.empty() ? llvm::StringRef("") : output);
+
     if (log)
       log->Printf("SBCommandReturnObject(%p)::GetOutput () => \"%s\"",
-                  static_cast<void *>(m_opaque_ap.get()),
-                  m_opaque_ap->GetOutputData());
+                  static_cast<void *>(m_opaque_ap.get()), result.AsCString());
 
-    return m_opaque_ap->GetOutputData();
+    return result.AsCString();
   }
 
   if (log)
@@ -78,12 +80,13 @@ const char *SBCommandReturnObject::GetEr
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
 
   if (m_opaque_ap) {
+    llvm::StringRef output = m_opaque_ap->GetErrorData();
+    ConstString result(output.empty() ? llvm::StringRef("") : output);
     if (log)
       log->Printf("SBCommandReturnObject(%p)::GetError () => \"%s\"",
-                  static_cast<void *>(m_opaque_ap.get()),
-                  m_opaque_ap->GetErrorData());
+                  static_cast<void *>(m_opaque_ap.get()), result.AsCString());
 
-    return m_opaque_ap->GetErrorData();
+    return result.AsCString();
   }
 
   if (log)
@@ -94,11 +97,11 @@ const char *SBCommandReturnObject::GetEr
 }
 
 size_t SBCommandReturnObject::GetOutputSize() {
-  return (m_opaque_ap ? strlen(m_opaque_ap->GetOutputData()) : 0);
+  return (m_opaque_ap ? m_opaque_ap->GetOutputData().size() : 0);
 }
 
 size_t SBCommandReturnObject::GetErrorSize() {
-  return (m_opaque_ap ? strlen(m_opaque_ap->GetErrorData()) : 0);
+  return (m_opaque_ap ? m_opaque_ap->GetErrorData().size() : 0);
 }
 
 size_t SBCommandReturnObject::PutOutput(FILE *fh) {

Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Wed Nov 16 15:15:24 2016
@@ -1295,7 +1295,7 @@ lldb::SBValue SBFrame::EvaluateExpressio
               "SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value "
               "= %u) %s",
               expr, options.GetFetchDynamicValue(),
-              frame_description.GetString().c_str());
+              frame_description.GetData());
         }
 
         exe_results = target->EvaluateExpression(expr, frame, expr_value_sp,

Modified: lldb/trunk/source/API/SBStream.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBStream.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/API/SBStream.cpp (original)
+++ lldb/trunk/source/API/SBStream.cpp Wed Nov 16 15:15:24 2016
@@ -63,8 +63,7 @@ void SBStream::RedirectToFile(const char
     // See if we have any locally backed data. If so, copy it so we can then
     // redirect it to the file so we don't lose the data
     if (!m_is_file)
-      local_data.swap(
-          static_cast<StreamString *>(m_opaque_ap.get())->GetString());
+      local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
   }
   StreamFile *stream_file = new StreamFile;
   uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
@@ -97,8 +96,7 @@ void SBStream::RedirectToFileHandle(FILE
     // See if we have any locally backed data. If so, copy it so we can then
     // redirect it to the file so we don't lose the data
     if (!m_is_file)
-      local_data.swap(
-          static_cast<StreamString *>(m_opaque_ap.get())->GetString());
+      local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
   }
   m_opaque_ap.reset(new StreamFile(fh, transfer_fh_ownership));
 
@@ -119,8 +117,7 @@ void SBStream::RedirectToFileDescriptor(
     // See if we have any locally backed data. If so, copy it so we can then
     // redirect it to the file so we don't lose the data
     if (!m_is_file)
-      local_data.swap(
-          static_cast<StreamString *>(m_opaque_ap.get())->GetString());
+      local_data = static_cast<StreamString *>(m_opaque_ap.get())->GetString();
   }
 
   m_opaque_ap.reset(new StreamFile(::fdopen(fd, "w"), transfer_fh_ownership));
@@ -152,6 +149,6 @@ void SBStream::Clear() {
     if (m_is_file)
       m_opaque_ap.reset();
     else
-      static_cast<StreamString *>(m_opaque_ap.get())->GetString().clear();
+      static_cast<StreamString *>(m_opaque_ap.get())->Clear();
   }
 }

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Wed Nov 16 15:15:24 2016
@@ -2133,7 +2133,7 @@ lldb::SBValue SBTarget::EvaluateExpressi
           "SBTarget::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = "
           "%u) %s",
           expr, options.GetFetchDynamicValue(),
-          frame_description.GetString().c_str());
+          frame_description.GetString().str().c_str());
 #endif
       exe_results =
           target->EvaluateExpression(expr, frame, expr_value_sp, options.ref());

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Wed Nov 16 15:15:24 2016
@@ -1558,7 +1558,7 @@ protected:
     if (num_cleared > 0) {
       Stream &output_stream = result.GetOutputStream();
       output_stream.Printf("%d breakpoints cleared:\n", num_cleared);
-      output_stream << ss.GetData();
+      output_stream << ss.GetString();
       output_stream.EOL();
       result.SetStatus(eReturnStatusSuccessFinishNoResult);
     } else {
@@ -1997,7 +1997,7 @@ protected:
           StreamString s;
           bp_sp->GetDescription(&s, eDescriptionLevelBrief);
           s.EOL();
-          result.AppendMessage(s.GetData());
+          result.AppendMessage(s.GetString());
         }
       }
 

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Wed Nov 16 15:15:24 2016
@@ -948,7 +948,7 @@ protected:
       CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(
           &error_msg_stream, command_name, nullptr, nullptr, generate_apropos,
           generate_type_lookup);
-      result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+      result.AppendError(error_msg_stream.GetString());
       result.SetStatus(eReturnStatusFailed);
     }
 
@@ -1286,7 +1286,7 @@ public:
     else {
       StreamString stream;
       stream.Printf("For more information run 'help %s'", name.c_str());
-      SetHelp(stream.GetData());
+      SetHelp(stream.GetString());
     }
   }
 
@@ -1332,8 +1332,7 @@ protected:
     } else {
       // Don't change the status if the command already set it...
       if (result.GetStatus() == eReturnStatusInvalid) {
-        if (result.GetOutputData() == nullptr ||
-            result.GetOutputData()[0] == '\0')
+        if (result.GetOutputData().empty())
           result.SetStatus(eReturnStatusSuccessFinishNoResult);
         else
           result.SetStatus(eReturnStatusSuccessFinishResult);
@@ -1360,7 +1359,7 @@ public:
         m_fetched_help_long(false) {
     StreamString stream;
     stream.Printf("For more information run 'help %s'", name.c_str());
-    SetHelp(stream.GetData());
+    SetHelp(stream.GetString());
     if (ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter())
       GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
   }
@@ -1421,8 +1420,7 @@ protected:
     } else {
       // Don't change the status if the command already set it...
       if (result.GetStatus() == eReturnStatusInvalid) {
-        if (result.GetOutputData() == nullptr ||
-            result.GetOutputData()[0] == '\0')
+        if (result.GetOutputData().empty())
           result.SetStatus(eReturnStatusSuccessFinishNoResult);
         else
           result.SetStatus(eReturnStatusSuccessFinishResult);

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Wed Nov 16 15:15:24 2016
@@ -148,7 +148,7 @@ bool CommandObjectHelp::DoExecute(Args &
             s.Printf("\n\t%s", matches.GetStringAtIndex(match_idx));
           }
           s.Printf("\n");
-          result.AppendError(s.GetData());
+          result.AppendError(s.GetString());
           result.SetStatus(eReturnStatusFailed);
           return false;
         } else if (!sub_cmd_obj) {
@@ -156,7 +156,7 @@ bool CommandObjectHelp::DoExecute(Args &
           GenerateAdditionalHelpAvenuesMessage(
               &error_msg_stream, cmd_string.c_str(),
               m_interpreter.GetCommandPrefix(), sub_command.c_str());
-          result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+          result.AppendError(error_msg_stream.GetString());
           result.SetStatus(eReturnStatusFailed);
           return false;
         } else {
@@ -199,7 +199,7 @@ bool CommandObjectHelp::DoExecute(Args &
         GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
                                              command.GetArgumentAtIndex(0),
                                              m_interpreter.GetCommandPrefix());
-        result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+        result.AppendError(error_msg_stream.GetString());
         result.SetStatus(eReturnStatusFailed);
       }
     }

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Nov 16 15:15:24 2016
@@ -823,7 +823,7 @@ protected:
         } else {
           result.AppendErrorWithFormat(
               "failed to create a value object for: (%s) %s\n",
-              view_as_type_cstr, name_strm.GetString().c_str());
+              view_as_type_cstr, name_strm.GetData());
           result.SetStatus(eReturnStatusFailed);
           return false;
         }
@@ -1577,7 +1577,7 @@ protected:
 
     if (!buffer.GetString().empty()) {
       Error error;
-      if (process->WriteMemory(addr, buffer.GetString().c_str(),
+      if (process->WriteMemory(addr, buffer.GetString().data(),
                                buffer.GetString().size(),
                                error) == buffer.GetString().size())
         return true;

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Wed Nov 16 15:15:24 2016
@@ -260,7 +260,7 @@ void CommandObjectMultiword::AproposAllS
     complete_command_name << prefix << " " << command_name;
 
     if (sub_cmd_obj->HelpTextContainsWord(search_word)) {
-      commands_found.AppendString(complete_command_name.GetData());
+      commands_found.AppendString(complete_command_name.GetString());
       commands_help.AppendString(sub_cmd_obj->GetHelp());
     }
 

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Wed Nov 16 15:15:24 2016
@@ -242,9 +242,9 @@ protected:
         // a chance to call PushProcessIOHandler().
         process_sp->SyncIOHandler(0, 2000);
 
-        const char *data = stream.GetData();
-        if (data && strlen(data) > 0)
-          result.AppendMessage(stream.GetData());
+        llvm::StringRef data = stream.GetString();
+        if (!data.empty())
+          result.AppendMessage(data);
         const char *archname =
             exe_module_sp->GetArchitecture().GetArchitectureName();
         result.AppendMessageWithFormat(
@@ -504,8 +504,7 @@ protected:
     if (error.Success()) {
       ProcessSP process_sp(target->GetProcessSP());
       if (process_sp) {
-        if (stream.GetData())
-          result.AppendMessage(stream.GetData());
+        result.AppendMessage(stream.GetString());
         result.SetStatus(eReturnStatusSuccessFinishNoResult);
         result.SetDidChangeProcessState(true);
         result.SetAbnormalStopWasExpected(true);
@@ -706,8 +705,7 @@ protected:
         if (synchronous_execution) {
           // If any state changed events had anything to say, add that to the
           // result
-          if (stream.GetData())
-            result.AppendMessage(stream.GetData());
+          result.AppendMessage(stream.GetString());
 
           result.SetDidChangeProcessState(true);
           result.SetStatus(eReturnStatusSuccessFinishNoResult);

Modified: lldb/trunk/source/Commands/CommandObjectQuit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectQuit.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectQuit.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectQuit.cpp Wed Nov 16 15:15:24 2016
@@ -73,7 +73,7 @@ bool CommandObjectQuit::DoExecute(Args &
     message.Printf("Quitting LLDB will %s one or more processes. Do you really "
                    "want to proceed",
                    (is_a_detach ? "detach from" : "kill"));
-    if (!m_interpreter.Confirm(message.GetData(), true)) {
+    if (!m_interpreter.Confirm(message.GetString(), true)) {
       result.SetStatus(eReturnStatusFailed);
       return false;
     }

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Nov 16 15:15:24 2016
@@ -2463,20 +2463,20 @@ protected:
                   result.AppendErrorWithFormat(
                       "Unable to create the executable or symbol file with "
                       "UUID %s with path %s and symbol file %s",
-                      strm.GetString().c_str(),
+                      strm.GetData(),
                       module_spec.GetFileSpec().GetPath().c_str(),
                       module_spec.GetSymbolFileSpec().GetPath().c_str());
                 } else {
                   result.AppendErrorWithFormat(
                       "Unable to create the executable or symbol file with "
                       "UUID %s with path %s",
-                      strm.GetString().c_str(),
+                      strm.GetData(),
                       module_spec.GetFileSpec().GetPath().c_str());
                 }
               } else {
                 result.AppendErrorWithFormat("Unable to create the executable "
                                              "or symbol file with UUID %s",
-                                             strm.GetString().c_str());
+                                             strm.GetData());
               }
               result.SetStatus(eReturnStatusFailed);
               return false;
@@ -2486,7 +2486,7 @@ protected:
             module_spec.GetUUID().Dump(&strm);
             result.AppendErrorWithFormat(
                 "Unable to locate the executable or symbol file with UUID %s",
-                strm.GetString().c_str());
+                strm.GetData());
             result.SetStatus(eReturnStatusFailed);
             return false;
           }
@@ -4224,7 +4224,7 @@ protected:
             error_strm.PutCString(
                 "unable to find debug symbols for the current frame");
           }
-          result.AppendError(error_strm.GetData());
+          result.AppendError(error_strm.GetString());
         }
       } else {
         result.AppendError("one or more symbol file paths must be specified, "

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Wed Nov 16 15:15:24 2016
@@ -675,8 +675,8 @@ protected:
       if (synchronous_execution) {
         // If any state changed events had anything to say, add that to the
         // result
-        if (stream.GetData())
-          result.AppendMessage(stream.GetData());
+        if (stream.GetSize() > 0)
+          result.AppendMessage(stream.GetString());
 
         process->GetThreadList().SetSelectedThreadByID(thread->GetID());
         result.SetDidChangeProcessState(true);
@@ -853,8 +853,8 @@ public:
         if (synchronous_execution) {
           // If any state changed events had anything to say, add that to the
           // result
-          if (stream.GetData())
-            result.AppendMessage(stream.GetData());
+          if (stream.GetSize() > 0)
+            result.AppendMessage(stream.GetString());
 
           result.SetDidChangeProcessState(true);
           result.SetStatus(eReturnStatusSuccessFinishNoResult);
@@ -1183,8 +1183,8 @@ protected:
         if (synchronous_execution) {
           // If any state changed events had anything to say, add that to the
           // result
-          if (stream.GetData())
-            result.AppendMessage(stream.GetData());
+          if (stream.GetSize() > 0)
+            result.AppendMessage(stream.GetString());
 
           result.SetDidChangeProcessState(true);
           result.SetStatus(eReturnStatusSuccessFinishNoResult);

Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Wed Nov 16 15:15:24 2016
@@ -3010,15 +3010,15 @@ public:
         m_discovery_function(discovery_func) {
     StreamString name;
     name.Printf("type %s info", formatter_name);
-    SetCommandName(name.GetData());
+    SetCommandName(name.GetString());
     StreamString help;
     help.Printf("This command evaluates the provided expression and shows "
                 "which %s is applied to the resulting value (if any).",
                 formatter_name);
-    SetHelp(help.GetData());
+    SetHelp(help.GetString());
     StreamString syntax;
     syntax.Printf("type %s info <expr>", formatter_name);
-    SetSyntax(syntax.GetData());
+    SetSyntax(syntax.GetString());
   }
 
   ~CommandObjectFormatterInfo() override = default;

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Wed Nov 16 15:15:24 2016
@@ -716,7 +716,7 @@ bool Address::Dump(Stream *s, ExecutionC
                                        DumpStyleResolvedDescription,
                                        DumpStyleInvalid, addr_size)) {
               s->Address(dereferenced_load_addr, addr_size, " -> ", " ");
-              s->Write(strm.GetData(), strm.GetSize());
+              s->Write(strm.GetString().data(), strm.GetSize());
               return true;
             }
           }

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Wed Nov 16 15:15:24 2016
@@ -1981,7 +1981,7 @@ lldb::offset_t DataExtractor::PutToLog(L
     if ((count % num_per_line) == 0) {
       // Print out any previous string
       if (sstr.GetSize() > 0) {
-        log->Printf("%s", sstr.GetData());
+        log->PutString(sstr.GetString());
         sstr.Clear();
       }
       // Reset string offset and fill the current line string with address:
@@ -2019,8 +2019,8 @@ lldb::offset_t DataExtractor::PutToLog(L
     }
   }
 
-  if (sstr.GetSize() > 0)
-    log->Printf("%s", sstr.GetData());
+  if (!sstr.Empty())
+    log->PutString(sstr.GetString());
 
   return offset; // Return the offset at which we ended up
 }

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Wed Nov 16 15:15:24 2016
@@ -320,7 +320,7 @@ Error Debugger::SetPropertyValue(const E
               stream_sp->Printf("%s\n", error.AsCString());
             }
             if (feedback_stream.GetSize())
-              stream_sp->Printf("%s", feedback_stream.GetData());
+              stream_sp->PutCString(feedback_stream.GetString());
           }
         }
       }

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Wed Nov 16 15:15:24 2016
@@ -735,7 +735,7 @@ void Instruction::Dump(lldb_private::Str
     ss.PutCString(" ; ");
     ss.PutCString(m_comment);
   }
-  s->Write(ss.GetData(), ss.GetSize());
+  s->PutCString(ss.GetString());
 }
 
 bool Instruction::DumpEmulation(const ArchSpec &arch) {

Modified: lldb/trunk/source/Core/EmulateInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/EmulateInstruction.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/EmulateInstruction.cpp (original)
+++ lldb/trunk/source/Core/EmulateInstruction.cpp Wed Nov 16 15:15:24 2016
@@ -194,8 +194,8 @@ bool EmulateInstruction::WriteMemoryUnsi
   StreamString strm(Stream::eBinary, GetAddressByteSize(), GetByteOrder());
   strm.PutMaxHex64(uval, uval_byte_size);
 
-  size_t bytes_written = m_write_mem_callback(this, m_baton, context, addr,
-                                              strm.GetData(), uval_byte_size);
+  size_t bytes_written = m_write_mem_callback(
+      this, m_baton, context, addr, strm.GetString().data(), uval_byte_size);
   return (bytes_written == uval_byte_size);
 }
 

Modified: lldb/trunk/source/Core/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Error.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Error.cpp (original)
+++ lldb/trunk/source/Core/Error.cpp Wed Nov 16 15:15:24 2016
@@ -264,15 +264,14 @@ void Error::SetErrorToGenericError() {
 // The error string value will remain until the error value is
 // cleared or a new error value/type is assigned.
 //----------------------------------------------------------------------
-void Error::SetErrorString(const char *err_str) {
-  if (err_str != nullptr && err_str[0]) {
-    // If we have an error string, we should always at least have
-    // an error set to a generic value.
+void Error::SetErrorString(llvm::StringRef err_str) {
+  if (!err_str.empty()) {
+    // If we have an error string, we should always at least have an error
+    // set to a generic value.
     if (Success())
       SetErrorToGenericError();
-    m_string = err_str;
-  } else
-    m_string.clear();
+  }
+  m_string = err_str;
 }
 
 //------------------------------------------------------------------

Modified: lldb/trunk/source/Core/Event.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Event.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Event.cpp (original)
+++ lldb/trunk/source/Core/Event.cpp Wed Nov 16 15:15:24 2016
@@ -64,7 +64,7 @@ void Event::Dump(Stream *s) const {
                 static_cast<const void *>(this),
                 static_cast<void *>(broadcaster),
                 broadcaster->GetBroadcasterName().GetCString(), m_type,
-                event_name.GetString().c_str());
+                event_name.GetData());
     else
       s->Printf("%p Event: broadcaster = %p (%s), type = 0x%8.8x, data = ",
                 static_cast<const void *>(this),

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Wed Nov 16 15:15:24 2016
@@ -829,7 +829,7 @@ static bool DumpValue(Stream &s, const S
     bitfield_name.Printf("%s:%d", target->GetTypeName().AsCString(),
                          target->GetBitfieldBitSize());
     lldb::TypeNameSpecifierImplSP type_sp(
-        new TypeNameSpecifierImpl(bitfield_name.GetData(), false));
+        new TypeNameSpecifierImpl(bitfield_name.GetString(), false));
     if (val_obj_display ==
             ValueObject::eValueObjectRepresentationStyleSummary &&
         !DataVisualization::GetSummaryForType(type_sp))
@@ -866,7 +866,7 @@ static bool DumpValue(Stream &s, const S
 
       // should not happen
       if (success)
-        s << str_temp.GetData();
+        s << str_temp.GetString();
       return true;
     } else {
       if (was_plain_var) // if ${var}
@@ -1507,7 +1507,7 @@ bool FormatEntity::Format(const Entry &e
           sc, exe_ctx, Language::FunctionNameRepresentation::eName, ss);
     }
     if (language_plugin_handled) {
-      s.PutCString(ss.GetData());
+      s << ss.GetString();
       return true;
     } else {
       const char *name = nullptr;
@@ -1549,7 +1549,7 @@ bool FormatEntity::Format(const Entry &e
           ss);
     }
     if (language_plugin_handled) {
-      s.PutCString(ss.GetData());
+      s << ss.GetString();
       return true;
     } else {
       ConstString name;
@@ -1578,7 +1578,7 @@ bool FormatEntity::Format(const Entry &e
           sc, exe_ctx, Language::FunctionNameRepresentation::eNameWithArgs, ss);
     }
     if (language_plugin_handled) {
-      s.PutCString(ss.GetData());
+      s << ss.GetString();
       return true;
     } else {
       // Print the function name with arguments in it
@@ -1662,7 +1662,7 @@ bool FormatEntity::Format(const Entry &e
               ValueObjectSP var_value_sp(
                   ValueObjectVariable::Create(exe_scope, var_sp));
               StreamString ss;
-              const char *var_representation = nullptr;
+              llvm::StringRef var_representation;
               const char *var_name = var_value_sp->GetName().GetCString();
               if (var_value_sp->GetCompilerType().IsValid()) {
                 if (var_value_sp && exe_scope->CalculateTarget())
@@ -1681,7 +1681,7 @@ bool FormatEntity::Format(const Entry &e
                       "");
                   format.FormatObject(var_value_sp.get(), buffer,
                                       TypeSummaryOptions());
-                  var_representation = buffer.c_str();
+                  var_representation = buffer;
                 } else
                   var_value_sp->DumpPrintableRepresentation(
                       ss, ValueObject::ValueObjectRepresentationStyle::
@@ -1691,13 +1691,13 @@ bool FormatEntity::Format(const Entry &e
                       false);
               }
 
-              if (ss.GetData() && ss.GetSize())
-                var_representation = ss.GetData();
+              if (!ss.GetString().empty())
+                var_representation = ss.GetString();
               if (arg_idx > 0)
                 s.PutCString(", ");
               if (var_value_sp->GetError().Success()) {
-                if (var_representation)
-                  s.Printf("%s=%s", var_name, var_representation);
+                if (!var_representation.empty())
+                  s.Printf("%s=%s", var_name, var_representation.str().c_str());
                 else
                   s.Printf("%s=%s at %s", var_name,
                            var_value_sp->GetTypeName().GetCString(),
@@ -1888,8 +1888,7 @@ static Error ParseEntry(const llvm::Stri
                               "access one of its children: ",
                               entry_def->name);
             DumpCommaSeparatedChildEntryNames(error_strm, entry_def);
-            error.SetErrorStringWithFormat("%s",
-                                           error_strm.GetString().c_str());
+            error.SetErrorStringWithFormat("%s", error_strm.GetData());
           } else if (sep_char == ':') {
             // Any value whose separator is a with a ':' means this value has a
             // string argument
@@ -1926,7 +1925,7 @@ static Error ParseEntry(const llvm::Stri
     error_strm.Printf("invalid member '%s' in '%s'. Valid members are: ",
                       key.str().c_str(), parent->name);
   DumpCommaSeparatedChildEntryNames(error_strm, parent);
-  error.SetErrorStringWithFormat("%s", error_strm.GetString().c_str());
+  error.SetErrorStringWithFormat("%s", error_strm.GetData());
   return error;
 }
 

Modified: lldb/trunk/source/Core/IOHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/IOHandler.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/IOHandler.cpp (original)
+++ lldb/trunk/source/Core/IOHandler.cpp Wed Nov 16 15:15:24 2016
@@ -2422,7 +2422,7 @@ public:
         if (FormatEntity::Format(m_format, strm, &sc, &exe_ctx, nullptr,
                                  nullptr, false, false)) {
           int right_pad = 1;
-          window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+          window.PutCStringTruncated(strm.GetString().str().c_str(), right_pad);
         }
       }
     }
@@ -2481,7 +2481,7 @@ public:
       if (FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr,
                                nullptr, false, false)) {
         int right_pad = 1;
-        window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+        window.PutCStringTruncated(strm.GetString().str().c_str(), right_pad);
       }
     }
   }
@@ -2571,7 +2571,7 @@ public:
       if (FormatEntity::Format(m_format, strm, nullptr, &exe_ctx, nullptr,
                                nullptr, false, false)) {
         int right_pad = 1;
-        window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+        window.PutCStringTruncated(strm.GetString().str().c_str(), right_pad);
       }
     }
   }
@@ -3312,7 +3312,7 @@ HelpDialogDelegate::HelpDialogDelegate(c
       StreamString key_description;
       key_description.Printf("%10s - %s", CursesKeyToCString(key->ch),
                              key->description);
-      m_text.AppendString(std::move(key_description.GetString()));
+      m_text.AppendString(key_description.GetString());
     }
   }
 }
@@ -3597,8 +3597,8 @@ public:
               thread_menu_title.Printf(" %s", queue_name);
           }
           menu.AddSubmenu(
-              MenuSP(new Menu(thread_menu_title.GetString().c_str(), nullptr,
-                              menu_char, thread_sp->GetID())));
+              MenuSP(new Menu(thread_menu_title.GetString().str().c_str(),
+                              nullptr, menu_char, thread_sp->GetID())));
         }
       } else if (submenus.size() > 7) {
         // Remove the separator and any other thread submenu items
@@ -3757,7 +3757,7 @@ public:
         if (thread && FormatEntity::Format(m_format, strm, nullptr, &exe_ctx,
                                            nullptr, nullptr, false, false)) {
           window.MoveCursor(40, 0);
-          window.PutCStringTruncated(strm.GetString().c_str(), 1);
+          window.PutCStringTruncated(strm.GetString().str().c_str(), 1);
         }
 
         window.MoveCursor(60, 0);
@@ -3986,7 +3986,7 @@ public:
       window.AttributeOn(A_REVERSE);
       window.MoveCursor(1, 1);
       window.PutChar(' ');
-      window.PutCStringTruncated(m_title.GetString().c_str(), 1);
+      window.PutCStringTruncated(m_title.GetString().str().c_str(), 1);
       int x = window.GetCursorX();
       if (x < window_width - 1) {
         window.Printf("%*s", window_width - x - 1, "");
@@ -4208,7 +4208,7 @@ public:
             strm.Printf("%s", mnemonic);
 
           int right_pad = 1;
-          window.PutCStringTruncated(strm.GetString().c_str(), right_pad);
+          window.PutCStringTruncated(strm.GetData(), right_pad);
 
           if (is_pc_line && frame_sp &&
               frame_sp->GetConcreteFrameIndex() == 0) {

Modified: lldb/trunk/source/Core/Log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Log.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Log.cpp (original)
+++ lldb/trunk/source/Core/Log.cpp Wed Nov 16 15:15:24 2016
@@ -51,6 +51,7 @@ Flags &Log::GetMask() { return m_mask_bi
 const Flags &Log::GetMask() const { return m_mask_bits; }
 
 void Log::PutCString(const char *cstr) { Printf("%s", cstr); }
+void Log::PutString(llvm::StringRef str) { PutCString(str.str().c_str()); }
 
 //----------------------------------------------------------------------
 // Simple variable argument logging with flags.

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Wed Nov 16 15:15:24 2016
@@ -316,7 +316,7 @@ ObjectFile *Module::GetMemoryObjectFile(
         if (m_objfile_sp) {
           StreamString s;
           s.Printf("0x%16.16" PRIx64, header_addr);
-          m_object_name.SetCString(s.GetData());
+          m_object_name.SetString(s.GetString());
 
           // Once we get the object file, update our module with the object
           // file's
@@ -1118,7 +1118,7 @@ void Module::ReportError(const char *for
       if (last_char != '\n' || last_char != '\r')
         strm.EOL();
     }
-    Host::SystemLog(Host::eSystemLogError, "%s", strm.GetString().c_str());
+    Host::SystemLog(Host::eSystemLogError, "%s", strm.GetData());
   }
 }
 
@@ -1152,7 +1152,7 @@ void Module::ReportErrorIfModifyDetected
         }
         strm.PutCString("The debug session should be aborted as the original "
                         "debug information has been overwritten.\n");
-        Host::SystemLog(Host::eSystemLogError, "%s", strm.GetString().c_str());
+        Host::SystemLog(Host::eSystemLogError, "%s", strm.GetData());
       }
     }
   }
@@ -1176,7 +1176,7 @@ void Module::ReportWarning(const char *f
       if (last_char != '\n' || last_char != '\r')
         strm.EOL();
     }
-    Host::SystemLog(Host::eSystemLogWarning, "%s", strm.GetString().c_str());
+    Host::SystemLog(Host::eSystemLogWarning, "%s", strm.GetData());
   }
 }
 
@@ -1189,7 +1189,7 @@ void Module::LogMessage(Log *log, const
     va_start(args, format);
     log_message.PrintfVarArg(format, args);
     va_end(args);
-    log->PutCString(log_message.GetString().c_str());
+    log->PutCString(log_message.GetData());
   }
 }
 
@@ -1208,7 +1208,7 @@ void Module::LogMessageVerboseBacktrace(
       llvm::sys::PrintStackTrace(stream);
       log_message.PutCString(back_trace);
     }
-    log->PutCString(log_message.GetString().c_str());
+    log->PutCString(log_message.GetData());
   }
 }
 

Modified: lldb/trunk/source/Core/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/RegisterValue.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/RegisterValue.cpp (original)
+++ lldb/trunk/source/Core/RegisterValue.cpp Wed Nov 16 15:15:24 2016
@@ -46,13 +46,13 @@ bool RegisterValue::Dump(Stream *s, cons
       format_string.Printf("%%%us", reg_name_right_align_at);
     else
       format_string.Printf("%%s");
-    const char *fmt = format_string.GetData();
+    std::string fmt = format_string.GetString();
     if (prefix_with_name) {
       if (reg_info->name) {
-        s->Printf(fmt, reg_info->name);
+        s->Printf(fmt.c_str(), reg_info->name);
         name_printed = true;
       } else if (reg_info->alt_name) {
-        s->Printf(fmt, reg_info->alt_name);
+        s->Printf(fmt.c_str(), reg_info->alt_name);
         prefix_with_alt_name = false;
         name_printed = true;
       }
@@ -61,12 +61,12 @@ bool RegisterValue::Dump(Stream *s, cons
       if (name_printed)
         s->PutChar('/');
       if (reg_info->alt_name) {
-        s->Printf(fmt, reg_info->alt_name);
+        s->Printf(fmt.c_str(), reg_info->alt_name);
         name_printed = true;
       } else if (!name_printed) {
         // No alternate name but we were asked to display a name, so show the
         // main name
-        s->Printf(fmt, reg_info->name);
+        s->Printf(fmt.c_str(), reg_info->name);
         name_printed = true;
       }
     }

Modified: lldb/trunk/source/Core/StreamString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StreamString.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/StreamString.cpp (original)
+++ lldb/trunk/source/Core/StreamString.cpp Wed Nov 16 15:15:24 2016
@@ -34,8 +34,6 @@ void StreamString::Clear() { m_packet.cl
 
 bool StreamString::Empty() const { return GetSize() == 0; }
 
-const char *StreamString::GetData() const { return m_packet.c_str(); }
-
 size_t StreamString::GetSize() const { return m_packet.size(); }
 
 size_t StreamString::GetSizeOfLastLine() const {
@@ -49,9 +47,7 @@ size_t StreamString::GetSizeOfLastLine()
   }
 }
 
-std::string &StreamString::GetString() { return m_packet; }
-
-const std::string &StreamString::GetString() const { return m_packet; }
+llvm::StringRef StreamString::GetString() const { return m_packet; }
 
 void StreamString::FillLastLineToColumn(uint32_t column, char fill_char) {
   const size_t length = m_packet.size();

Modified: lldb/trunk/source/Core/StringList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StringList.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/StringList.cpp (original)
+++ lldb/trunk/source/Core/StringList.cpp Wed Nov 16 15:15:24 2016
@@ -204,7 +204,7 @@ std::string StringList::CopyList(const c
       strm << item_preamble;
     strm << GetStringAtIndex(i);
   }
-  return std::string(strm.GetData());
+  return strm.GetString();
 }
 
 StringList &StringList::operator<<(const char *str) {

Modified: lldb/trunk/source/Core/StructuredData.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/StructuredData.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/StructuredData.cpp (original)
+++ lldb/trunk/source/Core/StructuredData.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===---------------------StructuredData.cpp ---------------------*- C++
-//-*-===//
+//===---------------------StructuredData.cpp ---------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -213,7 +212,7 @@ StructuredData::Object::GetObjectForDotS
 void StructuredData::Object::DumpToStdout(bool pretty_print) const {
   StreamString stream;
   Dump(stream, pretty_print);
-  printf("%s\n", stream.GetString().c_str());
+  printf("%s\n", stream.GetData());
 }
 
 void StructuredData::Array::Dump(Stream &s, bool pretty_print) const {

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Wed Nov 16 15:15:24 2016
@@ -378,7 +378,7 @@ const char *ValueObject::GetLocationAsCS
         uint32_t addr_nibble_size = data.GetAddressByteSize() * 2;
         sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size,
                     value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS));
-        m_location_str.swap(sstr.GetString());
+        m_location_str = sstr.GetString();
       } break;
       }
     }
@@ -944,7 +944,7 @@ bool ValueObject::SetData(DataExtractor
 static bool CopyStringDataToBufferSP(const StreamString &source,
                                      lldb::DataBufferSP &destination) {
   destination.reset(new DataBufferHeap(source.GetSize() + 1, 0));
-  memcpy(destination->GetBytes(), source.GetString().c_str(), source.GetSize());
+  memcpy(destination->GetBytes(), source.GetString().data(), source.GetSize());
   return true;
 }
 
@@ -1137,7 +1137,7 @@ const char *ValueObject::GetObjectDescri
   }
 
   if (runtime && runtime->GetObjectDescription(s, *this)) {
-    m_object_desc_str.append(s.GetData());
+    m_object_desc_str.append(s.GetString());
   }
 
   if (m_object_desc_str.empty())
@@ -1414,14 +1414,12 @@ bool ValueObject::DumpPrintableRepresent
   bool var_success = false;
 
   {
-    const char *cstr = NULL;
+    llvm::StringRef str;
 
     // this is a local stream that we are using to ensure that the data pointed
-    // to by cstr survives
-    // long enough for us to copy it to its destination - it is necessary to
-    // have this temporary storage
-    // area for cases where our desired output is not backed by some other
-    // longer-term storage
+    // to by cstr survives long enough for us to copy it to its destination - it
+    // is necessary to have this temporary storage area for cases where our
+    // desired output is not backed by some other longer-term storage
     StreamString strm;
 
     if (custom_format != eFormatInvalid)
@@ -1429,55 +1427,55 @@ bool ValueObject::DumpPrintableRepresent
 
     switch (val_obj_display) {
     case eValueObjectRepresentationStyleValue:
-      cstr = GetValueAsCString();
+      str = GetValueAsCString();
       break;
 
     case eValueObjectRepresentationStyleSummary:
-      cstr = GetSummaryAsCString();
+      str = GetSummaryAsCString();
       break;
 
     case eValueObjectRepresentationStyleLanguageSpecific:
-      cstr = GetObjectDescription();
+      str = GetObjectDescription();
       break;
 
     case eValueObjectRepresentationStyleLocation:
-      cstr = GetLocationAsCString();
+      str = GetLocationAsCString();
       break;
 
     case eValueObjectRepresentationStyleChildrenCount:
       strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
-      cstr = strm.GetString().c_str();
+      str = strm.GetString();
       break;
 
     case eValueObjectRepresentationStyleType:
-      cstr = GetTypeName().AsCString();
+      str = GetTypeName().GetStringRef();
       break;
 
     case eValueObjectRepresentationStyleName:
-      cstr = GetName().AsCString();
+      str = GetName().GetStringRef();
       break;
 
     case eValueObjectRepresentationStyleExpressionPath:
       GetExpressionPath(strm, false);
-      cstr = strm.GetString().c_str();
+      str = strm.GetString();
       break;
     }
 
-    if (!cstr) {
+    if (str.empty()) {
       if (val_obj_display == eValueObjectRepresentationStyleValue)
-        cstr = GetSummaryAsCString();
+        str = GetSummaryAsCString();
       else if (val_obj_display == eValueObjectRepresentationStyleSummary) {
         if (!CanProvideValue()) {
           strm.Printf("%s @ %s", GetTypeName().AsCString(),
                       GetLocationAsCString());
-          cstr = strm.GetString().c_str();
+          str = strm.GetString();
         } else
-          cstr = GetValueAsCString();
+          str = GetValueAsCString();
       }
     }
 
-    if (cstr)
-      s.PutCString(cstr);
+    if (!str.empty())
+      s << str;
     else {
       if (m_error.Fail()) {
         if (do_dump_error)
@@ -3352,11 +3350,11 @@ ValueObjectSP ValueObject::Dereference(E
     if (is_pointer_or_reference_type)
       error.SetErrorStringWithFormat("dereference failed: (%s) %s",
                                      GetTypeName().AsCString("<invalid type>"),
-                                     strm.GetString().c_str());
+                                     strm.GetData());
     else
       error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s",
                                      GetTypeName().AsCString("<invalid type>"),
-                                     strm.GetString().c_str());
+                                     strm.GetData());
     return ValueObjectSP();
   }
 }
@@ -3375,7 +3373,7 @@ ValueObjectSP ValueObject::AddressOf(Err
       StreamString expr_path_strm;
       GetExpressionPath(expr_path_strm, true);
       error.SetErrorStringWithFormat("'%s' is not in memory",
-                                     expr_path_strm.GetString().c_str());
+                                     expr_path_strm.GetData());
     } break;
 
     case eAddressTypeFile:
@@ -3398,7 +3396,7 @@ ValueObjectSP ValueObject::AddressOf(Err
     StreamString expr_path_strm;
     GetExpressionPath(expr_path_strm, true);
     error.SetErrorStringWithFormat("'%s' doesn't have a valid address",
-                                   expr_path_strm.GetString().c_str());
+                                   expr_path_strm.GetData());
   }
 
   return m_addr_of_valobj_sp;

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- FormatManager.cpp -------------------------------------------*- C++
-//-*-===//
+//===-- FormatManager.cpp ----------------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -183,7 +182,7 @@ void FormatManager::GetPossibleMatches(
   if (valobj.GetBitfieldBitSize() > 0) {
     StreamString sstring;
     sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize());
-    ConstString bitfieldname = ConstString(sstring.GetData());
+    ConstString bitfieldname(sstring.GetString());
     entries.push_back(
         {bitfieldname, 0, did_strip_ptr, did_strip_ref, did_strip_typedef});
     reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;

Modified: lldb/trunk/source/DataFormatters/TypeCategory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategory.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeCategory.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategory.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- TypeCategory.cpp -------------------------------------------*- C++
-//-*-===//
+//===-- TypeCategory.cpp -----------------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -638,7 +637,7 @@ std::string TypeCategoryImpl::GetDescrip
                        idx + 1 < GetNumLanguages() ? ", " : "");
   }
   if (print_lang)
-    stream.Printf("%s", lang_stream.GetData());
+    stream.PutCString(lang_stream.GetString());
   stream.PutChar(')');
-  return stream.GetData();
+  return stream.GetString();
 }

Modified: lldb/trunk/source/DataFormatters/TypeFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeFormat.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeFormat.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeFormat.cpp Wed Nov 16 15:15:24 2016
@@ -63,7 +63,7 @@ bool TypeFormatImpl_Format::FormatObject
         data.Dump(&reg_sstr, 0, GetFormat(), reg_info->byte_size, 1, UINT32_MAX,
                   LLDB_INVALID_ADDRESS, 0, 0,
                   exe_ctx.GetBestExecutionContextScope());
-        dest.swap(reg_sstr.GetString());
+        dest = reg_sstr.GetString();
       }
     } else {
       CompilerType compiler_type = value.GetCompilerType();
@@ -115,10 +115,7 @@ bool TypeFormatImpl_Format::FormatObject
         // return from here, but that's about as severe as we get
         // CompilerType::DumpTypeValue() should always return
         // something, even if that something is an error message
-        if (sstr.GetString().empty())
-          dest.clear();
-        else
-          dest.swap(sstr.GetString());
+        dest = sstr.GetString();
       }
     }
     return !dest.empty();
@@ -196,7 +193,7 @@ bool TypeFormatImpl_EnumType::FormatObje
                                  data.GetByteSize(), 0, 0,
                                  exe_ctx.GetBestExecutionContextScope());
   if (!sstr.GetString().empty())
-    dest.swap(sstr.GetString());
+    dest = sstr.GetString();
   return !dest.empty();
 }
 

Modified: lldb/trunk/source/DataFormatters/TypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSummary.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeSummary.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeSummary.cpp Wed Nov 16 15:15:24 2016
@@ -98,7 +98,7 @@ bool StringSummaryFormat::FormatObject(V
   if (IsOneLiner()) {
     ValueObjectPrinter printer(valobj, &s, DumpValueObjectOptions());
     printer.PrintChildrenOneLiner(HideNames(valobj));
-    retval.assign(s.GetData());
+    retval = s.GetString();
     return true;
   } else {
     if (FormatEntity::Format(m_format, s, &sc, &exe_ctx,
@@ -141,7 +141,7 @@ bool CXXFunctionSummaryFormat::FormatObj
   StreamString stream;
   if (!m_impl || m_impl(*valobj, stream, options) == false)
     return false;
-  dest.assign(stream.GetData());
+  dest = stream.GetString();
   return true;
 }
 

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- ValueObjectPrinter.cpp -------------------------------------*- C++
-//-*-===//
+//===-- ValueObjectPrinter.cpp -----------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -302,22 +301,22 @@ void ValueObjectPrinter::PrintDecl() {
   }
 
   if (m_options.m_decl_printing_helper) {
-    ConstString type_name_cstr(typeName.GetData());
-    ConstString var_name_cstr(varName.GetData());
+    ConstString type_name_cstr(typeName.GetString());
+    ConstString var_name_cstr(varName.GetString());
 
     StreamString dest_stream;
     if (m_options.m_decl_printing_helper(type_name_cstr, var_name_cstr,
                                          m_options, dest_stream)) {
       decl_printed = true;
-      m_stream->Printf("%s", dest_stream.GetData());
+      m_stream->PutCString(dest_stream.GetString());
     }
   }
 
   // if the helper failed, or there is none, do a default thing
   if (!decl_printed) {
-    if (typeName.GetSize())
+    if (!typeName.Empty())
       m_stream->Printf("(%s) ", typeName.GetData());
-    if (varName.GetSize())
+    if (!varName.Empty())
       m_stream->Printf("%s =", varName.GetData());
     else if (!m_options.m_hide_name)
       m_stream->Printf(" =");

Modified: lldb/trunk/source/DataFormatters/VectorType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/VectorType.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/VectorType.cpp (original)
+++ lldb/trunk/source/DataFormatters/VectorType.cpp Wed Nov 16 15:15:24 2016
@@ -211,7 +211,7 @@ public:
 
     StreamString idx_name;
     idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-    child_sp->SetName(ConstString(idx_name.GetData()));
+    child_sp->SetName(ConstString(idx_name.GetString()));
 
     child_sp->SetFormat(m_item_format);
 

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Wed Nov 16 15:15:24 2016
@@ -427,7 +427,7 @@ void IRExecutionUnit::GetRunnableInfo(Er
 
     m_failed_lookups.clear();
 
-    error.SetErrorString(ss.GetData());
+    error.SetErrorString(ss.GetString());
 
     return;
   }

Modified: lldb/trunk/source/Expression/LLVMUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/LLVMUserExpression.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Expression/LLVMUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/LLVMUserExpression.cpp Wed Nov 16 15:15:24 2016
@@ -153,7 +153,7 @@ LLVMUserExpression::DoExecute(Diagnostic
 
       StreamString ss;
       if (!call_plan_sp || !call_plan_sp->ValidatePlan(&ss)) {
-        diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetData());
+        diagnostic_manager.PutString(eDiagnosticSeverityError, ss.GetString());
         return lldb::eExpressionSetupError;
       }
 

Modified: lldb/trunk/source/Expression/Materializer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Expression/Materializer.cpp (original)
+++ lldb/trunk/source/Expression/Materializer.cpp Wed Nov 16 15:15:24 2016
@@ -409,7 +409,7 @@ public:
       }
     }
 
-    log->PutCString(dump_stream.GetData());
+    log->PutString(dump_stream.GetString());
   }
 
   void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {}
@@ -749,7 +749,7 @@ public:
       }
     }
 
-    log->PutCString(dump_stream.GetData());
+    log->PutString(dump_stream.GetString());
   }
 
   void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {
@@ -1019,7 +1019,7 @@ public:
       }
     }
 
-    log->PutCString(dump_stream.GetData());
+    log->PutString(dump_stream.GetString());
   }
 
   void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {
@@ -1156,7 +1156,7 @@ public:
       }
     }
 
-    log->PutCString(dump_stream.GetData());
+    log->PutString(dump_stream.GetString());
   }
 
   void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {}
@@ -1332,7 +1332,7 @@ public:
       }
     }
 
-    log->PutCString(dump_stream.GetData());
+    log->PutString(dump_stream.GetString());
   }
 
   void Wipe(IRMemoryMap &map, lldb::addr_t process_address) override {}

Modified: lldb/trunk/source/Host/macosx/Host.mm
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Host.mm?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Host.mm (original)
+++ lldb/trunk/source/Host/macosx/Host.mm Wed Nov 16 15:15:24 2016
@@ -478,7 +478,6 @@ LaunchInNewTerminalWithAppleScript(const
 
   StreamString applescript_source;
 
-  const char *tty_command = command.GetString().c_str();
   //    if (tty_name && tty_name[0])
   //    {
   //        applescript_source.Printf (applscript_in_existing_tty,
@@ -487,13 +486,15 @@ LaunchInNewTerminalWithAppleScript(const
   //    }
   //    else
   //    {
-  applescript_source.Printf(applscript_in_new_tty, tty_command);
+  applescript_source.Printf(applscript_in_new_tty,
+                            command.GetString().str().c_str());
   //    }
 
-  const char *script_source = applescript_source.GetString().c_str();
   // puts (script_source);
   NSAppleScript *applescript = [[NSAppleScript alloc]
-      initWithSource:[NSString stringWithCString:script_source
+      initWithSource:[NSString stringWithCString:applescript_source.GetString()
+                                                     .str()
+                                                     .c_str()
                                         encoding:NSUTF8StringEncoding]];
 
   lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
@@ -557,7 +558,7 @@ void Host::SetCrashDescriptionWithFormat
   if (format) {
     va_list args;
     va_start(args, format);
-    g_crash_description.GetString().clear();
+    g_crash_description.GetString() = llvm::StringRef("");
     g_crash_description.PrintfVarArg(format, args);
     va_end(args);
     __crashreporter_info__ = g_crash_description.GetData();

Modified: lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp (original)
+++ lldb/trunk/source/Host/posix/ConnectionFileDescriptorPosix.cpp Wed Nov 16 15:15:24 2016
@@ -794,5 +794,5 @@ void ConnectionFileDescriptor::Initializ
   StreamString strm;
   strm.Printf("connect://%s:%u", tcp_socket->GetRemoteIPAddress().c_str(),
               tcp_socket->GetRemotePortNumber());
-  m_uri.swap(strm.GetString());
+  m_uri = strm.GetString();
 }

Modified: lldb/trunk/source/Host/windows/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/Host.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/Host.cpp (original)
+++ lldb/trunk/source/Host/windows/Host.cpp Wed Nov 16 15:15:24 2016
@@ -230,8 +230,9 @@ Error Host::ShellExpandArguments(Process
 
     int status;
     std::string output;
-    RunShellCommand(expand_command.GetData(), launch_info.GetWorkingDirectory(),
-                    &status, nullptr, &output, 10);
+    std::string command = expand_command.GetString();
+    RunShellCommand(command.c_str(), launch_info.GetWorkingDirectory(), &status,
+                    nullptr, &output, 10);
 
     if (status != 0) {
       error.SetErrorStringWithFormat("lldb-argdumper exited with error %d",

Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Wed Nov 16 15:15:24 2016
@@ -803,7 +803,7 @@ int64_t Args::StringToOptionEnum(llvm::S
   for (int i = 0; enum_values[i].string_value != nullptr; i++) {
     strm.Printf("%s\"%s\"", i > 0 ? ", " : "", enum_values[i].string_value);
   }
-  error.SetErrorString(strm.GetData());
+  error.SetErrorString(strm.GetString());
   return fail_value;
 }
 
@@ -859,7 +859,7 @@ Error Args::StringToFormat(const char *s
       if (byte_size_ptr)
         error_strm.PutCString(
             "An optional byte size can precede the format character.\n");
-      error.SetErrorString(error_strm.GetString().c_str());
+      error.SetErrorString(error_strm.GetString());
     }
 
     if (error.Fail())
@@ -1020,9 +1020,9 @@ std::string Args::ParseAliasOptions(Opti
   int val;
   while (1) {
     int long_options_index = -1;
-    val =
-        OptionParser::Parse(GetArgumentCount(), GetArgumentVector(),
-                            sstr.GetData(), long_options, &long_options_index);
+    val = OptionParser::Parse(GetArgumentCount(), GetArgumentVector(),
+                              sstr.GetString(), long_options,
+                              &long_options_index);
 
     if (val == -1)
       break;
@@ -1088,7 +1088,8 @@ std::string Args::ParseAliasOptions(Opti
     }
     if (!option_arg)
       option_arg = "<no-argument>";
-    option_arg_vector->emplace_back(option_str.GetData(), has_arg, option_arg);
+    option_arg_vector->emplace_back(option_str.GetString(), has_arg,
+                                    option_arg);
 
     // Find option in the argument list; also see if it was supposed to take
     // an argument and if one was supplied.  Remove option (and argument, if

Modified: lldb/trunk/source/Interpreter/CommandAlias.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandAlias.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandAlias.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandAlias.cpp Wed Nov 16 15:15:24 2016
@@ -92,7 +92,7 @@ CommandAlias::CommandAlias(CommandInterp
       translation_and_help.Printf(
           "(%s)  %s", sstr.GetData(),
           GetUnderlyingCommand()->GetHelp().str().c_str());
-      SetHelp(translation_and_help.GetData());
+      SetHelp(translation_and_help.GetString());
     }
   }
 }

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Wed Nov 16 15:15:24 2016
@@ -352,8 +352,8 @@ void CommandInterpreter::Initialize() {
     StreamString defaultshell;
     defaultshell.Printf("--shell=%s --",
                         HostInfo::GetDefaultShell().GetPath().c_str());
-    AddAlias("r", cmd_obj_sp, defaultshell.GetData());
-    AddAlias("run", cmd_obj_sp, defaultshell.GetData());
+    AddAlias("r", cmd_obj_sp, defaultshell.GetString());
+    AddAlias("run", cmd_obj_sp, defaultshell.GetString());
 #endif
 #endif
   }
@@ -1327,7 +1327,7 @@ CommandObject *CommandInterpreter::Build
   result_str.Printf("%s", alias_cmd_obj->GetCommandName().str().c_str());
 
   if (!option_arg_vector_sp.get()) {
-    alias_result = result_str.GetData();
+    alias_result = result_str.GetString();
     return alias_cmd_obj;
   }
   OptionArgVector *option_arg_vector = option_arg_vector_sp.get();
@@ -1368,7 +1368,7 @@ CommandObject *CommandInterpreter::Build
     }
   }
 
-  alias_result = result_str.GetData();
+  alias_result = result_str.GetString();
   return alias_cmd_obj;
 }
 
@@ -1437,8 +1437,7 @@ Error CommandInterpreter::PreprocessComm
               scalar.GetValue(&value_strm, show_type);
               size_t value_string_size = value_strm.GetSize();
               if (value_string_size) {
-                command.insert(start_backtick, value_strm.GetData(),
-                               value_string_size);
+                command.insert(start_backtick, value_strm.GetString());
                 pos = start_backtick + value_string_size;
                 continue;
               } else {
@@ -2249,21 +2248,21 @@ void CommandInterpreter::HandleCommands(
     }
 
     if (!success || !tmp_result.Succeeded()) {
-      const char *error_msg = tmp_result.GetErrorData();
-      if (error_msg == nullptr || error_msg[0] == '\0')
+      llvm::StringRef error_msg = tmp_result.GetErrorData();
+      if (error_msg.empty())
         error_msg = "<unknown error>.\n";
       if (options.GetStopOnError()) {
         result.AppendErrorWithFormat(
             "Aborting reading of commands after command #%" PRIu64
             ": '%s' failed with %s",
-            (uint64_t)idx, cmd, error_msg);
+            (uint64_t)idx, cmd, error_msg.str().c_str());
         result.SetStatus(eReturnStatusFailed);
         m_debugger.SetAsyncExecution(old_async_execution);
         return;
       } else if (options.GetPrintResults()) {
-        result.AppendMessageWithFormat("Command #%" PRIu64
-                                       " '%s' failed with %s",
-                                       (uint64_t)idx + 1, cmd, error_msg);
+        result.AppendMessageWithFormat(
+            "Command #%" PRIu64 " '%s' failed with %s", (uint64_t)idx + 1, cmd,
+            error_msg.str().c_str());
       }
     }
 
@@ -2546,7 +2545,15 @@ void CommandInterpreter::OutputFormatted
   StreamString prefix_stream;
   prefix_stream.Printf("  %-*s %*s ", (int)max_word_len, word_text.data(),
                        (int)separator.size(), separator.data());
-  OutputFormattedHelpText(strm, prefix_stream.GetData(), help_text);
+  OutputFormattedHelpText(strm, prefix_stream.GetString(), help_text);
+}
+
+LLVM_ATTRIBUTE_ALWAYS_INLINE
+static size_t nextWordLength(llvm::StringRef S) {
+  size_t pos = S.find_first_of(' ');
+  if (pos == llvm::StringRef::npos)
+    return S.size();
+  return pos;
 }
 
 void CommandInterpreter::OutputHelpText(Stream &strm, llvm::StringRef word_text,
@@ -2563,22 +2570,24 @@ void CommandInterpreter::OutputHelpText(
 
   const uint32_t max_columns = m_debugger.GetTerminalWidth();
 
-  size_t len = text_strm.GetSize();
-  const char *text = text_strm.GetData();
+  llvm::StringRef text = text_strm.GetString();
 
   uint32_t chars_left = max_columns;
 
-  for (uint32_t i = 0; i < len; i++) {
-    if ((text[i] == ' ' && ::strchr((text + i + 1), ' ') &&
-         chars_left < static_cast<uint32_t>(::strchr((text + i + 1), ' ') -
-                                            (text + i))) ||
-        text[i] == '\n') {
-      chars_left = max_columns - indent_size;
+  while (!text.empty()) {
+    if (text.front() == '\n' ||
+        (text.front() == ' ' && nextWordLength(text.ltrim(' ')) < chars_left)) {
       strm.EOL();
       strm.Indent();
+      chars_left = max_columns - indent_size;
+      if (text.front() == '\n')
+        text = text.drop_front();
+      else
+        text = text.ltrim(' ');
     } else {
-      strm.PutChar(text[i]);
-      chars_left--;
+      strm.PutChar(text.front());
+      --chars_left;
+      text = text.drop_front();
     }
   }
 
@@ -2707,15 +2716,15 @@ void CommandInterpreter::IOHandlerInputC
     GetProcessOutput();
 
     if (!result.GetImmediateOutputStream()) {
-      const char *output = result.GetOutputData();
-      if (output && output[0])
+      llvm::StringRef output = result.GetOutputData();
+      if (!output.empty())
         io_handler.GetOutputStreamFile()->PutCString(output);
     }
 
     // Now emit the command error text from the command we just executed
     if (!result.GetImmediateErrorStream()) {
-      const char *error = result.GetErrorData();
-      if (error && error[0])
+      llvm::StringRef error = result.GetErrorData();
+      if (!error.empty())
         io_handler.GetErrorStreamFile()->PutCString(error);
     }
   }
@@ -2993,7 +3002,7 @@ CommandInterpreter::ResolveCommandImpl(s
         for (uint32_t i = 0; i < num_matches; ++i) {
           error_msg.Printf("\t%s\n", matches.GetStringAtIndex(i));
         }
-        result.AppendRawError(error_msg.GetString().c_str());
+        result.AppendRawError(error_msg.GetString());
       } else {
         // We didn't have only one match, otherwise we wouldn't get here.
         assert(num_matches == 0);
@@ -3029,18 +3038,16 @@ CommandInterpreter::ResolveCommandImpl(s
               std::string gdb_format_option("--gdb-format=");
               gdb_format_option += (suffix.c_str() + 1);
 
-              bool inserted = false;
-              std::string &cmd = revised_command_line.GetString();
+              std::string cmd = revised_command_line.GetString();
               size_t arg_terminator_idx = FindArgumentTerminator(cmd);
               if (arg_terminator_idx != std::string::npos) {
                 // Insert the gdb format option before the "--" that terminates
                 // options
                 gdb_format_option.append(1, ' ');
                 cmd.insert(arg_terminator_idx, gdb_format_option);
-                inserted = true;
-              }
-
-              if (!inserted)
+                revised_command_line.Clear();
+                revised_command_line.PutCString(cmd);
+              } else
                 revised_command_line.Printf(" %s", gdb_format_option.c_str());
 
               if (wants_raw_input &&
@@ -3072,7 +3079,7 @@ CommandInterpreter::ResolveCommandImpl(s
     revised_command_line.Printf(" %s", scratch_command.c_str());
 
   if (cmd_obj != NULL)
-    command_line = revised_command_line.GetData();
+    command_line = revised_command_line.GetString();
 
   return cmd_obj;
 }

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Wed Nov 16 15:15:24 2016
@@ -74,7 +74,7 @@ llvm::StringRef CommandObject::GetSyntax
       syntax_str.PutCString("-- ");
     GetFormattedCommandArguments(syntax_str);
   }
-  m_cmd_syntax = syntax_str.GetData();
+  m_cmd_syntax = syntax_str.GetString();
 
   return m_cmd_syntax;
 }
@@ -392,14 +392,14 @@ void CommandObject::GetArgumentHelp(Stre
   if (entry->help_function) {
     llvm::StringRef help_text = entry->help_function();
     if (!entry->help_function.self_formatting) {
-      interpreter.OutputFormattedHelpText(str, name_str.GetData(), "--",
+      interpreter.OutputFormattedHelpText(str, name_str.GetString(), "--",
                                           help_text, name_str.GetSize());
     } else {
-      interpreter.OutputHelpText(str, name_str.GetData(), "--", help_text,
+      interpreter.OutputHelpText(str, name_str.GetString(), "--", help_text,
                                  name_str.GetSize());
     }
   } else
-    interpreter.OutputFormattedHelpText(str, name_str.GetData(), "--",
+    interpreter.OutputFormattedHelpText(str, name_str.GetString(), "--",
                                         entry->help_text, name_str.GetSize());
 }
 
@@ -416,9 +416,7 @@ const char *CommandObject::GetArgumentNa
   if (entry)
     return entry->arg_name;
 
-  StreamString str;
-  str << "Arg name for type (" << arg_type << ") not in arg table!";
-  return str.GetData();
+  return nullptr;
 }
 
 bool CommandObject::IsPairType(ArgumentRepetitionType arg_repeat_type) {
@@ -503,21 +501,23 @@ void CommandObject::GetFormattedCommandA
           names.Printf(" | ");
         names.Printf("%s", GetArgumentName(arg_entry[j].arg_type));
       }
+
+      std::string name_str = names.GetString();
       switch (arg_entry[0].arg_repetition) {
       case eArgRepeatPlain:
-        str.Printf("<%s>", names.GetData());
+        str.Printf("<%s>", name_str.c_str());
         break;
       case eArgRepeatPlus:
-        str.Printf("<%s> [<%s> [...]]", names.GetData(), names.GetData());
+        str.Printf("<%s> [<%s> [...]]", name_str.c_str(), name_str.c_str());
         break;
       case eArgRepeatStar:
-        str.Printf("[<%s> [<%s> [...]]]", names.GetData(), names.GetData());
+        str.Printf("[<%s> [<%s> [...]]]", name_str.c_str(), name_str.c_str());
         break;
       case eArgRepeatOptional:
-        str.Printf("[<%s>]", names.GetData());
+        str.Printf("[<%s>]", name_str.c_str());
         break;
       case eArgRepeatRange:
-        str.Printf("<%s_1> .. <%s_n>", names.GetData(), names.GetData());
+        str.Printf("<%s_1> .. <%s_n>", name_str.c_str(), name_str.c_str());
         break;
       // Explicitly test for all the rest of the cases, so if new types get
       // added we will notice the

Modified: lldb/trunk/source/Interpreter/CommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandReturnObject.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandReturnObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandReturnObject.cpp Wed Nov 16 15:15:24 2016
@@ -69,7 +69,7 @@ void CommandReturnObject::AppendMessageW
   sstrm.PrintfVarArg(format, args);
   va_end(args);
 
-  GetOutputStream().Printf("%s", sstrm.GetData());
+  GetOutputStream() << sstrm.GetString();
 }
 
 void CommandReturnObject::AppendWarningWithFormat(const char *format, ...) {
@@ -81,7 +81,7 @@ void CommandReturnObject::AppendWarningW
   sstrm.PrintfVarArg(format, args);
   va_end(args);
 
-  GetErrorStream().Printf("warning: %s", sstrm.GetData());
+  GetErrorStream() << "warning: " << sstrm.GetString();
 }
 
 void CommandReturnObject::AppendMessage(llvm::StringRef in_string) {

Modified: lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp Wed Nov 16 15:15:24 2016
@@ -75,7 +75,7 @@ Error OptionValueEnumeration::SetValueFr
                             m_enumerations.GetCStringAtIndex(i).str().c_str());
         }
       }
-      error.SetErrorString(error_strm.GetData());
+      error.SetErrorString(error_strm.GetString());
     }
     break;
   }

Modified: lldb/trunk/source/Interpreter/OptionValueLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueLanguage.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueLanguage.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueLanguage.cpp Wed Nov 16 15:15:24 2016
@@ -61,7 +61,7 @@ Error OptionValueLanguage::SetValueFromS
         error_strm.Printf("%s%s%s", "    ",
                           Language::GetNameForLanguageType(language), "\n");
       }
-      error.SetErrorString(error_strm.GetData());
+      error.SetErrorString(error_strm.GetString());
     }
   } break;
 

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Wed Nov 16 15:15:24 2016
@@ -529,7 +529,7 @@ void Options::GenerateOptionUsage(Stream
         if (cmd->WantsRawCommandString() && !only_print_args)
           strm.Printf(" --");
 
-        strm.Printf(" %s", args_str.GetData());
+        strm << " " << args_str.GetString();
         if (only_print_args)
           break;
       }
@@ -541,7 +541,7 @@ void Options::GenerateOptionUsage(Stream
     if (!only_print_args)
       strm.PutChar('\n');
     strm.Indent(name);
-    strm.Printf(" %s", arguments_str.GetData());
+    strm << " " << arguments_str.GetString();
   }
 
   strm.Printf("\n\n");

Modified: lldb/trunk/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Property.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Property.cpp (original)
+++ lldb/trunk/source/Interpreter/Property.cpp Wed Nov 16 15:15:24 2016
@@ -277,17 +277,17 @@ void Property::DumpDescription(CommandIn
     strm.EOL();
 
     if (m_value_sp->DumpQualifiedName(qualified_name))
-      strm.Printf("'%s' variables:\n\n", qualified_name.GetString().c_str());
+      strm.Printf("'%s' variables:\n\n", qualified_name.GetData());
     sub_properties->DumpAllDescriptions(interpreter, strm);
   } else {
     if (display_qualified_name) {
       StreamString qualified_name;
       DumpQualifiedName(qualified_name);
-      interpreter.OutputFormattedHelpText(
-          strm, qualified_name.GetString().c_str(), "--", desc, output_width);
+      interpreter.OutputFormattedHelpText(strm, qualified_name.GetString(),
+                                          "--", desc, output_width);
     } else {
-      interpreter.OutputFormattedHelpText(strm, m_name.GetCString(), "--", desc,
-                                          output_width);
+      interpreter.OutputFormattedHelpText(strm, m_name.GetStringRef(), "--",
+                                          desc, output_width);
     }
   }
 }

Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp Wed Nov 16 15:15:24 2016
@@ -1703,7 +1703,7 @@ bool ABIMacOSX_arm64::PrepareTrivialCall
     for (size_t i = 0; i < args.size(); ++i)
       s.Printf(", arg%d = 0x%" PRIx64, static_cast<int>(i + 1), args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   const uint32_t pc_reg_num = reg_ctx->ConvertRegisterKindToRegisterNumber(

Modified: lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp Wed Nov 16 15:15:24 2016
@@ -1706,7 +1706,7 @@ bool ABISysV_arm64::PrepareTrivialCall(T
     for (size_t i = 0; i < args.size(); ++i)
       s.Printf(", arg%d = 0x%" PRIx64, static_cast<int>(i + 1), args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   // x0 - x7 contain first 8 simple args

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Wed Nov 16 15:15:24 2016
@@ -587,7 +587,7 @@ bool ABISysV_mips::PrepareTrivialCall(Th
     for (size_t i = 0; i < args.size(); ++i)
       s.Printf(", arg%zd = 0x%" PRIx64, i + 1, args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   RegisterContext *reg_ctx = thread.GetRegisterContext().get();

Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Wed Nov 16 15:15:24 2016
@@ -587,7 +587,7 @@ bool ABISysV_mips64::PrepareTrivialCall(
     for (size_t i = 0; i < args.size(); ++i)
       s.Printf(", arg%zd = 0x%" PRIx64, i + 1, args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   RegisterContext *reg_ctx = thread.GetRegisterContext().get();

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp Wed Nov 16 15:15:24 2016
@@ -250,7 +250,7 @@ bool ABISysV_ppc::PrepareTrivialCall(Thr
       s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
                args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   RegisterContext *reg_ctx = thread.GetRegisterContext().get();

Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp Wed Nov 16 15:15:24 2016
@@ -250,7 +250,7 @@ bool ABISysV_ppc64::PrepareTrivialCall(T
       s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
                args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   RegisterContext *reg_ctx = thread.GetRegisterContext().get();

Modified: lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp Wed Nov 16 15:15:24 2016
@@ -232,7 +232,7 @@ bool ABISysV_s390x::PrepareTrivialCall(T
       s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
                args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   RegisterContext *reg_ctx = thread.GetRegisterContext().get();

Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Wed Nov 16 15:15:24 2016
@@ -1120,7 +1120,7 @@ bool ABISysV_x86_64::PrepareTrivialCall(
       s.Printf(", arg%" PRIu64 " = 0x%" PRIx64, static_cast<uint64_t>(i + 1),
                args[i]);
     s.PutCString(")");
-    log->PutCString(s.GetString().c_str());
+    log->PutString(s.GetString());
   }
 
   RegisterContext *reg_ctx = thread.GetRegisterContext().get();

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp Wed Nov 16 15:15:24 2016
@@ -359,7 +359,7 @@ public:
             }
             break;
           }
-          m_mnemonics.swap(mnemonic_strm.GetString());
+          m_mnemonics = mnemonic_strm.GetString();
           return;
         } else {
           if (m_does_branch == eLazyBoolCalculate) {
@@ -834,7 +834,7 @@ public:
         ss.PutCString("\n");
       }
 
-      log->PutCString(ss.GetData());
+      log->PutString(ss.GetString());
     }
 
     return true;
@@ -1351,12 +1351,12 @@ const char *DisassemblerLLVMC::SymbolLoo
           // seen when we
           // have multiple levels of inlined functions at an address, only show
           // the first line.
-          std::string &str(ss.GetString());
+          std::string str = ss.GetString();
           size_t first_eol_char = str.find_first_of("\r\n");
           if (first_eol_char != std::string::npos) {
             str.erase(first_eol_char);
           }
-          m_inst->AppendComment(ss.GetString());
+          m_inst->AppendComment(str);
         }
       }
     }

Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Wed Nov 16 15:15:24 2016
@@ -682,7 +682,7 @@ void DynamicLoaderPOSIXDYLD::ResolveExec
     if (log)
       log->Printf("DynamicLoaderPOSIXDYLD::%s - failed to resolve executable "
                   "with module spec \"%s\": %s",
-                  __FUNCTION__, stream.GetString().c_str(), error.AsCString());
+                  __FUNCTION__, stream.GetData(), error.AsCString());
     return;
   }
 

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- ClangASTSource.cpp ---------------------------------------*- C++
-//-*-===//
+//===-- ClangASTSource.cpp ---------------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -1042,10 +1041,10 @@ void ClangASTSource::FindObjCMethodDecls
   }
   ss.Flush();
 
-  if (strstr(ss.GetData(), "$__lldb"))
+  if (ss.GetString().contains("$__lldb"))
     return; // we don't need any results
 
-  ConstString selector_name(ss.GetData());
+  ConstString selector_name(ss.GetString());
 
   if (log)
     log->Printf("ClangASTSource::FindObjCMethodDecls[%d] on (ASTContext*)%p "
@@ -1065,7 +1064,7 @@ void ClangASTSource::FindObjCMethodDecls
     StreamString ms;
     ms.Printf("-[%s %s]", interface_name.c_str(), selector_name.AsCString());
     ms.Flush();
-    ConstString instance_method_name(ms.GetData());
+    ConstString instance_method_name(ms.GetString());
 
     m_target->GetImages().FindFunctions(
         instance_method_name, lldb::eFunctionNameTypeFull, include_symbols,
@@ -1077,7 +1076,7 @@ void ClangASTSource::FindObjCMethodDecls
     ms.Clear();
     ms.Printf("+[%s %s]", interface_name.c_str(), selector_name.AsCString());
     ms.Flush();
-    ConstString class_method_name(ms.GetData());
+    ConstString class_method_name(ms.GetString());
 
     m_target->GetImages().FindFunctions(
         class_method_name, lldb::eFunctionNameTypeFull, include_symbols,

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Wed Nov 16 15:15:24 2016
@@ -135,7 +135,7 @@ public:
 
   bool hasErrors() { return m_has_errors; }
 
-  const std::string &getErrorString() { return m_error_stream.GetString(); }
+  llvm::StringRef getErrorString() { return m_error_stream.GetString(); }
 };
 
 class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer {
@@ -627,7 +627,7 @@ unsigned ClangExpressionParser::Parse(Di
     diagnostic_manager.PutString(eDiagnosticSeverityError,
                                  "while importing modules:");
     diagnostic_manager.AppendMessageToDiagnostic(
-        m_pp_callbacks->getErrorString().c_str());
+        m_pp_callbacks->getErrorString());
   }
 
   if (!num_errors) {

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulationStateARM.cpp Wed Nov 16 15:15:24 2016
@@ -323,7 +323,7 @@ bool EmulationStateARM::LoadStateFromDic
   for (int i = 0; i < 16; ++i) {
     sstr.Clear();
     sstr.Printf("r%d", i);
-    ConstString reg_name(sstr.GetData());
+    ConstString reg_name(sstr.GetString());
     value_sp = reg_dict->GetValueForKey(reg_name);
     if (value_sp.get() == NULL)
       return false;
@@ -341,7 +341,7 @@ bool EmulationStateARM::LoadStateFromDic
   for (int i = 0; i < 32; ++i) {
     sstr.Clear();
     sstr.Printf("s%d", i);
-    ConstString reg_name(sstr.GetData());
+    ConstString reg_name(sstr.GetString());
     value_sp = reg_dict->GetValueForKey(reg_name);
     if (value_sp.get() == NULL)
       return false;

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp Wed Nov 16 15:15:24 2016
@@ -153,8 +153,8 @@ lldb_private::formatters::LibcxxVectorBo
   StreamString name;
   name.Printf("[%" PRIu64 "]", (uint64_t)idx);
   ValueObjectSP retval_sp(CreateValueObjectFromData(
-      name.GetData(), DataExtractor(buffer_sp, process_sp->GetByteOrder(),
-                                    process_sp->GetAddressByteSize()),
+      name.GetString(), DataExtractor(buffer_sp, process_sp->GetByteOrder(),
+                                      process_sp->GetAddressByteSize()),
       m_exe_ctx_ref, m_bool_type));
   if (retval_sp)
     m_children[idx] = retval_sp;

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp Wed Nov 16 15:15:24 2016
@@ -83,7 +83,7 @@ lldb::ValueObjectSP lldb_private::format
   offset = offset + m_start->GetValueAsUnsigned(0);
   StreamString name;
   name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-  return CreateValueObjectFromAddress(name.GetData(), offset,
+  return CreateValueObjectFromAddress(name.GetString(), offset,
                                       m_backend.GetExecutionContextRef(),
                                       m_element_type);
 }

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp Wed Nov 16 15:15:24 2016
@@ -298,8 +298,9 @@ lldb_private::formatters::LibcxxStdListS
 
   StreamString name;
   name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-  return CreateValueObjectFromData(
-      name.GetData(), data, m_backend.GetExecutionContextRef(), m_element_type);
+  return CreateValueObjectFromData(name.GetString(), data,
+                                   m_backend.GetExecutionContextRef(),
+                                   m_element_type);
 }
 
 bool lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() {

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp Wed Nov 16 15:15:24 2016
@@ -399,7 +399,8 @@ lldb_private::formatters::LibcxxStdMapSy
   StreamString name;
   name.Printf("[%" PRIu64 "]", (uint64_t)idx);
   auto potential_child_sp = CreateValueObjectFromData(
-      name.GetData(), data, m_backend.GetExecutionContextRef(), m_element_type);
+      name.GetString(), data, m_backend.GetExecutionContextRef(),
+      m_element_type);
   if (potential_child_sp) {
     switch (potential_child_sp->GetNumChildren()) {
     case 1: {
@@ -417,7 +418,7 @@ lldb_private::formatters::LibcxxStdMapSy
       break;
     }
     }
-    potential_child_sp->SetName(ConstString(name.GetData()));
+    potential_child_sp->SetName(ConstString(name.GetString()));
   }
   m_iterators[idx] = iterator;
   return potential_child_sp;

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp Wed Nov 16 15:15:24 2016
@@ -139,7 +139,7 @@ lldb::ValueObjectSP lldb_private::format
   const bool thread_and_frame_only_if_stopped = true;
   ExecutionContext exe_ctx = val_hash.first->GetExecutionContextRef().Lock(
       thread_and_frame_only_if_stopped);
-  return CreateValueObjectFromData(stream.GetData(), data, exe_ctx,
+  return CreateValueObjectFromData(stream.GetString(), data, exe_ctx,
                                    val_hash.first->GetCompilerType());
 }
 

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp Wed Nov 16 15:15:24 2016
@@ -93,7 +93,7 @@ lldb_private::formatters::LibcxxStdVecto
   offset = offset + m_start->GetValueAsUnsigned(0);
   StreamString name;
   name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-  return CreateValueObjectFromAddress(name.GetData(), offset,
+  return CreateValueObjectFromAddress(name.GetString(), offset,
                                       m_backend.GetExecutionContextRef(),
                                       m_element_type);
 }

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp Wed Nov 16 15:15:24 2016
@@ -73,7 +73,7 @@ bool LibStdcppTupleSyntheticFrontEnd::Up
         if (value_sp) {
           StreamString name;
           name.Printf("[%zd]", m_members.size());
-          value_sp->SetName(ConstString(name.GetData()));
+          value_sp->SetName(ConstString(name.GetString()));
 
           m_members.push_back(value_sp);
         }

Modified: lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp (original)
+++ lldb/trunk/source/Plugins/Language/Go/GoFormatterFunctions.cpp Wed Nov 16 15:15:24 2016
@@ -42,7 +42,7 @@ public:
         lldb::addr_t object_at_idx = m_base_data_address;
         object_at_idx += idx * m_type.GetByteSize(nullptr);
         cached = CreateValueObjectFromAddress(
-            idx_name.GetData(), object_at_idx,
+            idx_name.GetString(), object_at_idx,
             m_backend.GetExecutionContextRef(), m_type);
       }
       return cached;

Modified: lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.cpp (original)
+++ lldb/trunk/source/Plugins/Language/Java/JavaFormatterFunctions.cpp Wed Nov 16 15:15:24 2016
@@ -70,7 +70,7 @@ public:
     DataExtractor data(buffer_sp, process_sp->GetByteOrder(),
                        process_sp->GetAddressByteSize());
     return CreateValueObjectFromData(
-        name.GetData(), data, valobj->GetExecutionContextRef(), element_type);
+        name.GetString(), data, valobj->GetExecutionContextRef(), element_type);
   }
 
   bool Update() override { return false; }

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Wed Nov 16 15:15:24 2016
@@ -350,7 +350,7 @@ lldb_private::formatters::NSArrayMSynthe
   object_at_idx += (pyhs_idx * m_ptr_size);
   StreamString idx_name;
   idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-  return CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx,
+  return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
                                       m_exe_ctx_ref, m_id_type);
 }
 
@@ -571,7 +571,7 @@ lldb_private::formatters::NSArrayISynthe
     return lldb::ValueObjectSP();
   StreamString idx_name;
   idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-  return CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx,
+  return CreateValueObjectFromAddress(idx_name.GetString(), object_at_idx,
                                       m_exe_ctx_ref, m_id_type);
 }
 

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp Wed Nov 16 15:15:24 2016
@@ -499,7 +499,7 @@ lldb_private::formatters::NSDictionaryIS
     StreamString idx_name;
     idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
     DataExtractor data(buffer_sp, m_order, m_ptr_size);
-    dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(), data,
+    dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetString(), data,
                                                     m_exe_ctx_ref, m_pair_type);
   }
   return dict_item.valobj_sp;
@@ -729,7 +729,7 @@ lldb_private::formatters::NSDictionaryMS
     StreamString idx_name;
     idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
     DataExtractor data(buffer_sp, m_order, m_ptr_size);
-    dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(), data,
+    dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetString(), data,
                                                     m_exe_ctx_ref, m_pair_type);
   }
   return dict_item.valobj_sp;

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp Wed Nov 16 15:15:24 2016
@@ -210,8 +210,8 @@ protected:
         StreamString idx_name;
         idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
 
-        return ValueObjectConstResult::Create(m_process, v,
-                                              ConstString(idx_name.GetData()));
+        return ValueObjectConstResult::Create(
+            m_process, v, ConstString(idx_name.GetString()));
       }
 
       void Clear() {

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp Wed Nov 16 15:15:24 2016
@@ -435,7 +435,7 @@ lldb_private::formatters::NSSetISyntheti
                        process_sp->GetAddressByteSize());
 
     set_item.valobj_sp = CreateValueObjectFromData(
-        idx_name.GetData(), data, m_exe_ctx_ref,
+        idx_name.GetString(), data, m_exe_ctx_ref,
         m_backend.GetCompilerType().GetBasicTypeFromAST(
             lldb::eBasicTypeObjCID));
   }
@@ -586,7 +586,7 @@ lldb_private::formatters::NSSetMSyntheti
                        process_sp->GetAddressByteSize());
 
     set_item.valobj_sp = CreateValueObjectFromData(
-        idx_name.GetData(), data, m_exe_ctx_ref,
+        idx_name.GetString(), data, m_exe_ctx_ref,
         m_backend.GetCompilerType().GetBasicTypeFromAST(
             lldb::eBasicTypeObjCID));
   }

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Wed Nov 16 15:15:24 2016
@@ -217,7 +217,7 @@ ConstString ObjCLanguage::MethodName::Ge
         strm.PutChar('-');
       strm.Printf("[%s %s]", GetClassName().GetCString(),
                   GetSelector().GetCString());
-      return ConstString(strm.GetString().c_str());
+      return ConstString(strm.GetString());
     }
 
     if (!empty_if_no_category) {
@@ -242,25 +242,25 @@ size_t ObjCLanguage::MethodName::GetFull
       if (category) {
         strm.Printf("%c[%s %s]", is_class_method ? '+' : '-',
                     GetClassName().GetCString(), GetSelector().GetCString());
-        names.push_back(ConstString(strm.GetString().c_str()));
+        names.emplace_back(strm.GetString());
       }
     } else {
       const ConstString &class_name = GetClassName();
       const ConstString &selector = GetSelector();
       strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
-      names.push_back(ConstString(strm.GetString().c_str()));
+      names.emplace_back(strm.GetString());
       strm.Clear();
       strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
-      names.push_back(ConstString(strm.GetString().c_str()));
+      names.emplace_back(strm.GetString());
       strm.Clear();
       if (category) {
         strm.Printf("+[%s(%s) %s]", class_name.GetCString(),
                     category.GetCString(), selector.GetCString());
-        names.push_back(ConstString(strm.GetString().c_str()));
+        names.emplace_back(strm.GetString());
         strm.Clear();
         strm.Printf("-[%s(%s) %s]", class_name.GetCString(),
                     category.GetCString(), selector.GetCString());
-        names.push_back(ConstString(strm.GetString().c_str()));
+        names.emplace_back(strm.GetString());
       }
     }
   }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Wed Nov 16 15:15:24 2016
@@ -147,7 +147,7 @@ clang::QualType AppleObjCTypeEncodingPar
       if (element.name.empty()) {
         StreamString elem_name;
         elem_name.Printf("__unnamed_%u", count);
-        element.name = std::string(elem_name.GetData());
+        element.name = elem_name.GetString();
       }
       ClangASTContext::AddFieldToRecordType(
           union_type, element.name.c_str(),

Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Wed Nov 16 15:15:24 2016
@@ -1566,7 +1566,7 @@ void RenderScriptRuntime::CaptureScriptI
       script->type = ScriptDetails::eScriptC;
       script->cache_dir = cache_dir;
       script->res_name = res_name;
-      script->shared_lib = strm.GetData();
+      script->shared_lib = strm.GetString();
       script->context = addr_t(args[eRsContext]);
     }
 

Modified: lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp (original)
+++ lldb/trunk/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp Wed Nov 16 15:15:24 2016
@@ -184,7 +184,7 @@ HistoryThreads MemoryHistoryASan::GetHis
   options.SetLanguage(eLanguageTypeObjC_plus_plus);
 
   ExpressionResults expr_result = UserExpression::Evaluate(
-      exe_ctx, options, expr.GetData(), "", return_value_sp, eval_error);
+      exe_ctx, options, expr.GetString(), "", return_value_sp, eval_error);
   if (expr_result != eExpressionCompleted) {
     process_sp->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
         "Warning: Cannot evaluate AddressSanitizer expression:\n%s\n",

Modified: lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp Wed Nov 16 15:15:24 2016
@@ -5996,7 +5996,8 @@ bool ObjectFileMachO::SaveCore(const lld
             const size_t LC_THREAD_data_size = LC_THREAD_data.GetSize();
             buffer.PutHex32(LC_THREAD);
             buffer.PutHex32(8 + LC_THREAD_data_size); // cmd + cmdsize + data
-            buffer.Write(LC_THREAD_data.GetData(), LC_THREAD_data_size);
+            buffer.Write(LC_THREAD_data.GetString().data(),
+                         LC_THREAD_data_size);
           }
 
           // Write out all of the segment load commands

Modified: lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp (original)
+++ lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- OperatingSystemPython.cpp --------------------------------*- C++
-//-*-===//
+//===-- OperatingSystemPython.cpp --------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -197,7 +196,7 @@ bool OperatingSystemPython::UpdateThread
     if (log) {
       StreamString strm;
       threads_list->Dump(strm);
-      log->Printf("threads_list = %s", strm.GetString().c_str());
+      log->Printf("threads_list = %s", strm.GetData());
     }
 
     const uint32_t num_threads = threads_list->GetSize();

Modified: lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Android/AdbClient.cpp Wed Nov 16 15:15:24 2016
@@ -360,7 +360,7 @@ Error AdbClient::internalShell(const cha
 
   StreamString adb_command;
   adb_command.Printf("shell:%s", command);
-  error = SendMessage(adb_command.GetData(), false);
+  error = SendMessage(adb_command.GetString(), false);
   if (error.Fail())
     return error;
 

Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Wed Nov 16 15:15:24 2016
@@ -227,7 +227,7 @@ Error PlatformFreeBSD::ResolveExecutable
           error.SetErrorStringWithFormat(
               "'%s' doesn't contain any '%s' platform architectures: %s",
               resolved_module_spec.GetFileSpec().GetPath().c_str(),
-              GetPluginName().GetCString(), arch_names.GetString().c_str());
+              GetPluginName().GetCString(), arch_names.GetData());
         } else {
           error.SetErrorStringWithFormat(
               "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp Wed Nov 16 15:15:24 2016
@@ -163,7 +163,7 @@ Error PlatformKalimba::ResolveExecutable
           error.SetErrorStringWithFormat(
               "'%s' doesn't contain any '%s' platform architectures: %s",
               resolved_module_spec.GetFileSpec().GetPath().c_str(),
-              GetPluginName().GetCString(), arch_names.GetString().c_str());
+              GetPluginName().GetCString(), arch_names.GetData());
         } else {
           error.SetErrorStringWithFormat(
               "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Wed Nov 16 15:15:24 2016
@@ -317,7 +317,7 @@ Error PlatformLinux::ResolveExecutable(
           error.SetErrorStringWithFormat(
               "'%s' doesn't contain any '%s' platform architectures: %s",
               resolved_module_spec.GetFileSpec().GetPath().c_str(),
-              GetPluginName().GetCString(), arch_names.GetString().c_str());
+              GetPluginName().GetCString(), arch_names.GetData());
         } else {
           error.SetErrorStringWithFormat(
               "'%s' is not readable",
@@ -633,7 +633,7 @@ PlatformLinux::DebugProcess(ProcessLaunc
     const FileAction *file_action;
     while ((file_action = launch_info.GetFileActionAtIndex(i++)) != nullptr) {
       file_action->Dump(stream);
-      log->PutCString(stream.GetString().c_str());
+      log->PutCString(stream.GetData());
       stream.Clear();
     }
   }
@@ -713,5 +713,5 @@ ConstString PlatformLinux::GetFullNameFo
 
   StreamString stream;
   stream.Printf("lib%s.so", basename.GetCString());
-  return ConstString(stream.GetData());
+  return ConstString(stream.GetString());
 }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp Wed Nov 16 15:15:24 2016
@@ -230,7 +230,7 @@ Error PlatformAppleTVSimulator::ResolveE
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetString().str().c_str());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp Wed Nov 16 15:15:24 2016
@@ -232,7 +232,7 @@ Error PlatformAppleWatchSimulator::Resol
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetString().str().c_str());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Wed Nov 16 15:15:24 2016
@@ -133,8 +133,8 @@ FileSpecList PlatformDarwin::LocateExecu
                     "%s/../Python/%s.py",
                     symfile_spec.GetDirectory().GetCString(),
                     original_module_basename.c_str());
-                FileSpec script_fspec(path_string.GetData(), true);
-                FileSpec orig_script_fspec(original_path_string.GetData(),
+                FileSpec script_fspec(path_string.GetString(), true);
+                FileSpec orig_script_fspec(original_path_string.GetString(),
                                            true);
 
                 // if we did some replacements of reserved characters, and a
@@ -295,7 +295,7 @@ Error PlatformDarwin::ResolveExecutable(
           error.SetErrorStringWithFormat(
               "'%s' doesn't contain any '%s' platform architectures: %s",
               resolved_module_spec.GetFileSpec().GetPath().c_str(),
-              GetPluginName().GetCString(), arch_names.GetString().c_str());
+              GetPluginName().GetCString(), arch_names.GetData());
         } else {
           error.SetErrorStringWithFormat(
               "'%s' is not readable",
@@ -1779,7 +1779,7 @@ ConstString PlatformDarwin::GetFullNameF
 
   StreamString stream;
   stream.Printf("lib%s.dylib", basename.GetCString());
-  return ConstString(stream.GetData());
+  return ConstString(stream.GetString());
 }
 
 bool PlatformDarwin::GetOSVersion(uint32_t &major, uint32_t &minor,

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp Wed Nov 16 15:15:24 2016
@@ -222,13 +222,13 @@ ConstString PlatformMacOSX::GetSDKDirect
                           versions[1]);
           fspec.SetFile(sdk_path.GetString(), false);
           if (fspec.Exists())
-            return ConstString(sdk_path.GetString().c_str());
+            return ConstString(sdk_path.GetString());
         }
 
         if (!default_xcode_sdk.empty()) {
           fspec.SetFile(default_xcode_sdk, false);
           if (fspec.Exists())
-            return ConstString(default_xcode_sdk.c_str());
+            return ConstString(default_xcode_sdk);
         }
       }
     }

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp Wed Nov 16 15:15:24 2016
@@ -232,7 +232,7 @@ Error PlatformRemoteAppleTV::ResolveExec
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetData());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp Wed Nov 16 15:15:24 2016
@@ -242,7 +242,7 @@ Error PlatformRemoteAppleWatch::ResolveE
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetData());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp Wed Nov 16 15:15:24 2016
@@ -237,7 +237,7 @@ Error PlatformRemoteiOS::ResolveExecutab
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetData());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp Wed Nov 16 15:15:24 2016
@@ -236,7 +236,7 @@ Error PlatformiOSSimulator::ResolveExecu
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetString().str().c_str());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Wed Nov 16 15:15:24 2016
@@ -219,7 +219,7 @@ Error PlatformNetBSD::ResolveExecutable(
           error.SetErrorStringWithFormat(
               "'%s' doesn't contain any '%s' platform architectures: %s",
               resolved_module_spec.GetFileSpec().GetPath().c_str(),
-              GetPluginName().GetCString(), arch_names.GetString().c_str());
+              GetPluginName().GetCString(), arch_names.GetData());
         } else {
           error.SetErrorStringWithFormat(
               "'%s' is not readable",

Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Wed Nov 16 15:15:24 2016
@@ -435,7 +435,7 @@ std::string PlatformPOSIX::GetPlatformSp
   if (GetLocalCacheDirectory() && *GetLocalCacheDirectory())
     stream.Printf("cache dir: %s", GetLocalCacheDirectory());
   if (stream.GetSize())
-    return stream.GetData();
+    return stream.GetString();
   else
     return "";
 }

Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Wed Nov 16 15:15:24 2016
@@ -265,7 +265,7 @@ Error PlatformWindows::ResolveExecutable
           error.SetErrorStringWithFormat(
               "'%s' doesn't contain any '%s' platform architectures: %s",
               resolved_module_spec.GetFileSpec().GetPath().c_str(),
-              GetPluginName().GetCString(), arch_names.GetString().c_str());
+              GetPluginName().GetCString(), arch_names.GetData());
         } else {
           error.SetErrorStringWithFormat(
               "'%s' is not readable",
@@ -603,5 +603,5 @@ ConstString PlatformWindows::GetFullName
 
   StreamString stream;
   stream.Printf("%s.dll", basename.GetCString());
-  return ConstString(stream.GetData());
+  return ConstString(stream.GetString());
 }

Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Wed Nov 16 15:15:24 2016
@@ -147,7 +147,7 @@ Error PlatformRemoteGDBServer::ResolveEx
         error.SetErrorStringWithFormat(
             "'%s' doesn't contain any '%s' platform architectures: %s",
             resolved_module_spec.GetFileSpec().GetPath().c_str(),
-            GetPluginName().GetCString(), arch_names.GetString().c_str());
+            GetPluginName().GetCString(), arch_names.GetData());
       } else {
         error.SetErrorStringWithFormat(
             "'%s' is not readable",
@@ -185,7 +185,7 @@ bool PlatformRemoteGDBServer::GetModuleS
     log->Printf(
         "PlatformRemoteGDBServer::%s - got module info for (%s:%s) : %s",
         __FUNCTION__, module_path.c_str(), arch.GetTriple().getTriple().c_str(),
-        stream.GetString().c_str());
+        stream.GetData());
   }
 
   return true;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Wed Nov 16 15:15:24 2016
@@ -965,7 +965,7 @@ public:
                 packet.PutBytesAsRawHex8(
                     reply.GetDataStart(), reply.GetByteSize(),
                     endian::InlHostByteOrder(), endian::InlHostByteOrder());
-                result.AppendMessage(packet.GetString().c_str());
+                result.AppendMessage(packet.GetString());
                 result.SetStatus(eReturnStatusSuccessFinishResult);
                 return true;
               } else {

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Wed Nov 16 15:15:24 2016
@@ -218,7 +218,7 @@ void RegisterContextLLDB::InitializeZero
       StreamString active_row_strm;
       active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(), &m_thread,
                        m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
-      UnwindLogMsg("%s", active_row_strm.GetString().c_str());
+      UnwindLogMsg("%s", active_row_strm.GetData());
     }
   }
 
@@ -564,7 +564,7 @@ void RegisterContextLLDB::InitializeNonZ
       StreamString active_row_strm;
       active_row->Dump(active_row_strm, m_fast_unwind_plan_sp.get(), &m_thread,
                        m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
-      UnwindLogMsg("active row: %s", active_row_strm.GetString().c_str());
+      UnwindLogMsg("active row: %s", active_row_strm.GetData());
     }
   } else {
     m_full_unwind_plan_sp = GetFullUnwindPlanForFrame();
@@ -577,7 +577,7 @@ void RegisterContextLLDB::InitializeNonZ
         active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(),
                          &m_thread,
                          m_start_pc.GetLoadAddress(exe_ctx.GetTargetPtr()));
-        UnwindLogMsg("active row: %s", active_row_strm.GetString().c_str());
+        UnwindLogMsg("active row: %s", active_row_strm.GetData());
       }
     }
   }

Modified: lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/StopInfoMachException.cpp Wed Nov 16 15:15:24 2016
@@ -306,7 +306,7 @@ const char *StopInfoMachException::GetDe
     if (m_exc_data_count > 0)
       strm.PutChar(')');
 
-    m_description.swap(strm.GetString());
+    m_description = strm.GetString();
   }
   return m_description.c_str();
 }

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Wed Nov 16 15:15:24 2016
@@ -200,7 +200,9 @@ GDBRemoteCommunication::SendPacketNoLock
 
     Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PACKETS));
     ConnectionStatus status = eConnectionStatusSuccess;
-    const char *packet_data = packet.GetData();
+    // TODO: Don't shimmy through a std::string, just use StringRef.
+    std::string packet_str = packet.GetString();
+    const char *packet_data = packet_str.c_str();
     const size_t packet_length = packet.GetSize();
     size_t bytes_written = Write(packet_data, packet_length, status, NULL);
     if (log) {
@@ -236,7 +238,7 @@ GDBRemoteCommunication::SendPacketNoLock
           strm.Printf("\\x%2.2x", *p);
         // Print the checksum
         strm.Printf("%*s", (int)3, p);
-        log->PutCString(strm.GetString().c_str());
+        log->PutString(strm.GetString());
       } else
         log->Printf("<%4" PRIu64 "> send packet: %.*s", (uint64_t)bytes_written,
                     (int)packet_length, packet_data);
@@ -867,7 +869,7 @@ GDBRemoteCommunication::CheckForPacket(c
           // Packet footer...
           strm.Printf("%c%c%c", m_bytes[total_length - 3],
                       m_bytes[total_length - 2], m_bytes[total_length - 1]);
-          log->PutCString(strm.GetString().c_str());
+          log->PutString(strm.GetString());
         } else {
           if (CompressionIsEnabled())
             log->Printf("<%4" PRIu64 ":%" PRIu64 "> read packet: %.*s",
@@ -1250,7 +1252,7 @@ Error GDBRemoteCommunication::StartDebug
       Platform *const platform = nullptr;
       launch_info.Dump(string_stream, platform);
       log->Printf("launch info for gdb-remote stub:\n%s",
-                  string_stream.GetString().c_str());
+                  string_stream.GetData());
     }
     error = Host::LaunchProcess(launch_info);
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Nov 16 15:15:24 2016
@@ -349,7 +349,7 @@ void GDBRemoteCommunicationClient::GetRe
   }
 
   StringExtractorGDBRemote response;
-  if (SendPacketAndWaitForResponse(packet.GetData(), response,
+  if (SendPacketAndWaitForResponse(packet.GetString(), response,
                                    /*send_async=*/false) ==
       PacketResult::Success) {
     const char *response_cstr = response.GetStringRef().c_str();
@@ -518,7 +518,7 @@ GDBRemoteCommunicationClient::SendThread
             GDBR_LOG_PROCESS | GDBR_LOG_PACKETS))
       log->Printf("GDBRemoteCommunicationClient::%s: Didn't get sequence mutex "
                   "for %s packet.",
-                  __FUNCTION__, payload.GetString().c_str());
+                  __FUNCTION__, payload.GetData());
     return PacketResult::ErrorNoSequenceLock;
   }
 
@@ -2685,15 +2685,15 @@ Error GDBRemoteCommunicationClient::Make
   stream.PutHex32(file_permissions);
   stream.PutChar(',');
   stream.PutCStringAsRawHex8(path.c_str());
-  const char *packet = stream.GetData();
+  llvm::StringRef packet = stream.GetString();
   StringExtractorGDBRemote response;
 
   if (SendPacketAndWaitForResponse(packet, response, false) !=
       PacketResult::Success)
-    return Error("failed to send '%s' packet", packet);
+    return Error("failed to send '%s' packet", packet.str().c_str());
 
   if (response.GetChar() != 'F')
-    return Error("invalid response to '%s' packet", packet);
+    return Error("invalid response to '%s' packet", packet.str().c_str());
 
   return Error(response.GetU32(UINT32_MAX), eErrorTypePOSIX);
 }
@@ -2706,15 +2706,15 @@ Error GDBRemoteCommunicationClient::SetF
   stream.PutHex32(file_permissions);
   stream.PutChar(',');
   stream.PutCStringAsRawHex8(path.c_str());
-  const char *packet = stream.GetData();
+  llvm::StringRef packet = stream.GetString();
   StringExtractorGDBRemote response;
 
   if (SendPacketAndWaitForResponse(packet, response, false) !=
       PacketResult::Success)
-    return Error("failed to send '%s' packet", packet);
+    return Error("failed to send '%s' packet", stream.GetData());
 
   if (response.GetChar() != 'F')
-    return Error("invalid response to '%s' packet", packet);
+    return Error("invalid response to '%s' packet", stream.GetData());
 
   return Error(response.GetU32(UINT32_MAX), eErrorTypePOSIX);
 }
@@ -2800,7 +2800,7 @@ Error GDBRemoteCommunicationClient::GetF
       PacketResult::Success) {
     if (response.GetChar() != 'F') {
       error.SetErrorStringWithFormat("invalid response to '%s' packet",
-                                     stream.GetString().c_str());
+                                     stream.GetData());
     } else {
       const uint32_t mode = response.GetS32(-1);
       if (static_cast<int32_t>(mode) == -1) {
@@ -2818,7 +2818,7 @@ Error GDBRemoteCommunicationClient::GetF
     }
   } else {
     error.SetErrorStringWithFormat("failed to send '%s' packet",
-                                   stream.GetString().c_str());
+                                   stream.GetData());
   }
   return error;
 }
@@ -3258,7 +3258,7 @@ GDBRemoteCommunicationClient::GetModules
   unescaped_payload.PutCString("jModulesInfo:");
   module_array_sp->Write(unescaped_payload);
   StreamGDBRemote payload;
-  payload.PutEscapedBytes(unescaped_payload.GetData(),
+  payload.PutEscapedBytes(unescaped_payload.GetString().data(),
                           unescaped_payload.GetSize());
 
   StringExtractorGDBRemote response;
@@ -3569,7 +3569,7 @@ GDBRemoteCommunicationClient::GetSupport
       m_supported_async_json_packets_sp->Dump(stream);
       log->Printf("GDBRemoteCommunicationClient::%s(): supported async "
                   "JSON packets: %s",
-                  __FUNCTION__, stream.GetString().c_str());
+                  __FUNCTION__, stream.GetData());
     }
   }
 
@@ -3600,7 +3600,7 @@ Error GDBRemoteCommunicationClient::Conf
     unescaped_stream.Flush();
 
     // Add it to the stream in escaped fashion.
-    stream.PutEscapedBytes(unescaped_stream.GetData(),
+    stream.PutEscapedBytes(unescaped_stream.GetString().data(),
                            unescaped_stream.GetSize());
   }
   stream.Flush();

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Wed Nov 16 15:15:24 2016
@@ -1174,7 +1174,8 @@ GDBRemoteCommunicationServerCommon::Hand
   StreamString response;
   response_array_sp->Write(response);
   StreamGDBRemote escaped_response;
-  escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
+  escaped_response.PutEscapedBytes(response.GetString().data(),
+                                   response.GetSize());
   return SendPacketNoLock(escaped_response.GetString());
 }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Wed Nov 16 15:15:24 2016
@@ -246,7 +246,8 @@ GDBRemoteCommunicationServerPlatform::Ha
   server_list.Write(response);
 
   StreamGDBRemote escaped_response;
-  escaped_response.PutEscapedBytes(response.GetData(), response.GetSize());
+  escaped_response.PutEscapedBytes(response.GetString().data(),
+                                   response.GetSize());
   return SendPacketNoLock(escaped_response.GetString());
 }
 

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Nov 16 15:15:24 2016
@@ -1226,7 +1226,7 @@ Error ProcessGDBRemote::DoAttachToProces
 
       m_async_broadcaster.BroadcastEvent(
           eBroadcastBitAsyncContinue,
-          new EventDataBytes(packet.GetData(), packet.GetSize()));
+          new EventDataBytes(packet.GetString().data(), packet.GetSize()));
 
     } else
       SetExitStatus(-1, error.AsCString());
@@ -1330,7 +1330,7 @@ Error ProcessGDBRemote::DoResume() {
         }
 
         if (continue_packet_error)
-          continue_packet.GetString().clear();
+          continue_packet.Clear();
       }
     } else
       continue_packet_error = true;
@@ -1455,7 +1455,7 @@ Error ProcessGDBRemote::DoResume() {
 
       m_async_broadcaster.BroadcastEvent(
           eBroadcastBitAsyncContinue,
-          new EventDataBytes(continue_packet.GetData(),
+          new EventDataBytes(continue_packet.GetString().data(),
                              continue_packet.GetSize()));
 
       if (listener_sp->WaitForEvent(std::chrono::seconds(5), event_sp) ==
@@ -2812,10 +2812,10 @@ size_t ProcessGDBRemote::DoWriteMemory(a
     else
       error.SetErrorStringWithFormat(
           "unexpected response to GDB server memory write packet '%s': '%s'",
-          packet.GetString().c_str(), response.GetStringRef().c_str());
+          packet.GetData(), response.GetStringRef().c_str());
   } else {
     error.SetErrorStringWithFormat("failed to send packet: '%s'",
-                                   packet.GetString().c_str());
+                                   packet.GetData());
   }
   return 0;
 }
@@ -4043,8 +4043,7 @@ bool ProcessGDBRemote::GetModuleSpec(con
     module_spec.Dump(stream);
     log->Printf("ProcessGDBRemote::%s - got module info for (%s:%s) : %s",
                 __FUNCTION__, module_file_spec.GetPath().c_str(),
-                arch.GetTriple().getTriple().c_str(),
-                stream.GetString().c_str());
+                arch.GetTriple().getTriple().c_str(), stream.GetData());
   }
 
   m_cached_module_specs[key] = module_spec;
@@ -4836,7 +4835,7 @@ ParseStructuredDataPacket(llvm::StringRe
       json_str.Flush();
       log->Printf("ProcessGDBRemote::%s() "
                   "received Async StructuredData packet: %s",
-                  __FUNCTION__, json_str.GetString().c_str());
+                  __FUNCTION__, json_str.GetData());
     } else {
       log->Printf("ProcessGDBRemote::%s"
                   "() received StructuredData packet:"
@@ -5083,7 +5082,7 @@ public:
           packet.GetString(), response, send_async);
       result.SetStatus(eReturnStatusSuccessFinishResult);
       Stream &output_strm = result.GetOutputStream();
-      output_strm.Printf("  packet: %s\n", packet.GetString().c_str());
+      output_strm.Printf("  packet: %s\n", packet.GetData());
       const std::string &response_str = response.GetStringRef();
 
       if (response_str.empty())

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Wed Nov 16 15:15:24 2016
@@ -1438,7 +1438,7 @@ bool ScriptInterpreterPython::GenerateTy
   // Create the function name & definition string.
 
   sstr.Printf("class %s:", auto_generated_class_name.c_str());
-  auto_generated_class.AppendString(sstr.GetData());
+  auto_generated_class.AppendString(sstr.GetString());
 
   // Wrap everything up inside the class, increasing the indentation.
   // we don't need to play any fancy indentation tricks here because there is no
@@ -1446,7 +1446,7 @@ bool ScriptInterpreterPython::GenerateTy
   for (int i = 0; i < num_lines; ++i) {
     sstr.Clear();
     sstr.Printf("     %s", user_input.GetStringAtIndex(i));
-    auto_generated_class.AppendString(sstr.GetData());
+    auto_generated_class.AppendString(sstr.GetString());
   }
 
   // Verify that the results are valid Python.
@@ -2873,7 +2873,7 @@ bool ScriptInterpreterPython::GetDocumen
     StreamString str_stream;
     str_stream.Printf(
         "Function %s was not found. Containing module might be missing.", item);
-    dest.assign(str_stream.GetData());
+    dest = str_stream.GetString();
     return false;
   }
 }

Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp (original)
+++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp Wed Nov 16 15:15:24 2016
@@ -796,7 +796,7 @@ protected:
                   " the property and relaunch the target binary to have"
                   " these messages excluded.",
                   source_name, source_name);
-    result.AppendWarning(stream.GetString().c_str());
+    result.AppendWarning(stream.GetString());
   }
 
   bool DoExecute(Args &command, CommandReturnObject &result) override {
@@ -1107,7 +1107,7 @@ bool RunEnableCommand(CommandInterpreter
 
   // Run the command.
   CommandReturnObject return_object;
-  interpreter.HandleCommand(command_stream.GetString().c_str(), eLazyBoolNo,
+  interpreter.HandleCommand(command_stream.GetData(), eLazyBoolNo,
                             return_object);
   return return_object.Succeeded();
 }
@@ -1173,7 +1173,7 @@ void StructuredDataDarwinLog::HandleArri
     else
       json_stream.PutCString("<null>");
     log->Printf("StructuredDataDarwinLog::%s() called with json: %s",
-                __FUNCTION__, json_stream.GetString().c_str());
+                __FUNCTION__, json_stream.GetData());
   }
 
   // Ignore empty structured data.
@@ -1222,8 +1222,7 @@ static void SetErrorWithJSON(Error &erro
   object.Dump(object_stream);
   object_stream.Flush();
 
-  error.SetErrorStringWithFormat("%s: %s", message,
-                                 object_stream.GetString().c_str());
+  error.SetErrorStringWithFormat("%s: %s", message, object_stream.GetData());
 }
 
 Error StructuredDataDarwinLog::GetDescription(
@@ -1862,10 +1861,9 @@ StructuredDataDarwinLog::DumpHeader(Stre
   }
   stream.PutCString("] ");
 
-  auto &result = stream.GetString();
-  output_stream.PutCString(result);
+  output_stream.PutCString(stream.GetString());
 
-  return result.size();
+  return stream.GetSize();
 }
 
 size_t StructuredDataDarwinLog::HandleDisplayOfEvent(

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Wed Nov 16 15:15:24 2016
@@ -2601,7 +2601,7 @@ Function *DWARFASTParserClang::ParseFunc
         if (type_quals & clang::Qualifiers::Const)
           sstr << " const";
 
-        func_name.SetValue(ConstString(sstr.GetData()), false);
+        func_name.SetValue(ConstString(sstr.GetString()), false);
       } else
         func_name.SetValue(ConstString(name), false);
 
@@ -2815,7 +2815,7 @@ bool DWARFASTParserClang::ParseChildMemb
 
             ss.Printf("set%c%s:", toupper(prop_name[0]), &prop_name[1]);
 
-            fixed_setter.SetCString(ss.GetData());
+            fixed_setter.SetString(ss.GetString());
             prop_setter_name = fixed_setter.GetCString();
           }
         }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed Nov 16 15:15:24 2016
@@ -265,7 +265,7 @@ size_t DWARFCompileUnit::ExtractDIEsIfNe
       strm.Printf("error: no DIE for compile unit");
     else
       m_die_array[0].Dump(m_dwarf2Data, this, strm, UINT32_MAX);
-    verbose_log->PutCString(strm.GetString().c_str());
+    verbose_log->PutString(strm.GetString());
   }
 
   if (!m_dwo_symbol_file)

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Nov 16 15:15:24 2016
@@ -3918,7 +3918,7 @@ VariableSP SymbolFileDWARF::ParseVariabl
                                             NULL);
             GetObjectFile()->GetModule()->ReportError(
                 "0x%8.8x: %s has an invalid location: %s", die.GetOffset(),
-                die.GetTagAsCString(), strm.GetString().c_str());
+                die.GetTagAsCString(), strm.GetData());
           }
         }
         SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();

Modified: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- UnwindAssemblyInstEmulation.cpp --------------------------*- C++
-//-*-===//
+//===-- UnwindAssemblyInstEmulation.cpp --------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -221,7 +220,7 @@ bool UnwindAssemblyInstEmulation::GetNon
               FormatEntity::Parse("${frame.pc}: ", format);
               inst->Dump(&strm, inst_list.GetMaxOpcocdeByteSize(), show_address,
                          show_bytes, NULL, NULL, NULL, &format, 0);
-              log->PutCString(strm.GetData());
+              log->PutString(strm.GetString());
             }
 
             last_condition = m_inst_emulator_ap->GetInstructionCondition();
@@ -276,7 +275,7 @@ bool UnwindAssemblyInstEmulation::GetNon
       strm.Printf("Resulting unwind rows for [0x%" PRIx64 " - 0x%" PRIx64 "):",
                   base_addr, base_addr + range.GetByteSize());
       unwind_plan.Dump(strm, nullptr, base_addr);
-      log->PutCString(strm.GetData());
+      log->PutString(strm.GetString());
     }
     return unwind_plan.GetRowCount() > 0;
   }
@@ -380,7 +379,7 @@ size_t UnwindAssemblyInstEmulation::Read
         ", dst = %p, dst_len = %" PRIu64 ", context = ",
         addr, dst, (uint64_t)dst_len);
     context.Dump(strm, instruction);
-    log->PutCString(strm.GetData());
+    log->PutString(strm.GetString());
   }
   memset(dst, 0, dst_len);
   return dst_len;
@@ -412,7 +411,7 @@ size_t UnwindAssemblyInstEmulation::Writ
     data.Dump(&strm, 0, eFormatBytes, 1, dst_len, UINT32_MAX, addr, 0, 0);
     strm.PutCString(", context = ");
     context.Dump(strm, instruction);
-    log->PutCString(strm.GetData());
+    log->PutString(strm.GetString());
   }
 
   const bool cant_replace = false;
@@ -493,7 +492,7 @@ bool UnwindAssemblyInstEmulation::ReadRe
                 "synthetic_value = %i, value = ",
                 reg_info->name, synthetic);
     reg_value.Dump(&strm, reg_info, false, false, eFormatDefault);
-    log->PutCString(strm.GetData());
+    log->PutString(strm.GetString());
   }
   return true;
 }
@@ -521,7 +520,7 @@ bool UnwindAssemblyInstEmulation::WriteR
     reg_value.Dump(&strm, reg_info, false, false, eFormatDefault);
     strm.PutCString(", context = ");
     context.Dump(strm, instruction);
-    log->PutCString(strm.GetData());
+    log->PutString(strm.GetString());
   }
 
   SetRegisterValue(*reg_info, reg_value);

Modified: lldb/trunk/source/Symbol/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ObjectFile.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ObjectFile.cpp (original)
+++ lldb/trunk/source/Symbol/ObjectFile.cpp Wed Nov 16 15:15:24 2016
@@ -646,5 +646,5 @@ ConstString ObjectFile::GetNextSynthetic
   ConstString file_name = GetModule()->GetFileSpec().GetFilename();
   ss.Printf("___lldb_unnamed_symbol%u$$%s", ++m_synthetic_symbol_idx,
             file_name.GetCString());
-  return ConstString(ss.GetData());
+  return ConstString(ss.GetString());
 }

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Wed Nov 16 15:15:24 2016
@@ -388,10 +388,10 @@ void ProcessInstanceInfo::DumpAsTableRow
       else
         s.Printf("%-10u ", m_egid);
 
-      s.Printf("%-24s ", arch_strm.GetString().c_str());
+      s.Printf("%-24s ", arch_strm.GetData());
     } else {
       s.Printf("%-10s %-24s ", platform->GetUserName(m_euid),
-               arch_strm.GetString().c_str());
+               arch_strm.GetData());
     }
 
     if (verbose || show_args) {
@@ -5540,7 +5540,7 @@ Process::RunThreadPlan(ExecutionContext
       StreamString s;
       s.PutCString("Thread state after unsuccessful completion: \n");
       thread->GetStackFrameStatus(s, 0, UINT32_MAX, true, UINT32_MAX);
-      log->PutCString(s.GetData());
+      log->PutString(s.GetString());
     }
     // Restore the thread state if we are going to discard the plan execution.
     // There are three cases where this

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Wed Nov 16 15:15:24 2016
@@ -639,16 +639,14 @@ ValueObjectSP StackFrame::GetValueForVar
                   error.SetErrorStringWithFormat(
                       "\"%s\" is a pointer and . was used to attempt to access "
                       "\"%s\". Did you mean \"%s->%s\"?",
-                      var_expr_path_strm.GetString().c_str(),
-                      child_name.GetCString(),
-                      var_expr_path_strm.GetString().c_str(), var_path.c_str());
+                      var_expr_path_strm.GetData(), child_name.GetCString(),
+                      var_expr_path_strm.GetData(), var_path.c_str());
                 else
                   error.SetErrorStringWithFormat(
                       "\"%s\" is not a pointer and -> was used to attempt to "
                       "access \"%s\". Did you mean \"%s.%s\"?",
-                      var_expr_path_strm.GetString().c_str(),
-                      child_name.GetCString(),
-                      var_expr_path_strm.GetString().c_str(), var_path.c_str());
+                      var_expr_path_strm.GetData(), child_name.GetCString(),
+                      var_expr_path_strm.GetData(), var_path.c_str());
                 return ValueObjectSP();
               }
             }
@@ -681,11 +679,11 @@ ValueObjectSP StackFrame::GetValueForVar
                         "\"%s\" is not a member of \"(%s) %s\"",
                         child_name.GetCString(),
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                   } else {
                     error.SetErrorStringWithFormat(
                         "incomplete expression path after \"%s\" in \"%s\"",
-                        var_expr_path_strm.GetString().c_str(), var_expr_cstr);
+                        var_expr_path_strm.GetData(), var_expr_cstr);
                   }
                 }
                 return ValueObjectSP();
@@ -726,7 +724,7 @@ ValueObjectSP StackFrame::GetValueForVar
                     error.SetErrorStringWithFormat(
                         "could not dereference \"(%s) %s\"",
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                     return ValueObjectSP();
                   }
                   valobj_sp = temp;
@@ -745,7 +743,7 @@ ValueObjectSP StackFrame::GetValueForVar
                     error.SetErrorStringWithFormat(
                         "could not get item 0 for \"(%s) %s\"",
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                     return ValueObjectSP();
                   }
                   valobj_sp = temp;
@@ -767,7 +765,7 @@ ValueObjectSP StackFrame::GetValueForVar
                         "\"(%s) %s\" is an Objective-C pointer, and cannot be "
                         "subscripted",
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
 
                     return ValueObjectSP();
                   } else if (is_objc_pointer) {
@@ -782,7 +780,7 @@ ValueObjectSP StackFrame::GetValueForVar
                       error.SetErrorStringWithFormat(
                           "\"(%s) %s\" is not an array type",
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                     } else if (
                         static_cast<uint32_t>(child_index) >=
                         synthetic
@@ -792,7 +790,7 @@ ValueObjectSP StackFrame::GetValueForVar
                           "array index %ld is not valid for \"(%s) %s\"",
                           child_index,
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                     } else {
                       child_valobj_sp =
                           synthetic->GetChildAtIndex(child_index, true);
@@ -802,7 +800,7 @@ ValueObjectSP StackFrame::GetValueForVar
                             "array index %ld is not valid for \"(%s) %s\"",
                             child_index, valobj_sp->GetTypeName().AsCString(
                                              "<invalid type>"),
-                            var_expr_path_strm.GetString().c_str());
+                            var_expr_path_strm.GetData());
                       }
                     }
                   } else {
@@ -815,7 +813,7 @@ ValueObjectSP StackFrame::GetValueForVar
                           "\"(%s) %s\"",
                           child_index,
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                     }
                   }
                 } else if (valobj_sp->GetCompilerType().IsArrayType(
@@ -836,7 +834,7 @@ ValueObjectSP StackFrame::GetValueForVar
                         "array index %ld is not valid for \"(%s) %s\"",
                         child_index,
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                   }
                 } else if (valobj_sp->GetCompilerType().IsScalarType()) {
                   // this is a bitfield asking to display just one bit
@@ -848,7 +846,7 @@ ValueObjectSP StackFrame::GetValueForVar
                         "bitfield range %ld-%ld is not valid for \"(%s) %s\"",
                         child_index, child_index,
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                   }
                 } else {
                   ValueObjectSP synthetic = valobj_sp->GetSyntheticValue();
@@ -861,7 +859,7 @@ ValueObjectSP StackFrame::GetValueForVar
                     error.SetErrorStringWithFormat(
                         "\"(%s) %s\" is not an array type",
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                   } else if (
                       static_cast<uint32_t>(child_index) >=
                       synthetic
@@ -871,7 +869,7 @@ ValueObjectSP StackFrame::GetValueForVar
                         "array index %ld is not valid for \"(%s) %s\"",
                         child_index,
                         valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                        var_expr_path_strm.GetString().c_str());
+                        var_expr_path_strm.GetData());
                   } else {
                     child_valobj_sp =
                         synthetic->GetChildAtIndex(child_index, true);
@@ -881,7 +879,7 @@ ValueObjectSP StackFrame::GetValueForVar
                           "array index %ld is not valid for \"(%s) %s\"",
                           child_index,
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                     }
                   }
                 }
@@ -932,7 +930,7 @@ ValueObjectSP StackFrame::GetValueForVar
                       error.SetErrorStringWithFormat(
                           "could not dereference \"(%s) %s\"",
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                       return ValueObjectSP();
                     }
                     valobj_sp = temp;
@@ -954,7 +952,7 @@ ValueObjectSP StackFrame::GetValueForVar
                       error.SetErrorStringWithFormat(
                           "could not get item 0 for \"(%s) %s\"",
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                       return ValueObjectSP();
                     }
                     valobj_sp = temp;
@@ -977,7 +975,7 @@ ValueObjectSP StackFrame::GetValueForVar
                   final_index,
                                                           valobj_sp->GetTypeName().AsCString("<invalid
                   type>"),
-                                                          var_expr_path_strm.GetString().c_str());
+                                                          var_expr_path_strm.c_str());
                       }
                   }*/
 
@@ -990,7 +988,7 @@ ValueObjectSP StackFrame::GetValueForVar
                           "bitfield range %ld-%ld is not valid for \"(%s) %s\"",
                           child_index, final_index,
                           valobj_sp->GetTypeName().AsCString("<invalid type>"),
-                          var_expr_path_strm.GetString().c_str());
+                          var_expr_path_strm.GetData());
                     }
                   }
                 }
@@ -1017,7 +1015,7 @@ ValueObjectSP StackFrame::GetValueForVar
             } else {
               error.SetErrorStringWithFormat(
                   "invalid square bracket encountered after \"%s\" in \"%s\"",
-                  var_expr_path_strm.GetString().c_str(), var_path.c_str());
+                  var_expr_path_strm.GetData(), var_path.c_str());
             }
             return ValueObjectSP();
 
@@ -1027,7 +1025,7 @@ ValueObjectSP StackFrame::GetValueForVar
               valobj_sp->GetExpressionPath(var_expr_path_strm, false);
               error.SetErrorStringWithFormat(
                   "unexpected char '%c' encountered after \"%s\" in \"%s\"",
-                  separator_type, var_expr_path_strm.GetString().c_str(),
+                  separator_type, var_expr_path_strm.GetData(),
                   var_path.c_str());
 
               return ValueObjectSP();
@@ -1753,7 +1751,7 @@ void StackFrame::DumpUsingSettingsFormat
     frame_format = target->GetDebugger().GetFrameFormat();
   if (frame_format && FormatEntity::Format(*frame_format, s, &m_sc, &exe_ctx,
                                            nullptr, nullptr, false, false)) {
-    strm->Write(s.GetData(), s.GetSize());
+    strm->PutCString(s.GetString());
   } else {
     Dump(strm, true, false);
     strm->EOL();
@@ -1790,8 +1788,10 @@ void StackFrame::UpdateCurrentFrameFromP
          prev_frame.GetStackID()); // TODO: remove this after some testing
   m_variable_list_sp = prev_frame.m_variable_list_sp;
   m_variable_list_value_objects.Swap(prev_frame.m_variable_list_value_objects);
-  if (!m_disassembly.GetString().empty())
-    m_disassembly.GetString().swap(m_disassembly.GetString());
+  if (!m_disassembly.GetString().empty()) {
+    m_disassembly.Clear();
+    m_disassembly.PutCString(prev_frame.m_disassembly.GetString());
+  }
 }
 
 void StackFrame::UpdatePreviousFrameFromCurrentFrame(StackFrame &curr_frame) {

Modified: lldb/trunk/source/Target/StopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StopInfo.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/StopInfo.cpp (original)
+++ lldb/trunk/source/Target/StopInfo.cpp Wed Nov 16 15:15:24 2016
@@ -216,7 +216,7 @@ public:
 
           strm.Printf("breakpoint ");
           bp_site_sp->GetDescription(&strm, eDescriptionLevelBrief);
-          m_description.swap(strm.GetString());
+          m_description = strm.GetString();
         } else {
           StreamString strm;
           if (m_break_id != LLDB_INVALID_BREAK_ID) {
@@ -249,7 +249,7 @@ public:
                         " which has been deleted - was at 0x%" PRIx64,
                         m_value, m_address);
 
-          m_description.swap(strm.GetString());
+          m_description = strm.GetString();
         }
       }
     }
@@ -610,7 +610,7 @@ public:
     if (m_description.empty()) {
       StreamString strm;
       strm.Printf("watchpoint %" PRIi64, m_value);
-      m_description.swap(strm.GetString());
+      m_description = strm.GetString();
     }
     return m_description.c_str();
   }
@@ -950,7 +950,7 @@ public:
           strm.Printf("signal %s", signal_name);
         else
           strm.Printf("signal %" PRIi64, m_value);
-        m_description.swap(strm.GetString());
+        m_description = strm.GetString();
       }
     }
     return m_description.c_str();
@@ -1021,7 +1021,7 @@ public:
     if (m_description.empty()) {
       StreamString strm;
       m_plan_sp->GetDescription(&strm, eDescriptionLevelBrief);
-      m_description.swap(strm.GetString());
+      m_description = strm.GetString();
     }
     return m_description.c_str();
   }

Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Nov 16 15:15:24 2016
@@ -3109,7 +3109,7 @@ void Target::StopHook::GetDescription(St
     s->Indent("Thread:\n");
     m_thread_spec_ap->GetDescription(&tmp, level);
     s->SetIndentLevel(indent_level + 4);
-    s->Indent(tmp.GetData());
+    s->Indent(tmp.GetString());
     s->PutCString("\n");
     s->SetIndentLevel(indent_level + 2);
   }

Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Wed Nov 16 15:15:24 2016
@@ -152,8 +152,7 @@ Error TargetList::CreateTargetInternal(
               error.SetErrorStringWithFormat(
                   "the specified architecture '%s' is not compatible with '%s' "
                   "in '%s'",
-                  platform_arch_strm.GetString().c_str(),
-                  module_arch_strm.GetString().c_str(),
+                  platform_arch_strm.GetData(), module_arch_strm.GetData(),
                   module_spec.GetFileSpec().GetPath().c_str());
               return error;
             }
@@ -254,7 +253,7 @@ Error TargetList::CreateTargetInternal(
             }
             error_strm.Printf(
                 "), use the --platform option to specify a platform");
-            error.SetErrorString(error_strm.GetString().c_str());
+            error.SetErrorString(error_strm.GetString());
             return error;
           }
         }

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Wed Nov 16 15:15:24 2016
@@ -1747,8 +1747,7 @@ Error Thread::JumpToLine(const FileSpec
       StreamString sstr;
       DumpAddressList(sstr, outside_function, target);
       return Error("%s:%i has multiple candidate locations:\n%s",
-                   file.GetFilename().AsCString(), line,
-                   sstr.GetString().c_str());
+                   file.GetFilename().AsCString(), line, sstr.GetData());
     }
   }
 

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Wed Nov 16 15:15:24 2016
@@ -192,7 +192,7 @@ void ThreadPlanCallFunction::ReportRegis
         strm.EOL();
       }
     }
-    log->PutCString(strm.GetData());
+    log->PutString(strm.GetString());
   }
 }
 
@@ -257,7 +257,7 @@ bool ThreadPlanCallFunction::ValidatePla
   if (!m_valid) {
     if (error) {
       if (m_constructor_errors.GetSize() > 0)
-        error->PutCString(m_constructor_errors.GetData());
+        error->PutCString(m_constructor_errors.GetString());
       else
         error->PutCString("Unknown error");
     }

Modified: lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallUserExpression.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- ThreadPlanCallUserExpression.cpp ------------------------------*- C++
-//-*-===//
+//===-- ThreadPlanCallUserExpression.cpp -------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //

Modified: lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverRange.cpp Wed Nov 16 15:15:24 2016
@@ -422,7 +422,7 @@ bool ThreadPlanStepOverRange::DoWillResu
                   "Stepping over inlined function \"%s\" in inlined stack: ",
                   name);
               DumpRanges(&s);
-              log->PutCString(s.GetData());
+              log->PutString(s.GetString());
             }
           }
         }

Modified: lldb/trunk/tools/argdumper/argdumper.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/argdumper/argdumper.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/tools/argdumper/argdumper.cpp (original)
+++ lldb/trunk/tools/argdumper/argdumper.cpp Wed Nov 16 15:15:24 2016
@@ -1,5 +1,4 @@
-//===-- argdumper.cpp --------------------------------------------*- C++
-//-*-===//
+//===-- argdumper.cpp --------------------------------------------*- C++-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //

Modified: lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp?rev=287152&r1=287151&r2=287152&view=diff
==============================================================================
--- lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp (original)
+++ lldb/trunk/unittests/ScriptInterpreter/Python/PythonDataObjectsTests.cpp Wed Nov 16 15:15:24 2016
@@ -255,17 +255,17 @@ TEST_F(PythonDataObjectsTest, TestPython
   // Test that creating a `PythonString` object works correctly with the
   // string constructor
   PythonString constructed_string(test_string2);
-  EXPECT_STREQ(test_string2, constructed_string.GetString().str().c_str());
+  EXPECT_STREQ(test_string2, constructed_string.c_str());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonStringToStr) {
   const char *c_str = "PythonDataObjectsTest::TestPythonStringToStr";
 
   PythonString str(c_str);
-  EXPECT_STREQ(c_str, str.GetString().str().c_str());
+  EXPECT_STREQ(c_str, str.c_str());
 
   PythonString str_str = str.Str();
-  EXPECT_STREQ(c_str, str_str.GetString().str().c_str());
+  EXPECT_STREQ(c_str, str_str.c_str());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonIntegerToStr) {}
@@ -315,7 +315,7 @@ TEST_F(PythonDataObjectsTest, TestPython
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
   EXPECT_EQ(long_value0, chk_int.GetInteger());
-  EXPECT_STREQ(string_value1, chk_str.GetString().str().c_str());
+  EXPECT_STREQ(string_value1, chk_str.c_str());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonListManipulation) {
@@ -343,7 +343,7 @@ TEST_F(PythonDataObjectsTest, TestPython
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
   EXPECT_EQ(long_value0, chk_int.GetInteger());
-  EXPECT_STREQ(string_value1, chk_str.GetString().str().c_str());
+  EXPECT_STREQ(string_value1, chk_str.c_str());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonListToStructuredList) {
@@ -466,7 +466,7 @@ TEST_F(PythonDataObjectsTest, TestPython
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
   EXPECT_EQ(value_0, chk_int.GetInteger());
-  EXPECT_STREQ(value_1, chk_str.GetString().str().c_str());
+  EXPECT_STREQ(value_1, chk_str.c_str());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonDictionaryManipulation) {
@@ -503,7 +503,7 @@ TEST_F(PythonDataObjectsTest, TestPython
   PythonString chk_str(PyRefType::Borrowed, chk_value2.get());
 
   EXPECT_EQ(value_0, chk_int.GetInteger());
-  EXPECT_STREQ(value_1, chk_str.GetString().str().c_str());
+  EXPECT_STREQ(value_1, chk_str.c_str());
 }
 
 TEST_F(PythonDataObjectsTest, TestPythonDictionaryToStructuredDictionary) {




More information about the lldb-commits mailing list