[lldb] DeConstStringify the Property class

Most of the interfaces were converted already, this just converts the
internal implementation.
This commit is contained in:
Pavel Labath 2021-11-10 15:05:07 +01:00
parent 969243a007
commit ff7ce0af04
3 changed files with 13 additions and 15 deletions

View File

@ -10,7 +10,6 @@
#define LLDB_INTERPRETER_PROPERTY_H
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Flags.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-private-types.h"
@ -37,13 +36,11 @@ class Property {
public:
Property(const PropertyDefinition &definition);
Property(ConstString name, ConstString desc, bool is_global,
Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
const lldb::OptionValueSP &value_sp);
llvm::StringRef GetName() const { return m_name.GetStringRef(); }
llvm::StringRef GetDescription() const {
return m_description.GetStringRef();
}
llvm::StringRef GetName() const { return m_name; }
llvm::StringRef GetDescription() const { return m_description; }
const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
@ -67,8 +64,8 @@ public:
void SetValueChangedCallback(std::function<void()> callback);
protected:
ConstString m_name;
ConstString m_description;
std::string m_name;
std::string m_description;
lldb::OptionValueSP m_value_sp;
bool m_is_global;
};

View File

@ -48,7 +48,8 @@ void OptionValueProperties::AppendProperty(ConstString name,
ConstString desc,
bool is_global,
const OptionValueSP &value_sp) {
Property property(name, desc, is_global, value_sp);
Property property(name.GetStringRef(), desc.GetStringRef(), is_global,
value_sp);
m_name_to_index.Append(name, m_properties.size());
m_properties.push_back(property);
value_sp->SetParent(shared_from_this());

View File

@ -227,13 +227,13 @@ Property::Property(const PropertyDefinition &definition)
}
}
Property::Property(ConstString name, ConstString desc,
bool is_global, const lldb::OptionValueSP &value_sp)
Property::Property(llvm::StringRef name, llvm::StringRef desc, bool is_global,
const lldb::OptionValueSP &value_sp)
: m_name(name), m_description(desc), m_value_sp(value_sp),
m_is_global(is_global) {}
bool Property::DumpQualifiedName(Stream &strm) const {
if (m_name) {
if (!m_name.empty()) {
if (m_value_sp->DumpQualifiedName(strm))
strm.PutChar('.');
strm << m_name;
@ -251,7 +251,7 @@ void Property::Dump(const ExecutionContext *exe_ctx, Stream &strm,
if (dump_cmd && !transparent)
strm << "settings set -f ";
if (dump_desc || !transparent) {
if ((dump_mask & OptionValue::eDumpOptionName) && m_name) {
if ((dump_mask & OptionValue::eDumpOptionName) && !m_name.empty()) {
DumpQualifiedName(strm);
if (dump_mask & ~OptionValue::eDumpOptionName)
strm.PutChar(' ');
@ -295,8 +295,8 @@ void Property::DumpDescription(CommandInterpreter &interpreter, Stream &strm,
interpreter.OutputFormattedHelpText(strm, qualified_name.GetString(),
"--", desc, output_width);
} else {
interpreter.OutputFormattedHelpText(strm, m_name.GetStringRef(), "--",
desc, output_width);
interpreter.OutputFormattedHelpText(strm, m_name, "--", desc,
output_width);
}
}
}