Changeset View
Changeset View
Standalone View
Standalone View
lldb/trunk/source/Interpreter/OptionValueProperties.cpp
Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, | Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx, | ||||
VarSetOperationType op, | VarSetOperationType op, | ||||
llvm::StringRef name, | llvm::StringRef name, | ||||
llvm::StringRef value) { | llvm::StringRef value) { | ||||
Status error; | Status error; | ||||
const bool will_modify = true; | const bool will_modify = true; | ||||
llvm::SmallVector<llvm::StringRef, 8> components; | |||||
name.split(components, '.'); | |||||
bool name_contains_experimental = false; | |||||
for (const auto &part : components) | |||||
if (Properties::IsSettingExperimental(part)) | |||||
name_contains_experimental = true; | |||||
lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error)); | lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error)); | ||||
if (value_sp) | if (value_sp) | ||||
error = value_sp->SetValueFromString(value, op); | error = value_sp->SetValueFromString(value, op); | ||||
else { | else { | ||||
if (error.AsCString() == nullptr) | // Don't set an error if the path contained .experimental. - those are | ||||
// allowed to be missing and should silently fail. | |||||
if (name_contains_experimental == false && error.AsCString() == nullptr) { | |||||
error.SetErrorStringWithFormat("invalid value path '%s'", name.str().c_str()); | error.SetErrorStringWithFormat("invalid value path '%s'", name.str().c_str()); | ||||
} | } | ||||
} | |||||
return error; | return error; | ||||
} | } | ||||
uint32_t | uint32_t | ||||
OptionValueProperties::GetPropertyIndex(const ConstString &name) const { | OptionValueProperties::GetPropertyIndex(const ConstString &name) const { | ||||
return m_name_to_index.Find(name, SIZE_MAX); | return m_name_to_index.Find(name, SIZE_MAX); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 453 Lines • Show Last 20 Lines |