[Lldb-commits] [lldb] r230005 - Refactor OptionValue::SetValueFromCString to use llvm::StringRef

Pavel Labath labath at google.com
Fri Feb 20 03:15:00 PST 2015


Author: labath
Date: Fri Feb 20 05:14:59 2015
New Revision: 230005

URL: http://llvm.org/viewvc/llvm-project?rev=230005&view=rev
Log:
Refactor OptionValue::SetValueFromCString to use llvm::StringRef

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D7676

Modified:
    lldb/trunk/include/lldb/Interpreter/OptionValue.h
    lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
    lldb/trunk/include/lldb/Interpreter/OptionValueArray.h
    lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
    lldb/trunk/include/lldb/Interpreter/OptionValueChar.h
    lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h
    lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
    lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
    lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
    lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h
    lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
    lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h
    lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
    lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
    lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h
    lldb/trunk/include/lldb/Interpreter/OptionValueString.h
    lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h
    lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
    lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp
    lldb/trunk/source/Interpreter/OptionGroupFile.cpp
    lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
    lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
    lldb/trunk/source/Interpreter/OptionGroupString.cpp
    lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp
    lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
    lldb/trunk/source/Interpreter/OptionValue.cpp
    lldb/trunk/source/Interpreter/OptionValueArch.cpp
    lldb/trunk/source/Interpreter/OptionValueArray.cpp
    lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
    lldb/trunk/source/Interpreter/OptionValueChar.cpp
    lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
    lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
    lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
    lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
    lldb/trunk/source/Interpreter/OptionValueFormat.cpp
    lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp
    lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
    lldb/trunk/source/Interpreter/OptionValueProperties.cpp
    lldb/trunk/source/Interpreter/OptionValueRegex.cpp
    lldb/trunk/source/Interpreter/OptionValueSInt64.cpp
    lldb/trunk/source/Interpreter/OptionValueString.cpp
    lldb/trunk/source/Interpreter/OptionValueUInt64.cpp
    lldb/trunk/source/Interpreter/OptionValueUUID.cpp
    lldb/trunk/source/Interpreter/Property.cpp

Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValue.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValue.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValue.h Fri Feb 20 05:14:59 2015
@@ -106,7 +106,7 @@ namespace lldb_private {
         DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0;
         
         virtual Error
-        SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
+        SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
         
         virtual bool
         Clear () = 0;

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArch.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArch.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArch.h Fri Feb 20 05:14:59 2015
@@ -71,7 +71,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArray.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArray.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArray.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArray.h Fri Feb 20 05:14:59 2015
@@ -49,7 +49,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h Fri Feb 20 05:14:59 2015
@@ -54,7 +54,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueChar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueChar.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueChar.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueChar.h Fri Feb 20 05:14:59 2015
@@ -54,7 +54,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h Fri Feb 20 05:14:59 2015
@@ -50,7 +50,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h Fri Feb 20 05:14:59 2015
@@ -55,7 +55,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Fri Feb 20 05:14:59 2015
@@ -50,7 +50,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h Fri Feb 20 05:14:59 2015
@@ -54,7 +54,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h Fri Feb 20 05:14:59 2015
@@ -55,7 +55,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h Fri Feb 20 05:14:59 2015
@@ -43,7 +43,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
     
     Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign) override;
     
     bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h Fri Feb 20 05:14:59 2015
@@ -48,7 +48,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Fri Feb 20 05:14:59 2015
@@ -61,7 +61,7 @@ public:
     DeepCopy () const;
     
     virtual Error
-    SetValueFromCString (const char *value, VarSetOperationType op = eVarSetOperationAssign);
+    SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
 
     virtual void
     DumpValue (const ExecutionContext *exe_ctx,

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h Fri Feb 20 05:14:59 2015
@@ -49,7 +49,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
 
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h Fri Feb 20 05:14:59 2015
@@ -77,7 +77,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueString.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueString.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueString.h Fri Feb 20 05:14:59 2015
@@ -137,7 +137,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
 
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h Fri Feb 20 05:14:59 2015
@@ -70,7 +70,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h Fri Feb 20 05:14:59 2015
@@ -53,7 +53,7 @@ public:
     DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask);
     
     virtual Error
-    SetValueFromCString (const char *value,
+    SetValueFromString (llvm::StringRef value,
                          VarSetOperationType op = eVarSetOperationAssign);
     
     virtual bool

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Feb 20 05:14:59 2015
@@ -1950,15 +1950,15 @@ public:
         {
         case 'N':
             if (BreakpointID::StringIsBreakpointName(option_value, error) && error.Success())
-                m_name.SetValueFromCString(option_value);
+                m_name.SetValueFromString(option_value);
             break;
           
         case 'B':
-            if (m_breakpoint.SetValueFromCString(option_value).Fail())
+            if (m_breakpoint.SetValueFromString(option_value).Fail())
                 error.SetErrorStringWithFormat ("unrecognized value \"%s\" for breakpoint", option_value);
             break;
         case 'D':
-            if (m_use_dummy.SetValueFromCString(option_value).Fail())
+            if (m_use_dummy.SetValueFromString(option_value).Fail())
                 error.SetErrorStringWithFormat ("unrecognized value \"%s\" for use-dummy", option_value);
             break;
 

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Feb 20 05:14:59 2015
@@ -85,7 +85,7 @@ protected:
             switch (short_option)
             {
                 case 'c':
-                    error = m_count.SetValueFromCString(option_arg,eVarSetOperationAssign);
+                    error = m_count.SetValueFromString(option_arg,eVarSetOperationAssign);
                     break;
                 case 's':
                     if (option_arg && strcmp("end", option_arg) == 0)
@@ -94,10 +94,10 @@ protected:
                         m_start_idx.SetOptionWasSet();
                     }
                     else
-                        error = m_start_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
+                        error = m_start_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
                     break;
                 case 'e':
-                    error = m_stop_idx.SetValueFromCString(option_arg,eVarSetOperationAssign);
+                    error = m_stop_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
                     break;
                 case 'C':
                     m_clear.SetCurrentValue(true);
@@ -326,15 +326,15 @@ protected:
             switch (short_option)
             {
                 case 'e':
-                    error = m_stop_on_error.SetValueFromCString(option_arg);
+                    error = m_stop_on_error.SetValueFromString(option_arg);
                     break;
 
                 case 'c':
-                    error = m_stop_on_continue.SetValueFromCString(option_arg);
+                    error = m_stop_on_continue.SetValueFromString(option_arg);
                     break;
 
                 case 's':
-                    error = m_silent_run.SetValueFromCString(option_arg);
+                    error = m_silent_run.SetValueFromString(option_arg);
                     break;
 
                 default:

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Feb 20 05:14:59 2015
@@ -95,7 +95,7 @@ public:
         switch (short_option)
         {
             case 'l':
-                error = m_num_per_line.SetValueFromCString (option_arg);
+                error = m_num_per_line.SetValueFromString (option_arg);
                 if (m_num_per_line.GetCurrentValue() == 0)
                     error.SetErrorStringWithFormat("invalid value for --num-per-line option '%s'", option_arg);
                 break;
@@ -105,7 +105,7 @@ public:
                 break;
                 
             case 't':
-                error = m_view_as_type.SetValueFromCString (option_arg);
+                error = m_view_as_type.SetValueFromString (option_arg);
                 break;
             
             case 'r':
@@ -981,20 +981,20 @@ public:
         switch (short_option)
         {
         case 'e':
-              m_expr.SetValueFromCString(option_arg);
+              m_expr.SetValueFromString(option_arg);
               break;
           
         case 's':
-              m_string.SetValueFromCString(option_arg);
+              m_string.SetValueFromString(option_arg);
               break;
           
         case 'c':
-              if (m_count.SetValueFromCString(option_arg).Fail())
+              if (m_count.SetValueFromString(option_arg).Fail())
                   error.SetErrorString("unrecognized value for count");
               break;
                 
         case 'o':
-               if (m_offset.SetValueFromCString(option_arg).Fail())
+               if (m_offset.SetValueFromString(option_arg).Fail())
                    error.SetErrorString("unrecognized value for dump-offset");
                 break;
 

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Fri Feb 20 05:14:59 2015
@@ -726,7 +726,7 @@ Instruction::ReadArray (FILE *in_file, S
             {
             case OptionValue::eTypeUInt64:
                 data_value_sp.reset (new OptionValueUInt64 (0, 0));
-                data_value_sp->SetValueFromCString (value.c_str());
+                data_value_sp->SetValueFromString (value);
                 break;
             // Other types can be added later as needed.
             default:
@@ -834,7 +834,7 @@ Instruction::ReadDictionary (FILE *in_fi
             else if ((value[0] == '0') && (value[1] == 'x'))
             {
                 value_sp.reset (new OptionValueUInt64 (0, 0));
-                value_sp->SetValueFromCString (value.c_str());
+                value_sp->SetValueFromString (value);
             }
             else
             {

Modified: lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp Fri Feb 20 05:14:59 2015
@@ -56,7 +56,7 @@ OptionGroupBoolean::SetOptionValue (Comm
     }
     else
     {
-        error = m_value.SetValueFromCString (option_arg);
+        error = m_value.SetValueFromString (option_arg);
     }
     return error;
 }

Modified: lldb/trunk/source/Interpreter/OptionGroupFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupFile.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupFile.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupFile.cpp Fri Feb 20 05:14:59 2015
@@ -47,7 +47,7 @@ OptionGroupFile::SetOptionValue (Command
                                  uint32_t option_idx,
                                  const char *option_arg)
 {
-    Error error (m_file.SetValueFromCString (option_arg));
+    Error error (m_file.SetValueFromString (option_arg));
     return error;
 }
 
@@ -88,7 +88,7 @@ OptionGroupFileList::SetOptionValue (Com
                                      uint32_t option_idx,
                                      const char *option_arg)
 {
-    Error error (m_file_list.SetValueFromCString (option_arg));
+    Error error (m_file_list.SetValueFromString (option_arg));
     return error;
 }
 

Modified: lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupFormat.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupFormat.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupFormat.cpp Fri Feb 20 05:14:59 2015
@@ -78,7 +78,7 @@ OptionGroupFormat::SetOptionValue (Comma
     switch (short_option)
     {
         case 'f':
-            error = m_format.SetValueFromCString (option_arg);
+            error = m_format.SetValueFromString (option_arg);
             break;
 
         case 'c':
@@ -88,7 +88,7 @@ OptionGroupFormat::SetOptionValue (Comma
             }
             else
             {
-                error = m_count.SetValueFromCString (option_arg);
+                error = m_count.SetValueFromString (option_arg);
                 if (m_count.GetCurrentValue() == 0)
                     error.SetErrorStringWithFormat("invalid --count option value '%s'", option_arg);
             }
@@ -101,7 +101,7 @@ OptionGroupFormat::SetOptionValue (Comma
             }
             else
             {
-                error = m_byte_size.SetValueFromCString (option_arg);
+                error = m_byte_size.SetValueFromString (option_arg);
                 if (m_byte_size.GetCurrentValue() == 0)
                     error.SetErrorStringWithFormat("invalid --size option value '%s'", option_arg);
             }

Modified: lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp Fri Feb 20 05:14:59 2015
@@ -62,7 +62,7 @@ OptionGroupOutputFile::SetOptionValue (C
     switch (short_option)
     {
         case 'o':
-            error = m_file.SetValueFromCString (option_arg);
+            error = m_file.SetValueFromString (option_arg);
             break;
 
         case SHORT_OPTION_APND:

Modified: lldb/trunk/source/Interpreter/OptionGroupString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupString.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupString.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupString.cpp Fri Feb 20 05:14:59 2015
@@ -48,7 +48,7 @@ OptionGroupString::SetOptionValue (Comma
                                    uint32_t option_idx,
                                    const char *option_arg)
 {
-    Error error (m_value.SetValueFromCString (option_arg));
+    Error error (m_value.SetValueFromString (option_arg));
     return error;
 }
 

Modified: lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp Fri Feb 20 05:14:59 2015
@@ -48,7 +48,7 @@ OptionGroupUInt64::SetOptionValue (Comma
                                    uint32_t option_idx,
                                    const char *option_arg)
 {
-    Error error (m_value.SetValueFromCString (option_arg));
+    Error error (m_value.SetValueFromString (option_arg));
     return error;
 }
 

Modified: lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupUUID.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupUUID.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupUUID.cpp Fri Feb 20 05:14:59 2015
@@ -56,7 +56,7 @@ OptionGroupUUID::SetOptionValue (Command
     switch (short_option)
     {
         case 'u':
-            error = m_uuid.SetValueFromCString (option_arg);
+            error = m_uuid.SetValueFromString (option_arg);
             if (error.Success())
                 m_uuid.SetOptionWasSet();
             break;

Modified: lldb/trunk/source/Interpreter/OptionValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValue.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValue.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValue.cpp Fri Feb 20 05:14:59 2015
@@ -622,7 +622,7 @@ OptionValue::CreateValueFromCStringForTy
     }
 
     if (value_sp)
-        error = value_sp->SetValueFromCString (value_cstr, eVarSetOperationAssign);
+        error = value_sp->SetValueFromString (value_cstr, eVarSetOperationAssign);
     else
         error.SetErrorString("unsupported type mask");
     return value_sp;
@@ -664,7 +664,7 @@ OptionValue::AutoComplete (CommandInterp
 }
 
 Error
-OptionValue::SetValueFromCString (const char *value, VarSetOperationType op)
+OptionValue::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
     switch (op)

Modified: lldb/trunk/source/Interpreter/OptionValueArch.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueArch.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueArch.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueArch.cpp Fri Feb 20 05:14:59 2015
@@ -43,7 +43,7 @@ OptionValueArch::DumpValue (const Execut
 }
 
 Error
-OptionValueArch::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
+OptionValueArch::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
     switch (op)
@@ -55,30 +55,23 @@ OptionValueArch::SetValueFromCString (co
         
     case eVarSetOperationReplace:
     case eVarSetOperationAssign:
-        if (value_cstr)
         {
-            std::string value = llvm::StringRef(value_cstr).trim().str();
-            value_cstr = value.c_str();
-            if (m_current_value.SetTriple (value_cstr))
+            std::string value_str = value.trim().str();
+            if (m_current_value.SetTriple (value_str.c_str()))
             {
                 m_value_was_set = true;
                 NotifyValueChanged();
             }
             else
-                error.SetErrorStringWithFormat("unsupported architecture '%s'", value_cstr);
+                error.SetErrorStringWithFormat("unsupported architecture '%s'", value_str.c_str());
+            break;
         }
-        else
-        {
-            error.SetErrorString("invalid value string");
-        }
-        break;
-        
     case eVarSetOperationInsertBefore:
     case eVarSetOperationInsertAfter:
     case eVarSetOperationRemove:
     case eVarSetOperationAppend:
     case eVarSetOperationInvalid:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value, op);
         break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueArray.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueArray.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueArray.cpp Fri Feb 20 05:14:59 2015
@@ -74,9 +74,9 @@ OptionValueArray::DumpValue (const Execu
 }
 
 Error
-OptionValueArray::SetValueFromCString (const char *value, VarSetOperationType op)
+OptionValueArray::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
-    Args args(value);
+    Args args(value.str().c_str());
     Error error = SetArgs (args, op);
     if (error.Success())
         NotifyValueChanged();

Modified: lldb/trunk/source/Interpreter/OptionValueBoolean.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueBoolean.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueBoolean.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueBoolean.cpp Fri Feb 20 05:14:59 2015
@@ -37,7 +37,7 @@ OptionValueBoolean::DumpValue (const Exe
 }
 
 Error
-OptionValueBoolean::SetValueFromCString (const char *value_cstr,
+OptionValueBoolean::SetValueFromString (llvm::StringRef value_str,
                                          VarSetOperationType op)
 {
     Error error;
@@ -52,7 +52,7 @@ OptionValueBoolean::SetValueFromCString
     case eVarSetOperationAssign:
         {
             bool success = false;
-            bool value = Args::StringToBoolean(value_cstr, false, &success);
+            bool value = Args::StringToBoolean(value_str.str().c_str(), false, &success);
             if (success)
             {
                 m_value_was_set = true;
@@ -61,12 +61,11 @@ OptionValueBoolean::SetValueFromCString
             }
             else
             {
-                if (value_cstr == nullptr)
-                    error.SetErrorString ("invalid boolean string value: NULL");
-                else if (value_cstr[0] == '\0')
+                if (value_str.size() == 0)
                     error.SetErrorString ("invalid boolean string value <empty>");
                 else
-                    error.SetErrorStringWithFormat ("invalid boolean string value: '%s'", value_cstr);
+                    error.SetErrorStringWithFormat ("invalid boolean string value: '%s'",
+                            value_str.str().c_str());
             }
         }
         break;
@@ -76,7 +75,7 @@ OptionValueBoolean::SetValueFromCString
     case eVarSetOperationRemove:
     case eVarSetOperationAppend:
     case eVarSetOperationInvalid:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value_str, op);
         break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueChar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueChar.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueChar.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueChar.cpp Fri Feb 20 05:14:59 2015
@@ -39,7 +39,7 @@ OptionValueChar::DumpValue (const Execut
 }
 
 Error
-OptionValueChar::SetValueFromCString (const char *value_cstr,
+OptionValueChar::SetValueFromString (llvm::StringRef value,
                                       VarSetOperationType op)
 {
     Error error;
@@ -53,19 +53,19 @@ OptionValueChar::SetValueFromCString (co
     case eVarSetOperationAssign:
         {
             bool success = false;
-            char char_value = Args::StringToChar(value_cstr, '\0', &success);
+            char char_value = Args::StringToChar(value.str().c_str(), '\0', &success);
             if (success)
             {
                 m_current_value = char_value;
                 m_value_was_set = true;
             }
             else
-                error.SetErrorStringWithFormat("'%s' cannot be longer than 1 character", value_cstr);
+                error.SetErrorStringWithFormat("'%s' cannot be longer than 1 character", value.str().c_str());
         }
         break;
 
     default:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value.str().c_str(), op);
         break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueDictionary.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Fri Feb 20 05:14:59 2015
@@ -211,16 +211,16 @@ OptionValueDictionary::SetArgs (const Ar
     case eVarSetOperationInsertBefore:
     case eVarSetOperationInsertAfter:
     case eVarSetOperationInvalid:
-        error = OptionValue::SetValueFromCString (nullptr, op);
+        error = OptionValue::SetValueFromString (llvm::StringRef(), op);
         break;
     }
     return error;
 }
 
 Error
-OptionValueDictionary::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
+OptionValueDictionary::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
-    Args args(value_cstr);
+    Args args(value.str().c_str());
     Error error = SetArgs (args, op);
     if (error.Success())
         NotifyValueChanged();
@@ -335,7 +335,7 @@ OptionValueDictionary::SetSubValue (cons
     const bool will_modify = true;
     lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error));
     if (value_sp)
-        error = value_sp->SetValueFromCString(value, op);
+        error = value_sp->SetValueFromString(value, op);
     else
     {
         if (error.AsCString() == nullptr)
@@ -381,7 +381,7 @@ OptionValueDictionary::SetStringValueFor
             return false;
         if (pos->second->GetType() == OptionValue::eTypeString)
         {
-            pos->second->SetValueFromCString(value);
+            pos->second->SetValueFromString(value);
             return true;
         }
     }

Modified: lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueEnumeration.cpp Fri Feb 20 05:14:59 2015
@@ -55,7 +55,7 @@ OptionValueEnumeration::DumpValue (const
 }
 
 Error
-OptionValueEnumeration::SetValueFromCString (const char *value, VarSetOperationType op)
+OptionValueEnumeration::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
     switch (op)
@@ -67,9 +67,8 @@ OptionValueEnumeration::SetValueFromCStr
             
         case eVarSetOperationReplace:
         case eVarSetOperationAssign:
-            if (value && value[0])
             {
-                ConstString const_enumerator_name(llvm::StringRef(value).trim());
+                ConstString const_enumerator_name(value.trim());
                 const EnumerationMapEntry *enumerator_entry = m_enumerations.FindFirstValueForName (const_enumerator_name.GetCString());
                 if (enumerator_entry)
                 {
@@ -79,7 +78,7 @@ OptionValueEnumeration::SetValueFromCStr
                 else
                 {
                     StreamString error_strm;
-                    error_strm.Printf("invalid enumeration value '%s'", value);
+                    error_strm.Printf("invalid enumeration value '%s'", value.str().c_str());
                     const size_t count = m_enumerations.GetSize ();
                     if (count)
                     {
@@ -91,19 +90,15 @@ OptionValueEnumeration::SetValueFromCStr
                     }
                     error.SetErrorString(error_strm.GetData());
                 }
+                break;
             }
-            else
-            {
-                error.SetErrorString("invalid enumeration value");
-            }
-            break;
             
         case eVarSetOperationInsertBefore:
         case eVarSetOperationInsertAfter:
         case eVarSetOperationRemove:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value, op);
+            error = OptionValue::SetValueFromString (value, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Fri Feb 20 05:14:59 2015
@@ -75,7 +75,7 @@ OptionValueFileSpec::DumpValue (const Ex
 }
 
 Error
-OptionValueFileSpec::SetValueFromCString (const char *value_cstr,
+OptionValueFileSpec::SetValueFromString (llvm::StringRef value,
                                           VarSetOperationType op)
 {
     Error error;
@@ -88,23 +88,16 @@ OptionValueFileSpec::SetValueFromCString
         
     case eVarSetOperationReplace:
     case eVarSetOperationAssign:
-        if (value_cstr && value_cstr[0])
+        if (value.size() > 0)
         {
             // The setting value may have whitespace, double-quotes, or single-quotes around the file
             // path to indicate that internal spaces are not word breaks.  Strip off any ws & quotes
             // from the start and end of the file path - we aren't doing any word // breaking here so 
             // the quoting is unnecessary.  NB this will cause a problem if someone tries to specify
             // a file path that legitimately begins or ends with a " or ' character, or whitespace.
-            std::string filepath(value_cstr);
-            auto prefix_chars_to_trim = filepath.find_first_not_of ("\"' \t");
-            if (prefix_chars_to_trim != std::string::npos && prefix_chars_to_trim > 0)
-                filepath.erase(0, prefix_chars_to_trim);
-            auto suffix_chars_to_trim = filepath.find_last_not_of ("\"' \t");
-            if (suffix_chars_to_trim != std::string::npos && suffix_chars_to_trim < filepath.size())
-                filepath.erase (suffix_chars_to_trim + 1);
-
+            value = value.trim("\"' \t");
             m_value_was_set = true;
-            m_current_value.SetFile(filepath.c_str(), m_resolve);
+            m_current_value.SetFile(value.str().c_str(), m_resolve);
             m_data_sp.reset();
             NotifyValueChanged();
         }
@@ -119,7 +112,7 @@ OptionValueFileSpec::SetValueFromCString
     case eVarSetOperationRemove:
     case eVarSetOperationAppend:
     case eVarSetOperationInvalid:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value, op);
         break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpecLIst.cpp Fri Feb 20 05:14:59 2015
@@ -42,10 +42,10 @@ OptionValueFileSpecList::DumpValue (cons
 }
 
 Error
-OptionValueFileSpecList::SetValueFromCString (const char *value, VarSetOperationType op)
+OptionValueFileSpecList::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
-    Args args(value);
+    Args args(value.str().c_str());
     const size_t argc = args.GetArgumentCount();
 
     switch (op)
@@ -174,7 +174,7 @@ OptionValueFileSpecList::SetValueFromCSt
             break;
 
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value, op);
+            error = OptionValue::SetValueFromString (value, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFormat.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFormat.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFormat.cpp Fri Feb 20 05:14:59 2015
@@ -36,7 +36,7 @@ OptionValueFormat::DumpValue (const Exec
 }
 
 Error
-OptionValueFormat::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
+OptionValueFormat::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
     switch (op)
@@ -50,7 +50,7 @@ OptionValueFormat::SetValueFromCString (
     case eVarSetOperationAssign:
         {
             Format new_format;
-            error = Args::StringToFormat (value_cstr, new_format, nullptr);
+            error = Args::StringToFormat (value.str().c_str(), new_format, nullptr);
             if (error.Success())
             {
                 m_value_was_set = true;
@@ -65,7 +65,7 @@ OptionValueFormat::SetValueFromCString (
     case eVarSetOperationRemove:
     case eVarSetOperationAppend:
     case eVarSetOperationInvalid:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value, op);
         break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFormatEntity.cpp Fri Feb 20 05:14:59 2015
@@ -67,7 +67,7 @@ OptionValueFormatEntity::DumpValue (cons
 }
 
 Error
-OptionValueFormatEntity::SetValueFromCString (const char *value_cstr,
+OptionValueFormatEntity::SetValueFromString (llvm::StringRef value_str,
                                       VarSetOperationType op)
 {
     Error error;
@@ -82,12 +82,11 @@ OptionValueFormatEntity::SetValueFromCSt
         case eVarSetOperationAssign:
             {
                 FormatEntity::Entry entry;
-                llvm::StringRef value_str(value_cstr);
                 error = FormatEntity::Parse(value_str, entry);
                 if (error.Success())
                 {
                     m_current_entry = std::move(entry);
-                    m_current_format = value_cstr;
+                    m_current_format = value_str;
                     m_value_was_set = true;
                     NotifyValueChanged();
                 }
@@ -99,7 +98,7 @@ OptionValueFormatEntity::SetValueFromCSt
         case eVarSetOperationRemove:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value_cstr, op);
+            error = OptionValue::SetValueFromString (value_str, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValuePathMappings.cpp Fri Feb 20 05:14:59 2015
@@ -34,10 +34,10 @@ OptionValuePathMappings::DumpValue (cons
 }
 
 Error
-OptionValuePathMappings::SetValueFromCString (const char *value, VarSetOperationType op)
+OptionValuePathMappings::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
-    Args args(value);
+    Args args(value.str().c_str());
     const size_t argc = args.GetArgumentCount();
 
     switch (op)
@@ -175,7 +175,7 @@ OptionValuePathMappings::SetValueFromCSt
             break;
 
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value, op);
+            error = OptionValue::SetValueFromString (value, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Fri Feb 20 05:14:59 2015
@@ -226,7 +226,7 @@ OptionValueProperties::SetSubValue (cons
     const bool will_modify = true;
     lldb::OptionValueSP value_sp (GetSubValue (exe_ctx, name, will_modify, error));
     if (value_sp)
-        error = value_sp->SetValueFromCString(value, op);
+        error = value_sp->SetValueFromString(value ? llvm::StringRef(value) : llvm::StringRef(), op);
     else
     {
         if (error.AsCString() == nullptr)
@@ -600,7 +600,7 @@ OptionValueProperties::Clear ()
 
 
 Error
-OptionValueProperties::SetValueFromCString (const char *value, VarSetOperationType op)
+OptionValueProperties::SetValueFromString (llvm::StringRef value, VarSetOperationType op)
 {
     Error error;
     
@@ -619,7 +619,7 @@ OptionValueProperties::SetValueFromCStri
         case eVarSetOperationInsertAfter:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value, op);
+            error = OptionValue::SetValueFromString (value, op);
             break;
     }
     

Modified: lldb/trunk/source/Interpreter/OptionValueRegex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueRegex.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueRegex.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueRegex.cpp Fri Feb 20 05:14:59 2015
@@ -41,7 +41,7 @@ OptionValueRegex::DumpValue (const Execu
 }
 
 Error
-OptionValueRegex::SetValueFromCString (const char *value_cstr,
+OptionValueRegex::SetValueFromString (llvm::StringRef value,
                                         VarSetOperationType op)
 {
     Error error;
@@ -52,7 +52,7 @@ OptionValueRegex::SetValueFromCString (c
     case eVarSetOperationInsertAfter:
     case eVarSetOperationRemove:
     case eVarSetOperationAppend:
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value, op);
         break;
 
     case eVarSetOperationClear:
@@ -62,7 +62,7 @@ OptionValueRegex::SetValueFromCString (c
 
     case eVarSetOperationReplace:
     case eVarSetOperationAssign:
-        if (m_regex.Compile (value_cstr))
+        if (m_regex.Compile (value.str().c_str()))
         {
             m_value_was_set = true;
             NotifyValueChanged();

Modified: lldb/trunk/source/Interpreter/OptionValueSInt64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueSInt64.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueSInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueSInt64.cpp Fri Feb 20 05:14:59 2015
@@ -36,9 +36,8 @@ OptionValueSInt64::DumpValue (const Exec
 }
 
 Error
-OptionValueSInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
+OptionValueSInt64::SetValueFromString (llvm::StringRef value_ref, VarSetOperationType op)
 {
-    //printf ("%p: SetValueFromCString (s=\"%s\", op=%i)\n", this, value_cstr, op);
     Error error;
     switch (op)
     {
@@ -51,7 +50,7 @@ OptionValueSInt64::SetValueFromCString (
         case eVarSetOperationAssign:
             {
                 bool success = false;
-                std::string value_str = llvm::StringRef(value_cstr).trim().str();
+                std::string value_str = value_ref.trim().str();
                 int64_t value = StringConvert::ToSInt64 (value_str.c_str(), 0, 0, &success);
                 if (success)
                 {
@@ -69,7 +68,8 @@ OptionValueSInt64::SetValueFromCString (
                 }
                 else
                 {
-                    error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'", value_cstr);
+                    error.SetErrorStringWithFormat ("invalid int64_t string value: '%s'",
+                            value_ref.str().c_str());
                 }
             }
             break;
@@ -79,7 +79,7 @@ OptionValueSInt64::SetValueFromCString (
         case eVarSetOperationRemove:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value_cstr, op);
+            error = OptionValue::SetValueFromString (value_ref, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueString.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueString.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueString.cpp Fri Feb 20 05:14:59 2015
@@ -51,31 +51,30 @@ OptionValueString::DumpValue (const Exec
 }
 
 Error
-OptionValueString::SetValueFromCString (const char *value_cstr,
+OptionValueString::SetValueFromString (llvm::StringRef value,
                                         VarSetOperationType op)
 {
     Error error;
 
-    std::string value_str_no_quotes;
-    llvm::StringRef trimmed = value_cstr ? llvm::StringRef(value_cstr).trim() : llvm::StringRef();
-    if (trimmed.size() > 0)
+    std::string value_str = value.str();
+    value = value.trim();
+    if (value.size() > 0)
     {
-        switch (trimmed.front())
+        switch (value.front())
         {
         case '"':
         case '\'':
             {
-                if (trimmed.size() <= 1 || trimmed.back() != trimmed.front())
+                if (value.size() <= 1 || value.back() != value.front())
                 {
                     error.SetErrorString("mismatched quotes");
                     return error;
                 }
-                trimmed = trimmed.drop_front().drop_back().str();
+                value = value.drop_front().drop_back().str();
             }
             break;
         }
-        value_str_no_quotes = trimmed.str();
-        value_cstr = value_str_no_quotes.c_str();
+        value_str = value.str();
     }
 
     switch (op)
@@ -86,26 +85,26 @@ OptionValueString::SetValueFromCString (
     case eVarSetOperationRemove:
         if (m_validator)
         {
-            error = m_validator(value_cstr,m_validator_baton);
+            error = m_validator(value_str.c_str(),m_validator_baton);
             if (error.Fail())
                 return error;
         }
-        error = OptionValue::SetValueFromCString (value_cstr, op);
+        error = OptionValue::SetValueFromString (value, op);
         break;
 
     case eVarSetOperationAppend:
         {
             std::string new_value(m_current_value);
-            if (value_cstr && value_cstr[0])
+            if (value.size() > 0)
             {
                 if (m_options.Test (eOptionEncodeCharacterEscapeSequences))
                 {
                     std::string str;
-                    Args::EncodeEscapeSequences (value_cstr, str);
+                    Args::EncodeEscapeSequences (value_str.c_str(), str);
                     new_value.append(str);
                 }
                 else
-                    new_value.append(value_cstr);
+                    new_value.append(value);
             }
             if (m_validator)
             {
@@ -127,18 +126,18 @@ OptionValueString::SetValueFromCString (
     case eVarSetOperationAssign:
         if (m_validator)
         {
-            error = m_validator(value_cstr,m_validator_baton);
+            error = m_validator(value_str.c_str(), m_validator_baton);
             if (error.Fail())
                 return error;
         }
         m_value_was_set = true;
         if (m_options.Test (eOptionEncodeCharacterEscapeSequences))
         {
-            Args::EncodeEscapeSequences (value_cstr, m_current_value);
+            Args::EncodeEscapeSequences (value_str.c_str(), m_current_value);
         }
         else
         {
-            SetCurrentValue (value_cstr);
+            SetCurrentValue (value_str.c_str());
         }
         NotifyValueChanged();
         break;

Modified: lldb/trunk/source/Interpreter/OptionValueUInt64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueUInt64.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueUInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueUInt64.cpp Fri Feb 20 05:14:59 2015
@@ -23,7 +23,7 @@ lldb::OptionValueSP
 OptionValueUInt64::Create (const char *value_cstr, Error &error)
 {
     lldb::OptionValueSP value_sp (new OptionValueUInt64());
-    error = value_sp->SetValueFromCString (value_cstr);
+    error = value_sp->SetValueFromString (value_cstr);
     if (error.Fail())
         value_sp.reset();
     return value_sp;
@@ -44,7 +44,7 @@ OptionValueUInt64::DumpValue (const Exec
 }
 
 Error
-OptionValueUInt64::SetValueFromCString (const char *value_cstr, VarSetOperationType op)
+OptionValueUInt64::SetValueFromString (llvm::StringRef value_ref, VarSetOperationType op)
 {
     Error error;
     switch (op)
@@ -58,7 +58,7 @@ OptionValueUInt64::SetValueFromCString (
         case eVarSetOperationAssign:
         {
             bool success = false;
-            std::string value_str = llvm::StringRef(value_cstr).trim().str();
+            std::string value_str = value_ref.trim().str();
             uint64_t value = StringConvert::ToUInt64 (value_str.c_str(), 0, 0, &success);
             if (success)
             {
@@ -68,7 +68,7 @@ OptionValueUInt64::SetValueFromCString (
             }
             else
             {
-                error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_cstr);
+                error.SetErrorStringWithFormat ("invalid uint64_t string value: '%s'", value_str.c_str());
             }
         }
             break;
@@ -78,7 +78,7 @@ OptionValueUInt64::SetValueFromCString (
         case eVarSetOperationRemove:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value_cstr, op);
+            error = OptionValue::SetValueFromString (value_ref, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/OptionValueUUID.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueUUID.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueUUID.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueUUID.cpp Fri Feb 20 05:14:59 2015
@@ -37,7 +37,7 @@ OptionValueUUID::DumpValue (const Execut
 }
 
 Error
-OptionValueUUID::SetValueFromCString (const char *value_cstr,
+OptionValueUUID::SetValueFromString (llvm::StringRef value,
                                       VarSetOperationType op)
 {
     Error error;
@@ -51,8 +51,8 @@ OptionValueUUID::SetValueFromCString (co
         case eVarSetOperationReplace:
         case eVarSetOperationAssign:
             {
-                if (m_uuid.SetFromCString(value_cstr) == 0)
-                    error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value_cstr);
+                if (m_uuid.SetFromCString(value.str().c_str()) == 0)
+                    error.SetErrorStringWithFormat ("invalid uuid string value '%s'", value.str().c_str());
                 else
                 {
                     m_value_was_set = true;
@@ -66,7 +66,7 @@ OptionValueUUID::SetValueFromCString (co
         case eVarSetOperationRemove:
         case eVarSetOperationAppend:
         case eVarSetOperationInvalid:
-            error = OptionValue::SetValueFromCString (value_cstr, op);
+            error = OptionValue::SetValueFromString (value, op);
             break;
     }
     return error;

Modified: lldb/trunk/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Property.cpp?rev=230005&r1=230004&r2=230005&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Property.cpp (original)
+++ lldb/trunk/source/Interpreter/Property.cpp Fri Feb 20 05:14:59 2015
@@ -80,11 +80,11 @@ Property::Property (const PropertyDefini
             m_value_sp.reset (enum_value);
             if (definition.default_cstr_value)
             {
-                if (enum_value->SetValueFromCString(definition.default_cstr_value).Success())
+                if (enum_value->SetValueFromString(definition.default_cstr_value).Success())
                 {
                     enum_value->SetDefaultValue(enum_value->GetCurrentValue());
                     // Call Clear() since we don't want the value to appear as
-                    // having been set since we called SetValueFromCString() above.
+                    // having been set since we called SetValueFromString() above.
                     // Clear will set the current value to the default and clear
                     // the boolean that says that the value has been set.
                     enum_value->Clear();





More information about the lldb-commits mailing list