[Lldb-commits] [lldb] ef447fe - [lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs
Tatyana Krasnukha via lldb-commits
lldb-commits at lists.llvm.org
Sun Feb 28 08:24:26 PST 2021
Author: Tatyana Krasnukha
Date: 2021-02-28T19:23:22+03:00
New Revision: ef447fe0088cacc38027028d4c43c1938d3eb9e7
URL: https://github.com/llvm/llvm-project/commit/ef447fe0088cacc38027028d4c43c1938d3eb9e7
DIFF: https://github.com/llvm/llvm-project/commit/ef447fe0088cacc38027028d4c43c1938d3eb9e7.diff
LOG: [lldb] OptionValueProperties::Get[Set]PropertyAtIndexAsArgs should handle OptionValueArgs
Added:
Modified:
lldb/source/Interpreter/OptionValueProperties.cpp
Removed:
################################################################################
diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp
index 22447a82d811..886af3269a32 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -248,38 +248,50 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValueLanguage(
bool OptionValueProperties::GetPropertyAtIndexAsArgs(
const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const {
const Property *property = GetPropertyAtIndex(exe_ctx, false, idx);
- if (property) {
- OptionValue *value = property->GetValue().get();
- if (value) {
- const OptionValueArray *array = value->GetAsArray();
- if (array)
- return array->GetArgs(args);
- else {
- const OptionValueDictionary *dict = value->GetAsDictionary();
- if (dict)
- return dict->GetArgs(args);
- }
- }
- }
+ if (!property)
+ return false;
+
+ OptionValue *value = property->GetValue().get();
+ if (!value)
+ return false;
+
+ const OptionValueArgs *arguments = value->GetAsArgs();
+ if (arguments)
+ return arguments->GetArgs(args);
+
+ const OptionValueArray *array = value->GetAsArray();
+ if (array)
+ return array->GetArgs(args);
+
+ const OptionValueDictionary *dict = value->GetAsDictionary();
+ if (dict)
+ return dict->GetArgs(args);
+
return false;
}
bool OptionValueProperties::SetPropertyAtIndexFromArgs(
const ExecutionContext *exe_ctx, uint32_t idx, const Args &args) {
const Property *property = GetPropertyAtIndex(exe_ctx, true, idx);
- if (property) {
- OptionValue *value = property->GetValue().get();
- if (value) {
- OptionValueArray *array = value->GetAsArray();
- if (array)
- return array->SetArgs(args, eVarSetOperationAssign).Success();
- else {
- OptionValueDictionary *dict = value->GetAsDictionary();
- if (dict)
- return dict->SetArgs(args, eVarSetOperationAssign).Success();
- }
- }
- }
+ if (!property)
+ return false;
+
+ OptionValue *value = property->GetValue().get();
+ if (!value)
+ return false;
+
+ OptionValueArgs *arguments = value->GetAsArgs();
+ if (arguments)
+ return arguments->SetArgs(args, eVarSetOperationAssign).Success();
+
+ OptionValueArray *array = value->GetAsArray();
+ if (array)
+ return array->SetArgs(args, eVarSetOperationAssign).Success();
+
+ OptionValueDictionary *dict = value->GetAsDictionary();
+ if (dict)
+ return dict->SetArgs(args, eVarSetOperationAssign).Success();
+
return false;
}
More information about the lldb-commits
mailing list