bulbazord created this revision.
bulbazord added reviewers: jingham, mib.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
In many places we're using uint32_t where we should be using size_t.
We should be consistent.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D151949
Files:
lldb/include/lldb/Interpreter/OptionValueProperties.h
lldb/source/Interpreter/OptionValueProperties.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/Thread.cpp
Index: lldb/source/Target/Thread.cpp
===================================================================
--- lldb/source/Target/Thread.cpp
+++ lldb/source/Target/Thread.cpp
@@ -79,7 +79,7 @@
ThreadOptionValueProperties(ConstString name) : Cloneable(name) {}
const Property *
- GetPropertyAtIndex(uint32_t idx,
+ GetPropertyAtIndex(size_t idx,
const ExecutionContext *exe_ctx) const override {
// When getting the value for a key from the thread options, we will always
// try and grab the setting from the current thread if there is one. Else
Index: lldb/source/Target/Target.cpp
===================================================================
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -4008,7 +4008,7 @@
TargetOptionValueProperties(ConstString name) : Cloneable(name) {}
const Property *
- GetPropertyAtIndex(uint32_t idx,
+ GetPropertyAtIndex(size_t idx,
const ExecutionContext *exe_ctx = nullptr) const override {
// When getting the value for a key from the target options, we will always
// try and grab the setting from the current target if there is one. Else
Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -93,7 +93,7 @@
ProcessOptionValueProperties(ConstString name) : Cloneable(name) {}
const Property *
- GetPropertyAtIndex(uint32_t idx,
+ GetPropertyAtIndex(size_t idx,
const ExecutionContext *exe_ctx) const override {
// When getting the value for a key from the process options, we will
// always try and grab the setting from the current process if there is
Index: lldb/source/Interpreter/OptionValueProperties.cpp
===================================================================
--- lldb/source/Interpreter/OptionValueProperties.cpp
+++ lldb/source/Interpreter/OptionValueProperties.cpp
@@ -35,7 +35,7 @@
}
void OptionValueProperties::SetValueChangedCallback(
- uint32_t property_idx, std::function<void()> callback) {
+ size_t property_idx, std::function<void()> callback) {
Property *property = ProtectedGetPropertyAtIndex(property_idx);
if (property)
property->SetValueChangedCallback(std::move(callback));
@@ -138,7 +138,7 @@
return error;
}
-uint32_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
+size_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
return m_name_to_index.Find(name, SIZE_MAX);
}
@@ -149,7 +149,7 @@
}
lldb::OptionValueSP OptionValueProperties::GetPropertyValueAtIndex(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
const Property *setting = GetPropertyAtIndex(idx, exe_ctx);
if (setting)
return setting->GetValue();
@@ -158,7 +158,7 @@
OptionValuePathMappings *
OptionValueProperties::GetPropertyAtIndexAsOptionValuePathMappings(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
if (value_sp)
return value_sp->GetAsPathMappings();
@@ -167,7 +167,7 @@
OptionValueFileSpecList *
OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpecList(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
if (value_sp)
return value_sp->GetAsFileSpecList();
@@ -175,7 +175,7 @@
}
bool OptionValueProperties::GetPropertyAtIndexAsArgs(
- uint32_t idx, Args &args, const ExecutionContext *exe_ctx) const {
+ size_t idx, Args &args, const ExecutionContext *exe_ctx) const {
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
if (!property)
return false;
@@ -206,7 +206,7 @@
}
bool OptionValueProperties::SetPropertyAtIndexFromArgs(
- uint32_t idx, const Args &args, const ExecutionContext *exe_ctx) {
+ size_t idx, const Args &args, const ExecutionContext *exe_ctx) {
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
if (!property)
return false;
@@ -232,7 +232,7 @@
OptionValueDictionary *
OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
if (property)
return property->GetValue()->GetAsDictionary();
@@ -241,7 +241,7 @@
OptionValueFileSpec *
OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpec(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
if (property) {
OptionValue *value = property->GetValue().get();
@@ -252,7 +252,7 @@
}
OptionValueSInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueSInt64(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
if (property) {
OptionValue *value = property->GetValue().get();
@@ -263,7 +263,7 @@
}
OptionValueUInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueUInt64(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
if (property) {
OptionValue *value = property->GetValue().get();
@@ -274,7 +274,7 @@
}
OptionValueString *OptionValueProperties::GetPropertyAtIndexAsOptionValueString(
- uint32_t idx, const ExecutionContext *exe_ctx) const {
+ size_t idx, const ExecutionContext *exe_ctx) const {
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
if (value_sp)
return value_sp->GetAsString();
Index: lldb/include/lldb/Interpreter/OptionValueProperties.h
===================================================================
--- lldb/include/lldb/Interpreter/OptionValueProperties.h
+++ lldb/include/lldb/Interpreter/OptionValueProperties.h
@@ -68,7 +68,7 @@
// Get the index of a property given its exact name in this property
// collection, "name" can't be a path to a property path that refers to a
// property within a property
- virtual uint32_t GetPropertyIndex(ConstString name) const;
+ virtual size_t GetPropertyIndex(ConstString name) const;
// Get a property by exact name exists in this property collection, name can
// not be a path to a property path that refers to a property within a
@@ -78,7 +78,7 @@
const ExecutionContext *exe_ctx = nullptr) const;
virtual const Property *
- GetPropertyAtIndex(uint32_t idx,
+ GetPropertyAtIndex(size_t idx,
const ExecutionContext *exe_ctx = nullptr) const {
return ProtectedGetPropertyAtIndex(idx);
}
@@ -91,7 +91,7 @@
llvm::StringRef property_path) const;
virtual lldb::OptionValueSP
- GetPropertyValueAtIndex(uint32_t idx, const ExecutionContext *exe_ctx) const;
+ GetPropertyValueAtIndex(size_t idx, const ExecutionContext *exe_ctx) const;
virtual lldb::OptionValueSP GetValueForKey(const ExecutionContext *exe_ctx,
ConstString key) const;
@@ -104,32 +104,32 @@
llvm::StringRef path, llvm::StringRef value) override;
bool
- GetPropertyAtIndexAsArgs(uint32_t idx, Args &args,
+ GetPropertyAtIndexAsArgs(size_t idx, Args &args,
const ExecutionContext *exe_ctx = nullptr) const;
- bool SetPropertyAtIndexFromArgs(uint32_t idx, const Args &args,
+ bool SetPropertyAtIndexFromArgs(size_t idx, const Args &args,
const ExecutionContext *exe_ctx = nullptr);
OptionValueDictionary *GetPropertyAtIndexAsOptionValueDictionary(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
OptionValueSInt64 *GetPropertyAtIndexAsOptionValueSInt64(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
OptionValueUInt64 *GetPropertyAtIndexAsOptionValueUInt64(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
OptionValueString *GetPropertyAtIndexAsOptionValueString(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
OptionValueFileSpec *GetPropertyAtIndexAsOptionValueFileSpec(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
OptionValuePathMappings *GetPropertyAtIndexAsOptionValuePathMappings(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
OptionValueFileSpecList *GetPropertyAtIndexAsOptionValueFileSpecList(
- uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
+ size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
void AppendProperty(ConstString name, llvm::StringRef desc, bool is_global,
const lldb::OptionValueSP &value_sp);
@@ -137,11 +137,11 @@
lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
ConstString name);
- void SetValueChangedCallback(uint32_t property_idx,
+ void SetValueChangedCallback(size_t property_idx,
std::function<void()> callback);
template <typename T>
- auto GetPropertyAtIndexAs(uint32_t idx,
+ auto GetPropertyAtIndexAs(size_t idx,
const ExecutionContext *exe_ctx = nullptr) const {
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
if (OptionValue *value = property->GetValue().get())
@@ -154,7 +154,7 @@
}
template <typename T>
- bool SetPropertyAtIndex(uint32_t idx, T t,
+ bool SetPropertyAtIndex(size_t idx, T t,
const ExecutionContext *exe_ctx = nullptr) const {
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
if (OptionValue *value = property->GetValue().get()) {
@@ -166,12 +166,12 @@
}
protected:
- Property *ProtectedGetPropertyAtIndex(uint32_t idx) {
+ Property *ProtectedGetPropertyAtIndex(size_t idx) {
assert(idx < m_properties.size() && "invalid property index");
return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
}
- const Property *ProtectedGetPropertyAtIndex(uint32_t idx) const {
+ const Property *ProtectedGetPropertyAtIndex(size_t idx) const {
assert(idx < m_properties.size() && "invalid property index");
return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
}
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits