Author: Jim Ingham Date: 2020-07-21T11:32:55-07:00 New Revision: 8d6aa688eeffea4b9151d1a208ed619ca50c823a
URL: https://github.com/llvm/llvm-project/commit/8d6aa688eeffea4b9151d1a208ed619ca50c823a DIFF: https://github.com/llvm/llvm-project/commit/8d6aa688eeffea4b9151d1a208ed619ca50c823a.diff LOG: Remove the "bool" return from OptionValue::Clear and its subclasses. Every override returns true and its return value is never checked. I can't see how clearing an OptionValue could fail, or what you would do if it did. The return serves no purpose. Differential Revision: https://reviews.llvm.org/D84253 Added: Modified: lldb/include/lldb/Interpreter/OptionValue.h lldb/include/lldb/Interpreter/OptionValueArch.h lldb/include/lldb/Interpreter/OptionValueArray.h lldb/include/lldb/Interpreter/OptionValueBoolean.h lldb/include/lldb/Interpreter/OptionValueChar.h lldb/include/lldb/Interpreter/OptionValueDictionary.h lldb/include/lldb/Interpreter/OptionValueEnumeration.h lldb/include/lldb/Interpreter/OptionValueFileColonLine.h lldb/include/lldb/Interpreter/OptionValueFileSpec.h lldb/include/lldb/Interpreter/OptionValueFileSpecList.h lldb/include/lldb/Interpreter/OptionValueFormat.h lldb/include/lldb/Interpreter/OptionValueFormatEntity.h lldb/include/lldb/Interpreter/OptionValueLanguage.h lldb/include/lldb/Interpreter/OptionValuePathMappings.h lldb/include/lldb/Interpreter/OptionValueProperties.h lldb/include/lldb/Interpreter/OptionValueRegex.h lldb/include/lldb/Interpreter/OptionValueSInt64.h lldb/include/lldb/Interpreter/OptionValueString.h lldb/include/lldb/Interpreter/OptionValueUInt64.h lldb/include/lldb/Interpreter/OptionValueUUID.h lldb/source/Interpreter/OptionValueFormatEntity.cpp lldb/source/Interpreter/OptionValueProperties.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h index 27a5ddea116b..a8176e39940a 100644 --- a/lldb/include/lldb/Interpreter/OptionValue.h +++ b/lldb/include/lldb/Interpreter/OptionValue.h @@ -85,7 +85,7 @@ class OptionValue { SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign); - virtual bool Clear() = 0; + virtual void Clear() = 0; virtual lldb::OptionValueSP DeepCopy() const = 0; diff --git a/lldb/include/lldb/Interpreter/OptionValueArch.h b/lldb/include/lldb/Interpreter/OptionValueArch.h index 7b63c68fddbf..809261ef22c3 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArch.h +++ b/lldb/include/lldb/Interpreter/OptionValueArch.h @@ -47,10 +47,9 @@ class OptionValueArch : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueArray.h b/lldb/include/lldb/Interpreter/OptionValueArray.h index 000351c2f586..4546bbb80394 100644 --- a/lldb/include/lldb/Interpreter/OptionValueArray.h +++ b/lldb/include/lldb/Interpreter/OptionValueArray.h @@ -36,10 +36,9 @@ class OptionValueArray : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_values.clear(); m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueBoolean.h b/lldb/include/lldb/Interpreter/OptionValueBoolean.h index d221f6d034c2..1af14a4980ed 100644 --- a/lldb/include/lldb/Interpreter/OptionValueBoolean.h +++ b/lldb/include/lldb/Interpreter/OptionValueBoolean.h @@ -37,10 +37,9 @@ class OptionValueBoolean : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } void AutoComplete(CommandInterpreter &interpreter, diff --git a/lldb/include/lldb/Interpreter/OptionValueChar.h b/lldb/include/lldb/Interpreter/OptionValueChar.h index 8d0aa91d7076..a8ecf507a4cf 100644 --- a/lldb/include/lldb/Interpreter/OptionValueChar.h +++ b/lldb/include/lldb/Interpreter/OptionValueChar.h @@ -38,10 +38,9 @@ class OptionValueChar : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } // Subclass specific functions diff --git a/lldb/include/lldb/Interpreter/OptionValueDictionary.h b/lldb/include/lldb/Interpreter/OptionValueDictionary.h index 1bc45252607c..dab1c3ea0c1c 100644 --- a/lldb/include/lldb/Interpreter/OptionValueDictionary.h +++ b/lldb/include/lldb/Interpreter/OptionValueDictionary.h @@ -35,10 +35,9 @@ class OptionValueDictionary : public OptionValue { SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; - bool Clear() override { + void Clear() override { m_values.clear(); m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h index 26ba7ad5f646..12c6473c7f1c 100644 --- a/lldb/include/lldb/Interpreter/OptionValueEnumeration.h +++ b/lldb/include/lldb/Interpreter/OptionValueEnumeration.h @@ -47,10 +47,9 @@ class OptionValueEnumeration : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h index 3c0ccb2d2fa2..713deea9e141 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileColonLine.h @@ -35,11 +35,10 @@ class OptionValueFileColonLine : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_file_spec.Clear(); m_line_number = LLDB_INVALID_LINE_NUMBER; m_column_number = LLDB_INVALID_COLUMN_NUMBER; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h index 2b18c9533f91..4fde3f6e3c8a 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpec.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpec.h @@ -41,12 +41,11 @@ class OptionValueFileSpec : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; m_data_sp.reset(); m_data_mod_time = llvm::sys::TimePoint<>(); - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h index 7b762bf6b309..38773525c8db 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -39,11 +39,10 @@ class OptionValueFileSpecList : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { std::lock_guard<std::recursive_mutex> lock(m_mutex); m_current_value.Clear(); m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueFormat.h b/lldb/include/lldb/Interpreter/OptionValueFormat.h index 6904c93a2f33..5a83ff3b8983 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormat.h +++ b/lldb/include/lldb/Interpreter/OptionValueFormat.h @@ -38,10 +38,9 @@ class OptionValueFormat : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h index beb5d6843a98..7c2f9fba0242 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h +++ b/lldb/include/lldb/Interpreter/OptionValueFormatEntity.h @@ -34,7 +34,7 @@ class OptionValueFormatEntity : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override; + void Clear() override; lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueLanguage.h b/lldb/include/lldb/Interpreter/OptionValueLanguage.h index f4ca2fd69ab5..129365296759 100644 --- a/lldb/include/lldb/Interpreter/OptionValueLanguage.h +++ b/lldb/include/lldb/Interpreter/OptionValueLanguage.h @@ -41,10 +41,9 @@ class OptionValueLanguage : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h index 18f5cbaf4336..6d1a0816f45b 100644 --- a/lldb/include/lldb/Interpreter/OptionValuePathMappings.h +++ b/lldb/include/lldb/Interpreter/OptionValuePathMappings.h @@ -35,10 +35,9 @@ class OptionValuePathMappings : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_path_mappings.Clear(m_notify_changes); m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueProperties.h b/lldb/include/lldb/Interpreter/OptionValueProperties.h index 76f09cc77123..bd944b6a5adf 100644 --- a/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/lldb/include/lldb/Interpreter/OptionValueProperties.h @@ -34,7 +34,7 @@ class OptionValueProperties Type GetType() const override { return eTypeProperties; } - bool Clear() override; + void Clear() override; lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueRegex.h b/lldb/include/lldb/Interpreter/OptionValueRegex.h index b09b8414d5bf..4751a1dc27ed 100644 --- a/lldb/include/lldb/Interpreter/OptionValueRegex.h +++ b/lldb/include/lldb/Interpreter/OptionValueRegex.h @@ -36,10 +36,9 @@ class OptionValueRegex : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_regex = RegularExpression(m_default_regex_str); m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueSInt64.h b/lldb/include/lldb/Interpreter/OptionValueSInt64.h index fbabaaeb2ff4..87917c108865 100644 --- a/lldb/include/lldb/Interpreter/OptionValueSInt64.h +++ b/lldb/include/lldb/Interpreter/OptionValueSInt64.h @@ -50,10 +50,9 @@ class OptionValueSInt64 : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueString.h b/lldb/include/lldb/Interpreter/OptionValueString.h index cd371c567020..ed44dae67d1d 100644 --- a/lldb/include/lldb/Interpreter/OptionValueString.h +++ b/lldb/include/lldb/Interpreter/OptionValueString.h @@ -85,10 +85,9 @@ class OptionValueString : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueUInt64.h b/lldb/include/lldb/Interpreter/OptionValueUInt64.h index 0096e87de367..1164fb802f68 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUInt64.h +++ b/lldb/include/lldb/Interpreter/OptionValueUInt64.h @@ -47,10 +47,9 @@ class OptionValueUInt64 : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_current_value = m_default_value; m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/include/lldb/Interpreter/OptionValueUUID.h b/lldb/include/lldb/Interpreter/OptionValueUUID.h index 2fb8caa3aa53..1f663e999b9d 100644 --- a/lldb/include/lldb/Interpreter/OptionValueUUID.h +++ b/lldb/include/lldb/Interpreter/OptionValueUUID.h @@ -36,10 +36,9 @@ class OptionValueUUID : public OptionValue { SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; - bool Clear() override { + void Clear() override { m_uuid.Clear(); m_value_was_set = false; - return true; } lldb::OptionValueSP DeepCopy() const override; diff --git a/lldb/source/Interpreter/OptionValueFormatEntity.cpp b/lldb/source/Interpreter/OptionValueFormatEntity.cpp index 3a32a4721b68..509a21752e48 100644 --- a/lldb/source/Interpreter/OptionValueFormatEntity.cpp +++ b/lldb/source/Interpreter/OptionValueFormatEntity.cpp @@ -29,11 +29,10 @@ OptionValueFormatEntity::OptionValueFormatEntity(const char *default_format) } } -bool OptionValueFormatEntity::Clear() { +void OptionValueFormatEntity::Clear() { m_current_entry = m_default_entry; m_current_format = m_default_format; m_value_was_set = false; - return true; } static void EscapeBackticks(llvm::StringRef str, std::string &dst) { diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index 24cda056977e..5b82008ca571 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -517,11 +517,10 @@ bool OptionValueProperties::SetPropertyAtIndexAsUInt64( return false; } -bool OptionValueProperties::Clear() { +void OptionValueProperties::Clear() { const size_t num_properties = m_properties.size(); for (size_t i = 0; i < num_properties; ++i) m_properties[i].GetValue()->Clear(); - return true; } Status OptionValueProperties::SetValueFromString(llvm::StringRef value, _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
