[Lldb-commits] [lldb] r282265 - Update OptionGroup::SetValue to take StringRef.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 23 10:48:15 PDT 2016
Author: zturner
Date: Fri Sep 23 12:48:13 2016
New Revision: 282265
URL: http://llvm.org/viewvc/llvm-project?rev=282265&view=rev
Log:
Update OptionGroup::SetValue to take StringRef.
Then deal with all the fallout.
Differential Revision: https://reviews.llvm.org/D24847
Modified:
lldb/trunk/include/lldb/Interpreter/Args.h
lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h
lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h
lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h
lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h
lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h
lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
lldb/trunk/include/lldb/Interpreter/OptionGroupString.h
lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h
lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h
lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h
lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
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/OptionValueLanguage.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/include/lldb/Interpreter/Options.h
lldb/trunk/include/lldb/Target/Language.h
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/API/SBLanguageRuntime.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectExpression.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectRegister.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/source/Interpreter/OptionGroupArchitecture.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/OptionGroupPlatform.cpp
lldb/trunk/source/Interpreter/OptionGroupString.cpp
lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp
lldb/trunk/source/Interpreter/OptionGroupUUID.cpp
lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
lldb/trunk/source/Interpreter/OptionValue.cpp
lldb/trunk/source/Interpreter/OptionValueChar.cpp
lldb/trunk/source/Interpreter/OptionValueDictionary.cpp
lldb/trunk/source/Interpreter/OptionValueString.cpp
lldb/trunk/source/Interpreter/OptionValueUInt64.cpp
lldb/trunk/source/Interpreter/Options.cpp
lldb/trunk/source/Interpreter/Property.cpp
lldb/trunk/source/Target/Language.cpp
lldb/trunk/source/Target/Platform.cpp
Modified: lldb/trunk/include/lldb/Interpreter/Args.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Args.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Args.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Args.h Fri Sep 23 12:48:13 2016
@@ -227,6 +227,8 @@ public:
void AddOrReplaceEnvironmentVariable(const char *, const char *) = delete;
bool ContainsEnvironmentVariable(const char *,
size_t * = nullptr) const = delete;
+ static int64_t StringToOptionEnum(const char *, OptionEnumValueElement *,
+ int32_t, Error &) = delete;
//------------------------------------------------------------------
/// Insert the argument value at index \a idx to \a arg_cstr.
@@ -407,7 +409,7 @@ public:
static char StringToChar(llvm::StringRef s, char fail_value,
bool *success_ptr);
- static int64_t StringToOptionEnum(const char *s,
+ static int64_t StringToOptionEnum(llvm::StringRef s,
OptionEnumValueElement *enum_values,
int32_t fail_value, Error &error);
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupArchitecture.h Fri Sep 23 12:48:13 2016
@@ -31,8 +31,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupBoolean.h Fri Sep 23 12:48:13 2016
@@ -38,8 +38,9 @@ public:
return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h Fri Sep 23 12:48:13 2016
@@ -37,8 +37,9 @@ public:
return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
@@ -69,8 +70,9 @@ public:
return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h Fri Sep 23 12:48:13 2016
@@ -43,8 +43,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h Fri Sep 23 12:48:13 2016
@@ -31,8 +31,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h Fri Sep 23 12:48:13 2016
@@ -36,8 +36,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupString.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupString.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupString.h Fri Sep 23 12:48:13 2016
@@ -35,8 +35,9 @@ public:
return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h Fri Sep 23 12:48:13 2016
@@ -36,8 +36,9 @@ public:
return llvm::ArrayRef<OptionDefinition>(&m_option_definition, 1);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h Fri Sep 23 12:48:13 2016
@@ -31,8 +31,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h Fri Sep 23 12:48:13 2016
@@ -31,8 +31,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Fri Sep 23 12:48:13 2016
@@ -31,8 +31,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h Fri Sep 23 12:48:13 2016
@@ -32,8 +32,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValue.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValue.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValue.h Fri Sep 23 12:48:13 2016
@@ -92,6 +92,9 @@ public:
virtual Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign);
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
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=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArch.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArch.h Fri Sep 23 12:48:13 2016
@@ -49,6 +49,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArray.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArray.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArray.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArray.h Fri Sep 23 12:48:13 2016
@@ -39,6 +39,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_values.clear();
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h Fri Sep 23 12:48:13 2016
@@ -40,6 +40,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueChar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueChar.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueChar.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueChar.h Fri Sep 23 12:48:13 2016
@@ -41,6 +41,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h Fri Sep 23 12:48:13 2016
@@ -41,6 +41,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_values.clear();
@@ -71,14 +74,6 @@ public:
Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
const char *name, const char *value) override;
- //---------------------------------------------------------------------
- // String value getters and setters
- //---------------------------------------------------------------------
- const char *GetStringValueForKey(const ConstString &key);
-
- bool SetStringValueForKey(const ConstString &key, const char *value,
- bool can_replace = true);
-
bool SetValueForKey(const ConstString &key,
const lldb::OptionValueSP &value_sp,
bool can_replace = true);
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h Fri Sep 23 12:48:13 2016
@@ -50,6 +50,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Fri Sep 23 12:48:13 2016
@@ -42,6 +42,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h Fri Sep 23 12:48:13 2016
@@ -40,6 +40,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value.Clear();
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h Fri Sep 23 12:48:13 2016
@@ -41,6 +41,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h Fri Sep 23 12:48:13 2016
@@ -38,6 +38,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h Fri Sep 23 12:48:13 2016
@@ -44,6 +44,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h Fri Sep 23 12:48:13 2016
@@ -38,6 +38,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_path_mappings.Clear(m_notify_changes);
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Fri Sep 23 12:48:13 2016
@@ -46,6 +46,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
uint32_t dump_mask) override;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h Fri Sep 23 12:48:13 2016
@@ -38,6 +38,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_regex.Clear();
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h Fri Sep 23 12:48:13 2016
@@ -53,6 +53,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueString.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueString.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueString.h Fri Sep 23 12:48:13 2016
@@ -87,6 +87,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
@@ -105,7 +108,7 @@ public:
const Flags &GetOptions() const { return m_options; }
const char *operator=(const char *value) {
- SetCurrentValue(value);
+ SetCurrentValue(llvm::StringRef::withNullAsEmpty(value));
return m_current_value.c_str();
}
@@ -115,7 +118,8 @@ public:
const char *GetDefaultValue() const { return m_default_value.c_str(); }
llvm::StringRef GetDefaultValueAsRef() const { return m_default_value; }
- Error SetCurrentValue(const char *value);
+ Error SetCurrentValue(const char *) = delete;
+ Error SetCurrentValue(llvm::StringRef value);
Error AppendToCurrentValue(const char *value);
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h Fri Sep 23 12:48:13 2016
@@ -38,7 +38,8 @@ public:
// string isn't a uint64_t value or any other error occurs, return an
// empty lldb::OptionValueSP and fill error in with the correct stuff.
//---------------------------------------------------------------------
- static lldb::OptionValueSP Create(const char *value_cstr, Error &error);
+ static lldb::OptionValueSP Create(const char *, Error &) = delete;
+ static lldb::OptionValueSP Create(llvm::StringRef value_str, Error &error);
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
@@ -51,6 +52,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_current_value = m_default_value;
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h Fri Sep 23 12:48:13 2016
@@ -39,6 +39,9 @@ public:
Error
SetValueFromString(llvm::StringRef value,
VarSetOperationType op = eVarSetOperationAssign) override;
+ Error
+ SetValueFromString(const char *,
+ VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
m_uuid.Clear();
Modified: lldb/trunk/include/lldb/Interpreter/Options.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Options.h Fri Sep 23 12:48:13 2016
@@ -341,8 +341,10 @@ public:
virtual llvm::ArrayRef<OptionDefinition> GetDefinitions() = 0;
- virtual Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ virtual Error SetOptionValue(uint32_t option_idx,
+ llvm::StringRef option_value,
ExecutionContext *execution_context) = 0;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0;
Modified: lldb/trunk/include/lldb/Target/Language.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Language.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Language.h (original)
+++ lldb/trunk/include/lldb/Target/Language.h Fri Sep 23 12:48:13 2016
@@ -142,7 +142,8 @@ public:
// These are accessors for general information about the Languages lldb knows
// about:
- static lldb::LanguageType GetLanguageTypeFromString(const char *string);
+ static lldb::LanguageType
+ GetLanguageTypeFromString(const char *string) = delete;
static lldb::LanguageType GetLanguageTypeFromString(llvm::StringRef string);
static const char *GetNameForLanguageType(lldb::LanguageType language);
Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Fri Sep 23 12:48:13 2016
@@ -1089,7 +1089,7 @@ public:
~OptionGroupPlatformRSync() override = default;
lldb_private::Error
- SetOptionValue(uint32_t option_idx, const char *option_value,
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
void OptionParsingStarting(ExecutionContext *execution_context) override;
@@ -1118,7 +1118,7 @@ public:
~OptionGroupPlatformSSH() override = default;
lldb_private::Error
- SetOptionValue(uint32_t option_idx, const char *option_value,
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
void OptionParsingStarting(ExecutionContext *execution_context) override;
@@ -1145,7 +1145,7 @@ public:
~OptionGroupPlatformCaching() override = default;
lldb_private::Error
- SetOptionValue(uint32_t option_idx, const char *option_value,
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/source/API/SBLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLanguageRuntime.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLanguageRuntime.cpp (original)
+++ lldb/trunk/source/API/SBLanguageRuntime.cpp Fri Sep 23 12:48:13 2016
@@ -15,7 +15,8 @@ using namespace lldb_private;
lldb::LanguageType
SBLanguageRuntime::GetLanguageTypeFromString(const char *string) {
- return Language::GetLanguageTypeFromString(string);
+ return Language::GetLanguageTypeFromString(
+ llvm::StringRef::withNullAsEmpty(string));
}
const char *
Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Sep 23 12:48:13 2016
@@ -217,7 +217,8 @@ public:
break;
case 'E': {
- LanguageType language = Language::GetLanguageTypeFromString(option_arg);
+ LanguageType language =
+ Language::GetLanguageTypeFromString(option_strref);
switch (language) {
case eLanguageTypeC89:
@@ -304,7 +305,7 @@ public:
}
case 'L':
- m_language = Language::GetLanguageTypeFromString(option_arg);
+ m_language = Language::GetLanguageTypeFromString(option_strref);
if (m_language == eLanguageTypeUnknown)
error.SetErrorStringWithFormat(
"Unknown language type: '%s' for breakpoint", option_arg);
@@ -1772,28 +1773,29 @@ public:
return llvm::makeArrayRef(g_breakpoint_name_options);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option = g_breakpoint_name_options[option_idx].short_option;
- llvm::StringRef option_strref(option_value ? option_value : "");
switch (short_option) {
case 'N':
- if (BreakpointID::StringIsBreakpointName(option_strref, error) &&
+ if (BreakpointID::StringIsBreakpointName(option_value, error) &&
error.Success())
- m_name.SetValueFromString(option_strref);
+ m_name.SetValueFromString(option_value);
break;
case 'B':
if (m_breakpoint.SetValueFromString(option_value).Fail())
error.SetErrorStringWithFormat(
- "unrecognized value \"%s\" for breakpoint", option_value);
+ "unrecognized value \"%s\" for breakpoint",
+ option_value.str().c_str());
break;
case 'D':
if (m_use_dummy.SetValueFromString(option_value).Fail())
error.SetErrorStringWithFormat(
- "unrecognized value \"%s\" for use-dummy", option_value);
+ "unrecognized value \"%s\" for use-dummy",
+ option_value.str().c_str());
break;
default:
@@ -1803,6 +1805,7 @@ public:
}
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_name.Clear();
Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Fri Sep 23 12:48:13 2016
@@ -301,7 +301,8 @@ are no syntax errors may indicate that a
case 's':
m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
- option_arg, g_breakpoint_add_options[option_idx].enum_values,
+ llvm::StringRef::withNullAsEmpty(option_arg),
+ g_breakpoint_add_options[option_idx].enum_values,
eScriptLanguageNone, error);
if (m_script_language == eScriptLanguagePython ||
Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Sep 23 12:48:13 2016
@@ -70,22 +70,25 @@ protected:
ExecutionContext *execution_context) override {
Error error;
const int short_option = m_getopt_table[option_idx].val;
+ llvm::StringRef option_strref =
+ llvm::StringRef::withNullAsEmpty(option_arg);
switch (short_option) {
case 'c':
- error = m_count.SetValueFromString(option_arg, eVarSetOperationAssign);
+ error =
+ m_count.SetValueFromString(option_strref, eVarSetOperationAssign);
break;
case 's':
if (option_arg && strcmp("end", option_arg) == 0) {
m_start_idx.SetCurrentValue(UINT64_MAX);
m_start_idx.SetOptionWasSet();
} else
- error = m_start_idx.SetValueFromString(option_arg,
+ error = m_start_idx.SetValueFromString(option_strref,
eVarSetOperationAssign);
break;
case 'e':
- error =
- m_stop_idx.SetValueFromString(option_arg, eVarSetOperationAssign);
+ error = m_stop_idx.SetValueFromString(option_strref,
+ eVarSetOperationAssign);
break;
case 'C':
m_clear.SetCurrentValue(true);
@@ -260,18 +263,20 @@ protected:
ExecutionContext *execution_context) override {
Error error;
const int short_option = m_getopt_table[option_idx].val;
+ llvm::StringRef option_strref =
+ llvm::StringRef::withNullAsEmpty(option_arg);
switch (short_option) {
case 'e':
- error = m_stop_on_error.SetValueFromString(option_arg);
+ error = m_stop_on_error.SetValueFromString(option_strref);
break;
case 'c':
- error = m_stop_on_continue.SetValueFromString(option_arg);
+ error = m_stop_on_continue.SetValueFromString(option_strref);
break;
case 's':
- error = m_silent_run.SetValueFromString(option_arg);
+ error = m_silent_run.SetValueFromString(option_strref);
break;
default:
@@ -371,20 +376,21 @@ protected:
return llvm::makeArrayRef(g_alias_options);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option = GetDefinitions()[option_idx].short_option;
+ std::string option_str(option_value);
switch (short_option) {
case 'h':
- m_help.SetCurrentValue(option_value);
+ m_help.SetCurrentValue(option_str);
m_help.SetOptionWasSet();
break;
case 'H':
- m_long_help.SetCurrentValue(option_value);
+ m_long_help.SetCurrentValue(option_str);
m_long_help.SetOptionWasSet();
break;
@@ -396,6 +402,7 @@ protected:
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_help.Clear();
@@ -1645,7 +1652,8 @@ protected:
case 's':
m_synchronicity =
(ScriptedCommandSynchronicity)Args::StringToOptionEnum(
- option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
+ llvm::StringRef::withNullAsEmpty(option_arg),
+ GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
error.SetErrorStringWithFormat(
"unrecognized value for synchronicity '%s'", option_arg);
Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Fri Sep 23 12:48:13 2016
@@ -70,11 +70,10 @@ static OptionDefinition g_expression_opt
};
Error CommandObjectExpression::CommandOptions::SetOptionValue(
- uint32_t option_idx, const char *option_arg,
+ uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
- auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg);
const int short_option = GetDefinitions()[option_idx].short_option;
switch (short_option) {
@@ -82,66 +81,68 @@ Error CommandObjectExpression::CommandOp
language = Language::GetLanguageTypeFromString(option_arg);
if (language == eLanguageTypeUnknown)
error.SetErrorStringWithFormat(
- "unknown language type: '%s' for expression", option_arg);
+ "unknown language type: '%s' for expression",
+ option_arg.str().c_str());
break;
case 'a': {
bool success;
bool result;
- result = Args::StringToBoolean(option_strref, true, &success);
+ result = Args::StringToBoolean(option_arg, true, &success);
if (!success)
error.SetErrorStringWithFormat(
- "invalid all-threads value setting: \"%s\"", option_arg);
+ "invalid all-threads value setting: \"%s\"",
+ option_arg.str().c_str());
else
try_all_threads = result;
} break;
case 'i': {
bool success;
- bool tmp_value = Args::StringToBoolean(option_strref, true, &success);
+ bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
if (success)
ignore_breakpoints = tmp_value;
else
error.SetErrorStringWithFormat(
- "could not convert \"%s\" to a boolean value.", option_arg);
+ "could not convert \"%s\" to a boolean value.",
+ option_arg.str().c_str());
break;
}
case 'j': {
bool success;
- bool tmp_value = Args::StringToBoolean(option_strref, true, &success);
+ bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
if (success)
allow_jit = tmp_value;
else
error.SetErrorStringWithFormat(
- "could not convert \"%s\" to a boolean value.", option_arg);
+ "could not convert \"%s\" to a boolean value.",
+ option_arg.str().c_str());
break;
}
- case 't': {
- bool success;
- uint32_t result;
- result = StringConvert::ToUInt32(option_arg, 0, 0, &success);
- if (success)
- timeout = result;
- else
+ case 't':
+ if (option_arg.getAsInteger(0, timeout)) {
+ timeout = 0;
error.SetErrorStringWithFormat("invalid timeout setting \"%s\"",
- option_arg);
- } break;
+ option_arg.str().c_str());
+ }
+ break;
case 'u': {
bool success;
- bool tmp_value = Args::StringToBoolean(option_strref, true, &success);
+ bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
if (success)
unwind_on_error = tmp_value;
else
error.SetErrorStringWithFormat(
- "could not convert \"%s\" to a boolean value.", option_arg);
+ "could not convert \"%s\" to a boolean value.",
+ option_arg.str().c_str());
break;
}
case 'v':
- if (!option_arg) {
+ if (!option_arg.empty()) {
m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull;
break;
}
@@ -150,7 +151,8 @@ Error CommandObjectExpression::CommandOp
option_arg, GetDefinitions()[option_idx].enum_values, 0, error);
if (!error.Success())
error.SetErrorStringWithFormat(
- "unrecognized value for description-verbosity '%s'", option_arg);
+ "unrecognized value for description-verbosity '%s'",
+ option_arg.str().c_str());
break;
case 'g':
@@ -165,12 +167,13 @@ Error CommandObjectExpression::CommandOp
case 'X': {
bool success;
- bool tmp_value = Args::StringToBoolean(option_strref, true, &success);
+ bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
if (success)
auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo;
else
error.SetErrorStringWithFormat(
- "could not convert \"%s\" to a boolean value.", option_arg);
+ "could not convert \"%s\" to a boolean value.",
+ option_arg.str().c_str());
break;
}
Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Fri Sep 23 12:48:13 2016
@@ -34,8 +34,9 @@ public:
llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override;
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override;
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Sep 23 12:48:13 2016
@@ -73,17 +73,18 @@ public:
return llvm::makeArrayRef(g_read_memory_options);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option = g_read_memory_options[option_idx].short_option;
switch (short_option) {
case 'l':
- error = m_num_per_line.SetValueFromString(option_arg);
+ error = m_num_per_line.SetValueFromString(option_value);
if (m_num_per_line.GetCurrentValue() == 0)
error.SetErrorStringWithFormat(
- "invalid value for --num-per-line option '%s'", option_arg);
+ "invalid value for --num-per-line option '%s'",
+ option_value.str().c_str());
break;
case 'b':
@@ -91,7 +92,7 @@ public:
break;
case 't':
- error = m_view_as_type.SetValueFromString(option_arg);
+ error = m_view_as_type.SetValueFromString(option_value);
break;
case 'r':
@@ -99,7 +100,7 @@ public:
break;
case 'E':
- error = m_offset.SetValueFromString(option_arg);
+ error = m_offset.SetValueFromString(option_value);
break;
default:
@@ -109,6 +110,7 @@ public:
}
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_num_per_line.Clear();
@@ -908,7 +910,7 @@ public:
return llvm::makeArrayRef(g_memory_find_option_table);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option =
@@ -916,20 +918,20 @@ public:
switch (short_option) {
case 'e':
- m_expr.SetValueFromString(option_arg);
+ m_expr.SetValueFromString(option_value);
break;
case 's':
- m_string.SetValueFromString(option_arg);
+ m_string.SetValueFromString(option_value);
break;
case 'c':
- if (m_count.SetValueFromString(option_arg).Fail())
+ if (m_count.SetValueFromString(option_value).Fail())
error.SetErrorString("unrecognized value for count");
break;
case 'o':
- if (m_offset.SetValueFromString(option_arg).Fail())
+ if (m_offset.SetValueFromString(option_value).Fail())
error.SetErrorString("unrecognized value for dump-offset");
break;
@@ -940,6 +942,7 @@ public:
}
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_expr.Clear();
@@ -1204,7 +1207,7 @@ public:
return llvm::makeArrayRef(g_memory_write_option_table);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option =
@@ -1212,20 +1215,19 @@ public:
switch (short_option) {
case 'i':
- m_infile.SetFile(option_arg, true);
+ m_infile.SetFile(option_value, true);
if (!m_infile.Exists()) {
m_infile.Clear();
error.SetErrorStringWithFormat("input file does not exist: '%s'",
- option_arg);
+ option_value.str().c_str());
}
break;
case 'o': {
- bool success;
- m_infile_offset = StringConvert::ToUInt64(option_arg, 0, 0, &success);
- if (!success) {
+ if (option_value.getAsInteger(0, m_infile_offset)) {
+ m_infile_offset = 0;
error.SetErrorStringWithFormat("invalid offset string '%s'",
- option_arg);
+ option_value.str().c_str());
}
} break;
@@ -1236,6 +1238,7 @@ public:
}
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_infile.Clear();
Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Fri Sep 23 12:48:13 2016
@@ -34,8 +34,10 @@
using namespace lldb;
using namespace lldb_private;
-static mode_t ParsePermissionString(const char *permissions) {
- if (strlen(permissions) != 9)
+static mode_t ParsePermissionString(const char *) = delete;
+
+static mode_t ParsePermissionString(llvm::StringRef permissions) {
+ if (permissions.size() != 9)
return (mode_t)(-1);
bool user_r, user_w, user_x, group_r, group_w, group_x, world_r, world_w,
world_x;
@@ -76,32 +78,31 @@ static OptionDefinition g_permissions_op
// clang-format on
};
-class OptionPermissions : public lldb_private::OptionGroup {
+class OptionPermissions : public OptionGroup {
public:
OptionPermissions() {}
~OptionPermissions() override = default;
lldb_private::Error
- SetOptionValue(uint32_t option_idx, const char *option_arg,
+ SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) override {
Error error;
char short_option = (char)GetDefinitions()[option_idx].short_option;
switch (short_option) {
case 'v': {
- bool ok;
- uint32_t perms = StringConvert::ToUInt32(option_arg, 777, 8, &ok);
- if (!ok)
+ if (option_arg.getAsInteger(8, m_permissions)) {
+ m_permissions = 0777;
error.SetErrorStringWithFormat("invalid value for permissions: %s",
- option_arg);
- else
- m_permissions = perms;
+ option_arg.str().c_str());
+ }
+
} break;
case 's': {
mode_t perms = ParsePermissionString(option_arg);
if (perms == (mode_t)-1)
error.SetErrorStringWithFormat("invalid value for permissions: %s",
- option_arg);
+ option_arg.str().c_str());
else
m_permissions = perms;
} break;
Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Fri Sep 23 12:48:13 2016
@@ -260,7 +260,7 @@ protected:
alternate_name.Clear();
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option = GetDefinitions()[option_idx].short_option;
@@ -294,6 +294,7 @@ protected:
}
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
// Instance variables to hold the values for command options.
OptionValueArray set_indexes;
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Fri Sep 23 12:48:13 2016
@@ -1980,8 +1980,8 @@ public:
switch (short_option) {
case 's':
m_sort_order = (SortOrder)Args::StringToOptionEnum(
- option_arg, GetDefinitions()[option_idx].enum_values,
- eSortOrderNone, error);
+ llvm::StringRef::withNullAsEmpty(option_arg),
+ GetDefinitions()[option_idx].enum_values, eSortOrderNone, error);
break;
default:
Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Sep 23 12:48:13 2016
@@ -381,7 +381,7 @@ public:
OptionEnumValueElement *enum_values =
GetDefinitions()[option_idx].enum_values;
m_run_mode = (lldb::RunMode)Args::StringToOptionEnum(
- option_arg, enum_values, eOnlyDuringStepping, error);
+ option_strref, enum_values, eOnlyDuringStepping, error);
} break;
case 'e': {
@@ -957,7 +957,8 @@ public:
OptionEnumValueElement *enum_values =
GetDefinitions()[option_idx].enum_values;
lldb::RunMode run_mode = (lldb::RunMode)Args::StringToOptionEnum(
- option_arg, enum_values, eOnlyDuringStepping, error);
+ llvm::StringRef::withNullAsEmpty(option_arg), enum_values,
+ eOnlyDuringStepping, error);
if (error.Success()) {
if (run_mode == eAllThreads)
Modified: lldb/trunk/source/Commands/CommandObjectType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectType.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectType.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectType.cpp Fri Sep 23 12:48:13 2016
@@ -562,7 +562,7 @@ private:
m_custom_type_name.clear();
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
const int short_option =
@@ -571,11 +571,10 @@ private:
switch (short_option) {
case 'C':
- m_cascade = Args::StringToBoolean(
- llvm::StringRef::withNullAsEmpty(option_value), true, &success);
+ m_cascade = Args::StringToBoolean(option_value, true, &success);
if (!success)
error.SetErrorStringWithFormat("invalid value for cascade: %s",
- option_value);
+ option_value.str().c_str());
break;
case 'p':
m_skip_pointers = true;
@@ -600,6 +599,7 @@ private:
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
// Instance variables to hold the values for command options.
@@ -784,7 +784,8 @@ protected:
m_category = std::string(option_arg);
break;
case 'l':
- m_language = Language::GetLanguageTypeFromString(option_arg);
+ m_language = Language::GetLanguageTypeFromString(
+ llvm::StringRef::withNullAsEmpty(option_arg));
break;
default:
error.SetErrorStringWithFormat("unrecognized option '%c'",
@@ -1031,14 +1032,15 @@ class CommandObjectTypeFormatterList : p
ExecutionContext *execution_context) override {
Error error;
const int short_option = m_getopt_table[option_idx].val;
-
+ llvm::StringRef option_strref =
+ llvm::StringRef::withNullAsEmpty(option_arg);
switch (short_option) {
case 'w':
- m_category_regex.SetCurrentValue(option_arg);
+ m_category_regex.SetCurrentValue(option_strref);
m_category_regex.SetOptionWasSet();
break;
case 'l':
- error = m_category_language.SetValueFromString(option_arg);
+ error = m_category_language.SetValueFromString(option_strref);
if (error.Success())
m_category_language.SetOptionWasSet();
break;
@@ -1814,10 +1816,11 @@ class CommandObjectTypeCategoryDefine :
switch (short_option) {
case 'e':
- m_define_enabled.SetValueFromString("true");
+ m_define_enabled.SetValueFromString(llvm::StringRef("true"));
break;
case 'l':
- error = m_cate_language.SetValueFromString(option_arg);
+ error = m_cate_language.SetValueFromString(
+ llvm::StringRef::withNullAsEmpty(option_arg));
break;
default:
error.SetErrorStringWithFormat("unrecognized option '%c'",
@@ -1920,7 +1923,8 @@ class CommandObjectTypeCategoryEnable :
switch (short_option) {
case 'l':
if (option_arg) {
- m_language = Language::GetLanguageTypeFromString(option_arg);
+ m_language = Language::GetLanguageTypeFromString(
+ llvm::StringRef::withNullAsEmpty(option_arg));
if (m_language == lldb::eLanguageTypeUnknown)
error.SetErrorStringWithFormat("unrecognized language '%s'",
option_arg);
@@ -2097,7 +2101,8 @@ class CommandObjectTypeCategoryDisable :
switch (short_option) {
case 'l':
if (option_arg) {
- m_language = Language::GetLanguageTypeFromString(option_arg);
+ m_language = Language::GetLanguageTypeFromString(
+ llvm::StringRef::withNullAsEmpty(option_arg));
if (m_language == lldb::eLanguageTypeUnknown)
error.SetErrorStringWithFormat("unrecognized language '%s'",
option_arg);
@@ -2802,7 +2807,7 @@ protected:
return llvm::makeArrayRef(g_type_lookup_options);
}
- Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
ExecutionContext *execution_context) override {
Error error;
@@ -2825,6 +2830,7 @@ protected:
return error;
}
+ Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_show_help = false;
Modified: lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp Fri Sep 23 12:48:13 2016
@@ -331,8 +331,9 @@ are no syntax errors may indicate that a
case 's':
m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
- option_arg, GetDefinitions()[option_idx].enum_values,
- eScriptLanguageNone, error);
+ llvm::StringRef::withNullAsEmpty(option_arg),
+ GetDefinitions()[option_idx].enum_values, eScriptLanguageNone,
+ error);
m_use_script_language = (m_script_language == eScriptLanguagePython ||
m_script_language == eScriptLanguageDefault);
Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Fri Sep 23 12:48:13 2016
@@ -824,29 +824,32 @@ const char *Args::GetShellSafeArgument(c
return safe_arg.c_str();
}
-int64_t Args::StringToOptionEnum(const char *s,
+int64_t Args::StringToOptionEnum(llvm::StringRef s,
OptionEnumValueElement *enum_values,
int32_t fail_value, Error &error) {
- if (enum_values) {
- if (s && s[0]) {
- for (int i = 0; enum_values[i].string_value != nullptr; i++) {
- if (strstr(enum_values[i].string_value, s) ==
- enum_values[i].string_value) {
- error.Clear();
- return enum_values[i].value;
- }
- }
- }
-
- StreamString strm;
- strm.PutCString("invalid enumeration value, valid values are: ");
- 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());
- } else {
+ error.Clear();
+ if (!enum_values) {
error.SetErrorString("invalid enumeration argument");
+ return fail_value;
+ }
+
+ if (s.empty()) {
+ error.SetErrorString("empty enumeration string");
+ return fail_value;
+ }
+
+ for (int i = 0; enum_values[i].string_value != nullptr; i++) {
+ llvm::StringRef this_enum(enum_values[i].string_value);
+ if (this_enum.startswith(s))
+ return enum_values[i].value;
+ }
+
+ StreamString strm;
+ strm.PutCString("invalid enumeration value, valid values are: ");
+ 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());
return fail_value;
}
Modified: lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupArchitecture.cpp Fri Sep 23 12:48:13 2016
@@ -42,7 +42,7 @@ bool OptionGroupArchitecture::GetArchite
}
Error OptionGroupArchitecture::SetOptionValue(
- uint32_t option_idx, const char *option_arg,
+ uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
const int short_option = g_option_table[option_idx].short_option;
Modified: lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupBoolean.cpp Fri Sep 23 12:48:13 2016
@@ -40,7 +40,7 @@ OptionGroupBoolean::OptionGroupBoolean(u
OptionGroupBoolean::~OptionGroupBoolean() {}
Error OptionGroupBoolean::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_value,
ExecutionContext *execution_context) {
Error error;
if (m_option_definition.option_has_arg == OptionParser::eNoArgument) {
@@ -49,7 +49,7 @@ Error OptionGroupBoolean::SetOptionValue
m_value.SetCurrentValue(!m_value.GetDefaultValue());
m_value.SetOptionWasSet();
} else {
- error = m_value.SetValueFromString(option_arg);
+ error = m_value.SetValueFromString(option_value);
}
return error;
}
Modified: lldb/trunk/source/Interpreter/OptionGroupFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupFile.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupFile.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupFile.cpp Fri Sep 23 12:48:13 2016
@@ -38,7 +38,7 @@ OptionGroupFile::OptionGroupFile(uint32_
OptionGroupFile::~OptionGroupFile() {}
Error OptionGroupFile::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error(m_file.SetValueFromString(option_arg));
return error;
@@ -69,9 +69,9 @@ OptionGroupFileList::OptionGroupFileList
OptionGroupFileList::~OptionGroupFileList() {}
Error OptionGroupFileList::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_value,
ExecutionContext *execution_context) {
- Error error(m_file_list.SetValueFromString(option_arg));
+ Error error(m_file_list.SetValueFromString(option_value));
return error;
}
Modified: lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupFormat.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupFormat.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupFormat.cpp Fri Sep 23 12:48:13 2016
@@ -59,7 +59,7 @@ llvm::ArrayRef<OptionDefinition> OptionG
}
Error OptionGroupFormat::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
const int short_option = g_option_table[option_idx].short_option;
@@ -76,7 +76,7 @@ Error OptionGroupFormat::SetOptionValue(
error = m_count.SetValueFromString(option_arg);
if (m_count.GetCurrentValue() == 0)
error.SetErrorStringWithFormat("invalid --count option value '%s'",
- option_arg);
+ option_arg.str().c_str());
}
break;
@@ -87,41 +87,33 @@ Error OptionGroupFormat::SetOptionValue(
error = m_byte_size.SetValueFromString(option_arg);
if (m_byte_size.GetCurrentValue() == 0)
error.SetErrorStringWithFormat("invalid --size option value '%s'",
- option_arg);
+ option_arg.str().c_str());
}
break;
case 'G': {
- char *end = nullptr;
- const char *gdb_format_cstr = option_arg;
uint64_t count = 0;
- if (::isdigit(gdb_format_cstr[0])) {
- count = strtoull(gdb_format_cstr, &end, 0);
-
- if (option_arg != end)
- gdb_format_cstr =
- end; // We have a valid count, advance the string position
- else
- count = 0;
- }
+ llvm::StringRef gdb_format_str = option_arg;
+ gdb_format_str.consumeInteger(0, count);
Format format = eFormatDefault;
uint32_t byte_size = 0;
- while (ParserGDBFormatLetter(execution_context, gdb_format_cstr[0], format,
+ while (!gdb_format_str.empty() &&
+ ParserGDBFormatLetter(execution_context, gdb_format_str[0], format,
byte_size)) {
- ++gdb_format_cstr;
+ gdb_format_str = gdb_format_str.drop_front();
}
- // We the first character of the "gdb_format_cstr" is not the
+ // We the first character of the "gdb_format_str" is not the
// NULL terminator, we didn't consume the entire string and
// something is wrong. Also, if none of the format, size or count
// was specified correctly, then abort.
- if (gdb_format_cstr[0] ||
+ if (!gdb_format_str.empty() ||
(format == eFormatInvalid && byte_size == 0 && count == 0)) {
// Nothing got set correctly
error.SetErrorStringWithFormat("invalid gdb format string '%s'",
- option_arg);
+ option_arg.str().c_str());
return error;
}
Modified: lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupOutputFile.cpp Fri Sep 23 12:48:13 2016
@@ -39,7 +39,7 @@ llvm::ArrayRef<OptionDefinition> OptionG
}
Error OptionGroupOutputFile::SetOptionValue(
- uint32_t option_idx, const char *option_arg,
+ uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
const int short_option = g_option_table[option_idx].short_option;
Modified: lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupPlatform.cpp Fri Sep 23 12:48:13 2016
@@ -93,14 +93,13 @@ llvm::ArrayRef<OptionDefinition> OptionG
}
Error OptionGroupPlatform::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
if (!m_include_platform_option)
++option_idx;
const int short_option = g_option_table[option_idx].short_option;
- llvm::StringRef option_strref(option_arg ? option_arg : "");
switch (short_option) {
case 'p':
@@ -108,17 +107,18 @@ Error OptionGroupPlatform::SetOptionValu
break;
case 'v':
- if (!Args::StringToVersion(option_strref, m_os_version_major,
+ if (!Args::StringToVersion(option_arg, m_os_version_major,
m_os_version_minor, m_os_version_update))
- error.SetErrorStringWithFormat("invalid version string '%s'", option_arg);
+ error.SetErrorStringWithFormat("invalid version string '%s'",
+ option_arg.str().c_str());
break;
case 'b':
- m_sdk_build.SetCString(option_arg);
+ m_sdk_build.SetString(option_arg);
break;
case 'S':
- m_sdk_sysroot.SetCString(option_arg);
+ m_sdk_sysroot.SetString(option_arg);
break;
default:
Modified: lldb/trunk/source/Interpreter/OptionGroupString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupString.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupString.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupString.cpp Fri Sep 23 12:48:13 2016
@@ -39,7 +39,7 @@ OptionGroupString::OptionGroupString(uin
OptionGroupString::~OptionGroupString() {}
Error OptionGroupString::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
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=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupUInt64.cpp Fri Sep 23 12:48:13 2016
@@ -39,7 +39,7 @@ OptionGroupUInt64::OptionGroupUInt64(uin
OptionGroupUInt64::~OptionGroupUInt64() {}
Error OptionGroupUInt64::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
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=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupUUID.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupUUID.cpp Fri Sep 23 12:48:13 2016
@@ -32,7 +32,7 @@ llvm::ArrayRef<OptionDefinition> OptionG
}
Error OptionGroupUUID::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
const int short_option = g_option_table[option_idx].short_option;
Modified: lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupValueObjectDisplay.cpp Fri Sep 23 12:48:13 2016
@@ -77,14 +77,12 @@ OptionGroupValueObjectDisplay::GetDefini
}
Error OptionGroupValueObjectDisplay::SetOptionValue(
- uint32_t option_idx, const char *option_arg,
+ uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
const int short_option = g_option_table[option_idx].short_option;
bool success = false;
- auto option_strref = llvm::StringRef::withNullAsEmpty(option_arg);
-
switch (short_option) {
case 'd': {
int32_t result;
@@ -113,43 +111,49 @@ Error OptionGroupValueObjectDisplay::Set
break;
case 'D':
- max_depth = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid max depth '%s'", option_arg);
+ if (option_arg.getAsInteger(0, max_depth)) {
+ max_depth = UINT32_MAX;
+ error.SetErrorStringWithFormat("invalid max depth '%s'",
+ option_arg.str().c_str());
+ }
break;
case 'Z':
- elem_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid element count '%s'", option_arg);
+ if (option_arg.getAsInteger(0, elem_count)) {
+ elem_count = UINT32_MAX;
+ error.SetErrorStringWithFormat("invalid element count '%s'",
+ option_arg.str().c_str());
+ }
break;
case 'P':
- ptr_depth = StringConvert::ToUInt32(option_arg, 0, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid pointer depth '%s'", option_arg);
+ if (option_arg.getAsInteger(0, ptr_depth)) {
+ ptr_depth = 0;
+ error.SetErrorStringWithFormat("invalid pointer depth '%s'",
+ option_arg.str().c_str());
+ }
break;
case 'Y':
- if (option_arg) {
- no_summary_depth = StringConvert::ToUInt32(option_arg, 0, 0, &success);
- if (!success)
- error.SetErrorStringWithFormat("invalid pointer depth '%s'",
- option_arg);
- } else
+ if (option_arg.getAsInteger(0, no_summary_depth)) {
no_summary_depth = 1;
+ error.SetErrorStringWithFormat("invalid pointer depth '%s'",
+ option_arg.str().c_str());
+ }
break;
case 'S':
- use_synth = Args::StringToBoolean(option_strref, true, &success);
+ use_synth = Args::StringToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat("invalid synthetic-type '%s'", option_arg);
+ error.SetErrorStringWithFormat("invalid synthetic-type '%s'",
+ option_arg.str().c_str());
break;
case 'V':
- run_validator = Args::StringToBoolean(option_strref, true, &success);
+ run_validator = Args::StringToBoolean(option_arg, true, &success);
if (!success)
- error.SetErrorStringWithFormat("invalid validate '%s'", option_arg);
+ error.SetErrorStringWithFormat("invalid validate '%s'",
+ option_arg.str().c_str());
break;
default:
Modified: lldb/trunk/source/Interpreter/OptionGroupVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupVariable.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupVariable.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupVariable.cpp Fri Sep 23 12:48:13 2016
@@ -75,7 +75,7 @@ OptionGroupVariable::OptionGroupVariable
OptionGroupVariable::~OptionGroupVariable() {}
Error OptionGroupVariable::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
if (!include_frame_options)
Modified: lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupWatchpoint.cpp Fri Sep 23 12:48:13 2016
@@ -57,7 +57,7 @@ OptionGroupWatchpoint::OptionGroupWatchp
OptionGroupWatchpoint::~OptionGroupWatchpoint() {}
Error OptionGroupWatchpoint::SetOptionValue(
- uint32_t option_idx, const char *option_arg,
+ uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
const int short_option = g_option_table[option_idx].short_option;
Modified: lldb/trunk/source/Interpreter/OptionValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValue.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValue.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValue.cpp Fri Sep 23 12:48:13 2016
@@ -422,7 +422,7 @@ const char *OptionValue::GetStringValue(
bool OptionValue::SetStringValue(const char *new_value) {
OptionValueString *option_value = GetAsString();
if (option_value) {
- option_value->SetCurrentValue(new_value);
+ option_value->SetCurrentValue(llvm::StringRef::withNullAsEmpty(new_value));
return true;
}
return false;
@@ -548,7 +548,8 @@ lldb::OptionValueSP OptionValue::CreateV
}
if (value_sp)
- error = value_sp->SetValueFromString(value_cstr, eVarSetOperationAssign);
+ error = value_sp->SetValueFromString(
+ llvm::StringRef::withNullAsEmpty(value_cstr), eVarSetOperationAssign);
else
error.SetErrorString("unsupported type mask");
return value_sp;
Modified: lldb/trunk/source/Interpreter/OptionValueChar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueChar.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueChar.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueChar.cpp Fri Sep 23 12:48:13 2016
@@ -57,7 +57,7 @@ Error OptionValueChar::SetValueFromStrin
} break;
default:
- error = OptionValue::SetValueFromString(value.str().c_str(), op);
+ error = OptionValue::SetValueFromString(value, 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=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueDictionary.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueDictionary.cpp Fri Sep 23 12:48:13 2016
@@ -308,7 +308,8 @@ Error OptionValueDictionary::SetSubValue
const bool will_modify = true;
lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error));
if (value_sp)
- error = value_sp->SetValueFromString(value, op);
+ error = value_sp->SetValueFromString(
+ llvm::StringRef::withNullAsEmpty(value), op);
else {
if (error.AsCString() == nullptr)
error.SetErrorStringWithFormat("invalid value path '%s'", name);
@@ -325,33 +326,6 @@ OptionValueDictionary::GetValueForKey(co
return value_sp;
}
-const char *
-OptionValueDictionary::GetStringValueForKey(const ConstString &key) {
- collection::const_iterator pos = m_values.find(key);
- if (pos != m_values.end()) {
- OptionValueString *string_value = pos->second->GetAsString();
- if (string_value)
- return string_value->GetCurrentValue();
- }
- return nullptr;
-}
-
-bool OptionValueDictionary::SetStringValueForKey(const ConstString &key,
- const char *value,
- bool can_replace) {
- collection::const_iterator pos = m_values.find(key);
- if (pos != m_values.end()) {
- if (!can_replace)
- return false;
- if (pos->second->GetType() == OptionValue::eTypeString) {
- pos->second->SetValueFromString(value);
- return true;
- }
- }
- m_values[key] = OptionValueSP(new OptionValueString(value));
- return true;
-}
-
bool OptionValueDictionary::SetValueForKey(const ConstString &key,
const lldb::OptionValueSP &value_sp,
bool can_replace) {
Modified: lldb/trunk/source/Interpreter/OptionValueString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueString.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueString.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueString.cpp Fri Sep 23 12:48:13 2016
@@ -114,7 +114,7 @@ Error OptionValueString::SetValueFromStr
if (m_options.Test(eOptionEncodeCharacterEscapeSequences)) {
Args::EncodeEscapeSequences(value_str.c_str(), m_current_value);
} else {
- SetCurrentValue(value_str.c_str());
+ SetCurrentValue(value_str);
}
NotifyValueChanged();
break;
@@ -126,16 +126,13 @@ lldb::OptionValueSP OptionValueString::D
return OptionValueSP(new OptionValueString(*this));
}
-Error OptionValueString::SetCurrentValue(const char *value) {
+Error OptionValueString::SetCurrentValue(llvm::StringRef value) {
if (m_validator) {
- Error error(m_validator(value, m_validator_baton));
+ Error error(m_validator(value.str().c_str(), m_validator_baton));
if (error.Fail())
return error;
}
- if (value && value[0])
- m_current_value.assign(value);
- else
- m_current_value.clear();
+ m_current_value.assign(value);
return Error();
}
Modified: lldb/trunk/source/Interpreter/OptionValueUInt64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueUInt64.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueUInt64.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueUInt64.cpp Fri Sep 23 12:48:13 2016
@@ -20,10 +20,10 @@
using namespace lldb;
using namespace lldb_private;
-lldb::OptionValueSP OptionValueUInt64::Create(const char *value_cstr,
+lldb::OptionValueSP OptionValueUInt64::Create(llvm::StringRef value_str,
Error &error) {
lldb::OptionValueSP value_sp(new OptionValueUInt64());
- error = value_sp->SetValueFromString(value_cstr);
+ error = value_sp->SetValueFromString(value_str);
if (error.Fail())
value_sp.reset();
return value_sp;
Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Fri Sep 23 12:48:13 2016
@@ -913,8 +913,8 @@ Error OptionGroupOptions::SetOptionValue
Error error;
if (option_idx < m_option_infos.size()) {
error = m_option_infos[option_idx].option_group->SetOptionValue(
- m_option_infos[option_idx].option_index, option_value,
- execution_context);
+ m_option_infos[option_idx].option_index,
+ llvm::StringRef::withNullAsEmpty(option_value), execution_context);
} else {
error.SetErrorString("invalid option index"); // Shouldn't happen...
Modified: lldb/trunk/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Property.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Property.cpp (original)
+++ lldb/trunk/source/Interpreter/Property.cpp Fri Sep 23 12:48:13 2016
@@ -82,7 +82,9 @@ Property::Property(const PropertyDefinit
definition.enum_values, definition.default_uint_value);
m_value_sp.reset(enum_value);
if (definition.default_cstr_value) {
- if (enum_value->SetValueFromString(definition.default_cstr_value)
+ if (enum_value
+ ->SetValueFromString(
+ llvm::StringRef(definition.default_cstr_value))
.Success()) {
enum_value->SetDefaultValue(enum_value->GetCurrentValue());
// Call Clear() since we don't want the value to appear as
Modified: lldb/trunk/source/Target/Language.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Fri Sep 23 12:48:13 2016
@@ -171,10 +171,6 @@ struct language_name_pair language_names
static uint32_t num_languages =
sizeof(language_names) / sizeof(struct language_name_pair);
-LanguageType Language::GetLanguageTypeFromString(const char *s) {
- return GetLanguageTypeFromString(llvm::StringRef(s ? s : ""));
-}
-
LanguageType Language::GetLanguageTypeFromString(llvm::StringRef string) {
for (const auto &L : language_names) {
if (string.equals_lower(L.name))
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=282265&r1=282264&r2=282265&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Fri Sep 23 12:48:13 2016
@@ -1401,7 +1401,7 @@ void OptionGroupPlatformRSync::OptionPar
lldb_private::Error
OptionGroupPlatformRSync::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
char short_option = (char)GetDefinitions()[option_idx].short_option;
@@ -1447,7 +1447,7 @@ void OptionGroupPlatformSSH::OptionParsi
lldb_private::Error
OptionGroupPlatformSSH::SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+ llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
char short_option = (char)GetDefinitions()[option_idx].short_option;
@@ -1478,7 +1478,7 @@ void OptionGroupPlatformCaching::OptionP
}
lldb_private::Error OptionGroupPlatformCaching::SetOptionValue(
- uint32_t option_idx, const char *option_arg,
+ uint32_t option_idx, llvm::StringRef option_arg,
ExecutionContext *execution_context) {
Error error;
char short_option = (char)GetDefinitions()[option_idx].short_option;
More information about the lldb-commits
mailing list