Skip to content

Commit

Permalink
[lldb] Remove unused will_modify argument (NFC)
Browse files Browse the repository at this point in the history
Various OptionValue related classes are passing around will_modify but
the value is never used. This patch simplifies the interfaces by
removing the redundant argument.
  • Loading branch information
JDevlieghere committed May 2, 2023
1 parent 3c83afb commit ddd9358
Show file tree
Hide file tree
Showing 21 changed files with 113 additions and 132 deletions.
1 change: 0 additions & 1 deletion lldb/include/lldb/Core/UserSettingsController.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class Properties {

virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx,
llvm::StringRef property_path,
bool will_modify,
Status &error) const;

virtual Status SetPropertyValue(const ExecutionContext *exe_ctx,
Expand Down
1 change: 0 additions & 1 deletion lldb/include/lldb/Interpreter/OptionValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class OptionValue {
// Subclasses can override these functions
virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name,
bool will_modify,
Status &error) const {
error.SetErrorStringWithFormat("'%s' is not a value subvalue", name.str().c_str());
return lldb::OptionValueSP();
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Interpreter/OptionValueArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class OptionValueArray : public Cloneable<OptionValueArray, OptionValue> {
bool IsAggregateValue() const override { return true; }

lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name, bool will_modify,
llvm::StringRef name,
Status &error) const override;

// Subclass specific functions
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Interpreter/OptionValueDictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class OptionValueDictionary
lldb::OptionValueSP GetValueForKey(llvm::StringRef key) const;

lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name, bool will_modify,
llvm::StringRef name,
Status &error) const override;

Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
Expand Down
32 changes: 16 additions & 16 deletions lldb/include/lldb/Interpreter/OptionValueProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,30 +79,28 @@ class OptionValueProperties
// not be a path to a property path that refers to a property within a
// property
virtual const Property *GetProperty(const ExecutionContext *exe_ctx,
bool will_modify,

ConstString name) const;

virtual const Property *GetPropertyAtIndex(const ExecutionContext *exe_ctx,
bool will_modify,

uint32_t idx) const;

// Property can be be a property path like
// "target.process.extra-startup-command"
virtual const Property *GetPropertyAtPath(const ExecutionContext *exe_ctx,
bool will_modify,
llvm::StringRef property_path) const;
virtual const Property *
GetPropertyAtPath(const ExecutionContext *exe_ctx,

llvm::StringRef property_path) const;

virtual lldb::OptionValueSP
GetPropertyValueAtIndex(const ExecutionContext *exe_ctx, bool will_modify,
uint32_t idx) const;
GetPropertyValueAtIndex(const ExecutionContext *exe_ctx, uint32_t idx) const;

virtual lldb::OptionValueSP GetValueForKey(const ExecutionContext *exe_ctx,
ConstString key,
bool value_will_be_modified) const;
ConstString key) const;

lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name,
bool value_will_be_modified,
Status &error) const override;

Status SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
Expand Down Expand Up @@ -182,23 +180,25 @@ class OptionValueProperties

OptionValueString *
GetPropertyAtIndexAsOptionValueString(const ExecutionContext *exe_ctx,
bool will_modify, uint32_t idx) const;
uint32_t idx) const;

OptionValueFileSpec *
GetPropertyAtIndexAsOptionValueFileSpec(const ExecutionContext *exe_ctx,
bool will_modify, uint32_t idx) const;
uint32_t idx) const;

FileSpec GetPropertyAtIndexAsFileSpec(const ExecutionContext *exe_ctx,
uint32_t idx) const;

bool SetPropertyAtIndexAsFileSpec(const ExecutionContext *exe_ctx,
uint32_t idx, const FileSpec &file_spec);

OptionValuePathMappings *GetPropertyAtIndexAsOptionValuePathMappings(
const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
OptionValuePathMappings *
GetPropertyAtIndexAsOptionValuePathMappings(const ExecutionContext *exe_ctx,
uint32_t idx) const;

OptionValueFileSpecList *GetPropertyAtIndexAsOptionValueFileSpecList(
const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
OptionValueFileSpecList *
GetPropertyAtIndexAsOptionValueFileSpecList(const ExecutionContext *exe_ctx,
uint32_t idx) const;

void AppendProperty(ConstString name, llvm::StringRef desc, bool is_global,
const lldb::OptionValueSP &value_sp);
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/API/SBDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ SBDebugger::GetInternalVariableValue(const char *var_name,
ExecutionContext exe_ctx(
debugger_sp->GetCommandInterpreter().GetExecutionContext());
lldb::OptionValueSP value_sp(
debugger_sp->GetPropertyValue(&exe_ctx, var_name, false, error));
debugger_sp->GetPropertyValue(&exe_ctx, var_name, error));
if (value_sp) {
StreamString value_strm;
value_sp->DumpValue(&exe_ctx, value_strm, OptionValue::eDumpOptionValue);
Expand Down
7 changes: 3 additions & 4 deletions lldb/source/Commands/CommandObjectSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ insert-before or insert-after.");
const char *setting_var_name =
request.GetParsedLine().GetArgumentAtIndex(setting_var_idx);
Status error;
lldb::OptionValueSP value_sp(GetDebugger().GetPropertyValue(
&m_exe_ctx, setting_var_name, false, error));
lldb::OptionValueSP value_sp(
GetDebugger().GetPropertyValue(&m_exe_ctx, setting_var_name, error));
if (!value_sp)
return;
value_sp->AutoComplete(m_interpreter, request);
Expand Down Expand Up @@ -520,7 +520,6 @@ class CommandObjectSettingsList : public CommandObjectParsed {
bool DoExecute(Args &args, CommandReturnObject &result) override {
result.SetStatus(eReturnStatusSuccessFinishResult);

const bool will_modify = false;
const size_t argc = args.GetArgumentCount();
if (argc > 0) {
const bool dump_qualified_name = true;
Expand All @@ -530,7 +529,7 @@ class CommandObjectSettingsList : public CommandObjectParsed {

const Property *property =
GetDebugger().GetValueProperties()->GetPropertyAtPath(
&m_exe_ctx, will_modify, property_path);
&m_exe_ctx, property_path);

if (property) {
property->DumpDescription(m_interpreter, result.GetOutputStream(), 0,
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Core/Disassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ bool Disassembler::ElideMixedSourceAndDisassemblyLine(
if (target_sp) {
Status error;
OptionValueSP value_sp = target_sp->GetDebugger().GetPropertyValue(
&exe_ctx, "target.process.thread.step-avoid-regexp", false, error);
&exe_ctx, "target.process.thread.step-avoid-regexp", error);
if (value_sp && value_sp->GetType() == OptionValue::eTypeRegex) {
OptionValueRegex *re = value_sp->GetAsRegex();
if (re) {
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/Core/ModuleList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool ModuleListProperties::GetEnableBackgroundLookup() const {

FileSpec ModuleListProperties::GetClangModulesCachePath() const {
return m_collection_sp
->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
->GetPropertyAtIndexAsOptionValueFileSpec(nullptr,
ePropertyClangModulesCachePath)
->GetCurrentValue();
}
Expand All @@ -126,7 +126,7 @@ bool ModuleListProperties::SetClangModulesCachePath(const FileSpec &path) {

FileSpec ModuleListProperties::GetLLDBIndexCachePath() const {
return m_collection_sp
->GetPropertyAtIndexAsOptionValueFileSpec(nullptr, false,
->GetPropertyAtIndexAsOptionValueFileSpec(nullptr,
ePropertyLLDBIndexCachePath)
->GetCurrentValue();
}
Expand Down Expand Up @@ -168,7 +168,7 @@ uint64_t ModuleListProperties::GetLLDBIndexCacheExpirationDays() {
void ModuleListProperties::UpdateSymlinkMappings() {
FileSpecList list = m_collection_sp
->GetPropertyAtIndexAsOptionValueFileSpecList(
nullptr, false, ePropertySymLinkPaths)
nullptr, ePropertySymLinkPaths)
->GetCurrentValue();
llvm::sys::ScopedWriter lock(m_symlink_paths_mutex);
const bool notify = false;
Expand Down
5 changes: 2 additions & 3 deletions lldb/source/Core/UserSettingsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ using namespace lldb_private;

lldb::OptionValueSP
Properties::GetPropertyValue(const ExecutionContext *exe_ctx,
llvm::StringRef path, bool will_modify,
Status &error) const {
llvm::StringRef path, Status &error) const {
OptionValuePropertiesSP properties_sp(GetValueProperties());
if (properties_sp)
return properties_sp->GetSubValue(exe_ctx, path, will_modify, error);
return properties_sp->GetSubValue(exe_ctx, path, error);
return lldb::OptionValueSP();
}

Expand Down
6 changes: 2 additions & 4 deletions lldb/source/Interpreter/OptionValueArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ Status OptionValueArray::SetValueFromString(llvm::StringRef value,

lldb::OptionValueSP
OptionValueArray::GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name, bool will_modify,
Status &error) const {
llvm::StringRef name, Status &error) const {
if (name.empty() || name.front() != '[') {
error.SetErrorStringWithFormat(
"invalid value path '%s', %s values only support '[<index>]' subvalues "
Expand Down Expand Up @@ -129,8 +128,7 @@ OptionValueArray::GetSubValue(const ExecutionContext *exe_ctx,
if (new_idx < array_count) {
if (m_values[new_idx]) {
if (!sub_value.empty())
return m_values[new_idx]->GetSubValue(exe_ctx, sub_value,
will_modify, error);
return m_values[new_idx]->GetSubValue(exe_ctx, sub_value, error);
else
return m_values[new_idx];
}
Expand Down
8 changes: 3 additions & 5 deletions lldb/source/Interpreter/OptionValueDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ Status OptionValueDictionary::SetValueFromString(llvm::StringRef value,

lldb::OptionValueSP
OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx,
llvm::StringRef name, bool will_modify,
Status &error) const {
llvm::StringRef name, Status &error) const {
lldb::OptionValueSP value_sp;
if (name.empty())
return nullptr;
Expand Down Expand Up @@ -280,16 +279,15 @@ OptionValueDictionary::GetSubValue(const ExecutionContext *exe_ctx,

if (sub_name.empty())
return value_sp;
return value_sp->GetSubValue(exe_ctx, sub_name, will_modify, error);
return value_sp->GetSubValue(exe_ctx, sub_name, error);
}

Status OptionValueDictionary::SetSubValue(const ExecutionContext *exe_ctx,
VarSetOperationType op,
llvm::StringRef name,
llvm::StringRef value) {
Status error;
const bool will_modify = true;
lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, will_modify, error));
lldb::OptionValueSP value_sp(GetSubValue(exe_ctx, name, error));
if (value_sp)
error = value_sp->SetValueFromString(value, op);
else {
Expand Down
Loading

0 comments on commit ddd9358

Please sign in to comment.