[Lldb-commits] [lldb] ff7ce0a - [lldb] DeConstStringify the Property class
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 10 06:07:37 PST 2021
Author: Pavel Labath
Date: 2021-11-10T15:07:30+01:00
New Revision: ff7ce0af04ae8ef034ea18c8116331c843f36c40
URL: https://github.com/llvm/llvm-project/commit/ff7ce0af04ae8ef034ea18c8116331c843f36c40
DIFF: https://github.com/llvm/llvm-project/commit/ff7ce0af04ae8ef034ea18c8116331c843f36c40.diff
LOG: [lldb] DeConstStringify the Property class
Most of the interfaces were converted already, this just converts the
internal implementation.
Added:
Modified:
lldb/include/lldb/Interpreter/Property.h
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Interpreter/Property.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Interpreter/Property.h b/lldb/include/lldb/Interpreter/Property.h
index 97ec7ca1d4afa..09f09358e8af8 100644
--- a/lldb/include/lldb/Interpreter/Property.h
+++ b/lldb/include/lldb/Interpreter/Property.h
@@ -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 @@ class Property {
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;
};
diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp
index ae073798ca12e..1a8f2f0ab1809 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -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());
diff --git a/lldb/source/Interpreter/Property.cpp b/lldb/source/Interpreter/Property.cpp
index 410562f274f18..fe3a8a31394b5 100644
--- a/lldb/source/Interpreter/Property.cpp
+++ b/lldb/source/Interpreter/Property.cpp
@@ -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);
}
}
}
More information about the lldb-commits
mailing list