Skip to content

Commit 0871f22

Browse files
committed
[lldb][NFCI] Use size_t in OptionValueProperties
In many places we're using uint32_t where we should be using size_t. We should be consistent. Differential Revision: https://reviews.llvm.org/D151949
1 parent 8625c20 commit 0871f22

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

lldb/include/lldb/Interpreter/OptionValueProperties.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class OptionValueProperties
6868
// Get the index of a property given its exact name in this property
6969
// collection, "name" can't be a path to a property path that refers to a
7070
// property within a property
71-
virtual uint32_t GetPropertyIndex(ConstString name) const;
71+
virtual size_t GetPropertyIndex(ConstString name) const;
7272

7373
// Get a property by exact name exists in this property collection, name can
7474
// not be a path to a property path that refers to a property within a
@@ -78,7 +78,7 @@ class OptionValueProperties
7878
const ExecutionContext *exe_ctx = nullptr) const;
7979

8080
virtual const Property *
81-
GetPropertyAtIndex(uint32_t idx,
81+
GetPropertyAtIndex(size_t idx,
8282
const ExecutionContext *exe_ctx = nullptr) const {
8383
return ProtectedGetPropertyAtIndex(idx);
8484
}
@@ -91,7 +91,7 @@ class OptionValueProperties
9191
llvm::StringRef property_path) const;
9292

9393
virtual lldb::OptionValueSP
94-
GetPropertyValueAtIndex(uint32_t idx, const ExecutionContext *exe_ctx) const;
94+
GetPropertyValueAtIndex(size_t idx, const ExecutionContext *exe_ctx) const;
9595

9696
virtual lldb::OptionValueSP GetValueForKey(const ExecutionContext *exe_ctx,
9797
ConstString key) const;
@@ -104,44 +104,44 @@ class OptionValueProperties
104104
llvm::StringRef path, llvm::StringRef value) override;
105105

106106
bool
107-
GetPropertyAtIndexAsArgs(uint32_t idx, Args &args,
107+
GetPropertyAtIndexAsArgs(size_t idx, Args &args,
108108
const ExecutionContext *exe_ctx = nullptr) const;
109109

110-
bool SetPropertyAtIndexFromArgs(uint32_t idx, const Args &args,
110+
bool SetPropertyAtIndexFromArgs(size_t idx, const Args &args,
111111
const ExecutionContext *exe_ctx = nullptr);
112112

113113
OptionValueDictionary *GetPropertyAtIndexAsOptionValueDictionary(
114-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
114+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
115115

116116
OptionValueSInt64 *GetPropertyAtIndexAsOptionValueSInt64(
117-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
117+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
118118

119119
OptionValueUInt64 *GetPropertyAtIndexAsOptionValueUInt64(
120-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
120+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
121121

122122
OptionValueString *GetPropertyAtIndexAsOptionValueString(
123-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
123+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
124124

125125
OptionValueFileSpec *GetPropertyAtIndexAsOptionValueFileSpec(
126-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
126+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
127127

128128
OptionValuePathMappings *GetPropertyAtIndexAsOptionValuePathMappings(
129-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
129+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
130130

131131
OptionValueFileSpecList *GetPropertyAtIndexAsOptionValueFileSpecList(
132-
uint32_t idx, const ExecutionContext *exe_ctx = nullptr) const;
132+
size_t idx, const ExecutionContext *exe_ctx = nullptr) const;
133133

134134
void AppendProperty(ConstString name, llvm::StringRef desc, bool is_global,
135135
const lldb::OptionValueSP &value_sp);
136136

137137
lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
138138
ConstString name);
139139

140-
void SetValueChangedCallback(uint32_t property_idx,
140+
void SetValueChangedCallback(size_t property_idx,
141141
std::function<void()> callback);
142142

143143
template <typename T>
144-
auto GetPropertyAtIndexAs(uint32_t idx,
144+
auto GetPropertyAtIndexAs(size_t idx,
145145
const ExecutionContext *exe_ctx = nullptr) const {
146146
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
147147
if (OptionValue *value = property->GetValue().get())
@@ -154,7 +154,7 @@ class OptionValueProperties
154154
}
155155

156156
template <typename T>
157-
bool SetPropertyAtIndex(uint32_t idx, T t,
157+
bool SetPropertyAtIndex(size_t idx, T t,
158158
const ExecutionContext *exe_ctx = nullptr) const {
159159
if (const Property *property = GetPropertyAtIndex(idx, exe_ctx)) {
160160
if (OptionValue *value = property->GetValue().get()) {
@@ -166,12 +166,12 @@ class OptionValueProperties
166166
}
167167

168168
protected:
169-
Property *ProtectedGetPropertyAtIndex(uint32_t idx) {
169+
Property *ProtectedGetPropertyAtIndex(size_t idx) {
170170
assert(idx < m_properties.size() && "invalid property index");
171171
return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
172172
}
173173

174-
const Property *ProtectedGetPropertyAtIndex(uint32_t idx) const {
174+
const Property *ProtectedGetPropertyAtIndex(size_t idx) const {
175175
assert(idx < m_properties.size() && "invalid property index");
176176
return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
177177
}

lldb/source/Interpreter/OptionValueProperties.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void OptionValueProperties::Initialize(const PropertyDefinitions &defs) {
3535
}
3636

3737
void OptionValueProperties::SetValueChangedCallback(
38-
uint32_t property_idx, std::function<void()> callback) {
38+
size_t property_idx, std::function<void()> callback) {
3939
Property *property = ProtectedGetPropertyAtIndex(property_idx);
4040
if (property)
4141
property->SetValueChangedCallback(std::move(callback));
@@ -138,7 +138,7 @@ Status OptionValueProperties::SetSubValue(const ExecutionContext *exe_ctx,
138138
return error;
139139
}
140140

141-
uint32_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
141+
size_t OptionValueProperties::GetPropertyIndex(ConstString name) const {
142142
return m_name_to_index.Find(name, SIZE_MAX);
143143
}
144144

@@ -149,7 +149,7 @@ OptionValueProperties::GetProperty(ConstString name,
149149
}
150150

151151
lldb::OptionValueSP OptionValueProperties::GetPropertyValueAtIndex(
152-
uint32_t idx, const ExecutionContext *exe_ctx) const {
152+
size_t idx, const ExecutionContext *exe_ctx) const {
153153
const Property *setting = GetPropertyAtIndex(idx, exe_ctx);
154154
if (setting)
155155
return setting->GetValue();
@@ -158,7 +158,7 @@ lldb::OptionValueSP OptionValueProperties::GetPropertyValueAtIndex(
158158

159159
OptionValuePathMappings *
160160
OptionValueProperties::GetPropertyAtIndexAsOptionValuePathMappings(
161-
uint32_t idx, const ExecutionContext *exe_ctx) const {
161+
size_t idx, const ExecutionContext *exe_ctx) const {
162162
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
163163
if (value_sp)
164164
return value_sp->GetAsPathMappings();
@@ -167,15 +167,15 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValuePathMappings(
167167

168168
OptionValueFileSpecList *
169169
OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpecList(
170-
uint32_t idx, const ExecutionContext *exe_ctx) const {
170+
size_t idx, const ExecutionContext *exe_ctx) const {
171171
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
172172
if (value_sp)
173173
return value_sp->GetAsFileSpecList();
174174
return nullptr;
175175
}
176176

177177
bool OptionValueProperties::GetPropertyAtIndexAsArgs(
178-
uint32_t idx, Args &args, const ExecutionContext *exe_ctx) const {
178+
size_t idx, Args &args, const ExecutionContext *exe_ctx) const {
179179
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
180180
if (!property)
181181
return false;
@@ -206,7 +206,7 @@ bool OptionValueProperties::GetPropertyAtIndexAsArgs(
206206
}
207207

208208
bool OptionValueProperties::SetPropertyAtIndexFromArgs(
209-
uint32_t idx, const Args &args, const ExecutionContext *exe_ctx) {
209+
size_t idx, const Args &args, const ExecutionContext *exe_ctx) {
210210
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
211211
if (!property)
212212
return false;
@@ -232,7 +232,7 @@ bool OptionValueProperties::SetPropertyAtIndexFromArgs(
232232

233233
OptionValueDictionary *
234234
OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary(
235-
uint32_t idx, const ExecutionContext *exe_ctx) const {
235+
size_t idx, const ExecutionContext *exe_ctx) const {
236236
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
237237
if (property)
238238
return property->GetValue()->GetAsDictionary();
@@ -241,7 +241,7 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValueDictionary(
241241

242242
OptionValueFileSpec *
243243
OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpec(
244-
uint32_t idx, const ExecutionContext *exe_ctx) const {
244+
size_t idx, const ExecutionContext *exe_ctx) const {
245245
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
246246
if (property) {
247247
OptionValue *value = property->GetValue().get();
@@ -252,7 +252,7 @@ OptionValueProperties::GetPropertyAtIndexAsOptionValueFileSpec(
252252
}
253253

254254
OptionValueSInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueSInt64(
255-
uint32_t idx, const ExecutionContext *exe_ctx) const {
255+
size_t idx, const ExecutionContext *exe_ctx) const {
256256
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
257257
if (property) {
258258
OptionValue *value = property->GetValue().get();
@@ -263,7 +263,7 @@ OptionValueSInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueSInt64(
263263
}
264264

265265
OptionValueUInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueUInt64(
266-
uint32_t idx, const ExecutionContext *exe_ctx) const {
266+
size_t idx, const ExecutionContext *exe_ctx) const {
267267
const Property *property = GetPropertyAtIndex(idx, exe_ctx);
268268
if (property) {
269269
OptionValue *value = property->GetValue().get();
@@ -274,7 +274,7 @@ OptionValueUInt64 *OptionValueProperties::GetPropertyAtIndexAsOptionValueUInt64(
274274
}
275275

276276
OptionValueString *OptionValueProperties::GetPropertyAtIndexAsOptionValueString(
277-
uint32_t idx, const ExecutionContext *exe_ctx) const {
277+
size_t idx, const ExecutionContext *exe_ctx) const {
278278
OptionValueSP value_sp(GetPropertyValueAtIndex(idx, exe_ctx));
279279
if (value_sp)
280280
return value_sp->GetAsString();

lldb/source/Target/Process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ProcessOptionValueProperties
9393
ProcessOptionValueProperties(ConstString name) : Cloneable(name) {}
9494

9595
const Property *
96-
GetPropertyAtIndex(uint32_t idx,
96+
GetPropertyAtIndex(size_t idx,
9797
const ExecutionContext *exe_ctx) const override {
9898
// When getting the value for a key from the process options, we will
9999
// always try and grab the setting from the current process if there is

lldb/source/Target/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4008,7 +4008,7 @@ class TargetOptionValueProperties
40084008
TargetOptionValueProperties(ConstString name) : Cloneable(name) {}
40094009

40104010
const Property *
4011-
GetPropertyAtIndex(uint32_t idx,
4011+
GetPropertyAtIndex(size_t idx,
40124012
const ExecutionContext *exe_ctx = nullptr) const override {
40134013
// When getting the value for a key from the target options, we will always
40144014
// try and grab the setting from the current target if there is one. Else

lldb/source/Target/Thread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class ThreadOptionValueProperties
7979
ThreadOptionValueProperties(ConstString name) : Cloneable(name) {}
8080

8181
const Property *
82-
GetPropertyAtIndex(uint32_t idx,
82+
GetPropertyAtIndex(size_t idx,
8383
const ExecutionContext *exe_ctx) const override {
8484
// When getting the value for a key from the thread options, we will always
8585
// try and grab the setting from the current thread if there is one. Else

0 commit comments

Comments
 (0)