Skip to content

Commit 7ef9098

Browse files
committed
Convert ReflectionContext to LLDB coding style (NFC)
(cherry picked from commit b9f5dde)
1 parent ba1cbdc commit 7ef9098

File tree

4 files changed

+45
-45
lines changed

4 files changed

+45
-45
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/ReflectionContext.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class TargetReflectionContext
3333
SwiftMetadataCache *swift_metadata_cache)
3434
: m_reflection_ctx(reader, swift_metadata_cache) {}
3535

36-
llvm::Optional<uint32_t> addImage(
36+
llvm::Optional<uint32_t> AddImage(
3737
llvm::function_ref<std::pair<swift::remote::RemoteRef<void>, uint64_t>(
3838
swift::ReflectionSectionKind)>
3939
find_section,
@@ -42,12 +42,12 @@ class TargetReflectionContext
4242
}
4343

4444
llvm::Optional<uint32_t>
45-
addImage(swift::remote::RemoteAddress image_start,
45+
AddImage(swift::remote::RemoteAddress image_start,
4646
llvm::SmallVector<llvm::StringRef, 1> likely_module_names) override {
4747
return m_reflection_ctx.addImage(image_start, likely_module_names);
4848
}
4949

50-
llvm::Optional<uint32_t> readELF(
50+
llvm::Optional<uint32_t> ReadELF(
5151
swift::remote::RemoteAddress ImageStart,
5252
llvm::Optional<llvm::sys::MemoryBlock> FileBuffer,
5353
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) override {
@@ -56,7 +56,7 @@ class TargetReflectionContext
5656
}
5757

5858
const swift::reflection::TypeInfo *
59-
getTypeInfo(const swift::reflection::TypeRef *type_ref,
59+
GetTypeInfo(const swift::reflection::TypeRef *type_ref,
6060
swift::remote::TypeInfoProvider *provider) override {
6161
if (!type_ref)
6262
return nullptr;
@@ -91,7 +91,7 @@ class TargetReflectionContext
9191
return type_info;
9292
}
9393

94-
swift::reflection::MemoryReader &getReader() override {
94+
swift::reflection::MemoryReader &GetReader() override {
9595
return m_reflection_ctx.getReader();
9696
}
9797

@@ -130,22 +130,22 @@ class TargetReflectionContext
130130

131131
llvm::Optional<std::pair<const swift::reflection::TypeRef *,
132132
swift::reflection::RemoteAddress>>
133-
projectExistentialAndUnwrapClass(
133+
ProjectExistentialAndUnwrapClass(
134134
swift::reflection::RemoteAddress existential_address,
135135
const swift::reflection::TypeRef &existential_tr) override {
136136
return m_reflection_ctx.projectExistentialAndUnwrapClass(
137137
existential_address, existential_tr);
138138
}
139139

140140
const swift::reflection::TypeRef *
141-
readTypeFromMetadata(lldb::addr_t metadata_address,
141+
ReadTypeFromMetadata(lldb::addr_t metadata_address,
142142
bool skip_artificial_subclasses) override {
143143
return m_reflection_ctx.readTypeFromMetadata(metadata_address,
144144
skip_artificial_subclasses);
145145
}
146146

147147
const swift::reflection::TypeRef *
148-
readTypeFromInstance(lldb::addr_t instance_address,
148+
ReadTypeFromInstance(lldb::addr_t instance_address,
149149
bool skip_artificial_subclasses) override {
150150
auto metadata_address =
151151
m_reflection_ctx.readMetadataFromInstance(instance_address);
@@ -160,18 +160,18 @@ class TargetReflectionContext
160160
skip_artificial_subclasses);
161161
}
162162

163-
swift::reflection::TypeRefBuilder &getBuilder() override {
163+
swift::reflection::TypeRefBuilder &GetBuilder() override {
164164
return m_reflection_ctx.getBuilder();
165165
}
166166

167-
llvm::Optional<bool> isValueInlinedInExistentialContainer(
167+
llvm::Optional<bool> IsValueInlinedInExistentialContainer(
168168
swift::remote::RemoteAddress existential_address) override {
169169
return m_reflection_ctx.isValueInlinedInExistentialContainer(
170170
existential_address);
171171
}
172172

173173
swift::remote::RemoteAbsolutePointer
174-
stripSignedPointer(swift::remote::RemoteAbsolutePointer pointer) override {
174+
StripSignedPointer(swift::remote::RemoteAbsolutePointer pointer) override {
175175
return m_reflection_ctx.stripSignedPointer(pointer);
176176
}
177177
};

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ bool SwiftLanguageRuntimeImpl::AddJitObjectFileToReflectionContext(
677677
if (!obj_file_format)
678678
return false;
679679

680-
auto reflection_info_id = m_reflection_ctx->addImage(
680+
auto reflection_info_id = m_reflection_ctx->AddImage(
681681
[&](swift::ReflectionSectionKind section_kind)
682682
-> std::pair<swift::remote::RemoteRef<void>, uint64_t> {
683683
auto section_name = obj_file_format->getSectionName(section_kind);
@@ -842,7 +842,7 @@ SwiftLanguageRuntimeImpl::AddObjectFileToReflectionContext(
842842
return {};
843843
};
844844

845-
return m_reflection_ctx->addImage(
845+
return m_reflection_ctx->AddImage(
846846
[&](swift::ReflectionSectionKind section_kind)
847847
-> std::pair<swift::remote::RemoteRef<void>, uint64_t> {
848848
auto pair = find_section_with_kind(segment, section_kind);
@@ -901,18 +901,18 @@ bool SwiftLanguageRuntimeImpl::AddModuleToReflectionContext(
901901
auto size = obj_file->GetData(0, obj_file->GetByteSize(), extractor);
902902
const uint8_t *file_data = extractor.GetDataStart();
903903
llvm::sys::MemoryBlock file_buffer((void *)file_data, size);
904-
info_id = m_reflection_ctx->readELF(
904+
info_id = m_reflection_ctx->ReadELF(
905905
swift::remote::RemoteAddress(load_ptr),
906906
llvm::Optional<llvm::sys::MemoryBlock>(file_buffer),
907907
likely_module_names);
908908
} else if (read_from_file_cache &&
909909
obj_file->GetPluginName().equals("mach-o")) {
910910
info_id = AddObjectFileToReflectionContext(module_sp, likely_module_names);
911911
if (!info_id)
912-
info_id = m_reflection_ctx->addImage(swift::remote::RemoteAddress(load_ptr),
912+
info_id = m_reflection_ctx->AddImage(swift::remote::RemoteAddress(load_ptr),
913913
likely_module_names);
914914
} else {
915-
info_id = m_reflection_ctx->addImage(swift::remote::RemoteAddress(load_ptr),
915+
info_id = m_reflection_ctx->AddImage(swift::remote::RemoteAddress(load_ptr),
916916
likely_module_names);
917917
}
918918

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ SwiftLanguageRuntimeImpl::GetMemoryReader() {
254254
m_process, [&](swift::remote::RemoteAbsolutePointer pointer) {
255255
ThreadSafeReflectionContext reflection_context =
256256
GetReflectionContext();
257-
return reflection_context->stripSignedPointer(pointer);
257+
return reflection_context->StripSignedPointer(pointer);
258258
}));
259259
}
260260

@@ -668,7 +668,7 @@ SwiftLanguageRuntimeImpl::GetNumChildren(CompilerType type,
668668
return {};
669669

670670
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
671-
auto &builder = reflection_ctx->getBuilder();
671+
auto &builder = reflection_ctx->GetBuilder();
672672
auto tc = swift::reflection::TypeConverter(builder);
673673
LLDBTypeInfoProvider tip(*this, *ts);
674674
auto *cti = tc.getClassInstanceTypeInfo(tr, 0, &tip);
@@ -742,7 +742,7 @@ SwiftLanguageRuntimeImpl::GetNumFields(CompilerType type,
742742
return referent.GetNumFields(exe_ctx);
743743
return 0;
744744
case ReferenceKind::Strong:
745-
TypeConverter tc(GetReflectionContext()->getBuilder());
745+
TypeConverter tc(GetReflectionContext()->GetBuilder());
746746
LLDBTypeInfoProvider tip(*this, *ts);
747747
auto *cti = tc.getClassInstanceTypeInfo(tr, 0, &tip);
748748
if (auto *rti = llvm::dyn_cast_or_null<RecordTypeInfo>(cti)) {
@@ -875,7 +875,7 @@ SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
875875
child_indexes);
876876
case ReferenceKind::Strong: {
877877
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
878-
auto &builder = reflection_ctx->getBuilder();
878+
auto &builder = reflection_ctx->GetBuilder();
879879
TypeConverter tc(builder);
880880
LLDBTypeInfoProvider tip(*this, *ts);
881881
// `current_tr` iterates the class hierarchy, from the current class, each
@@ -1366,7 +1366,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Pack(
13661366
return {};
13671367
}
13681368

1369-
auto *type_ref = reflection_ctx->readTypeFromMetadata(md);
1369+
auto *type_ref = reflection_ctx->ReadTypeFromMetadata(md);
13701370
if (!type_ref) {
13711371
LLDB_LOGF(log,
13721372
"cannot decode pack_expansion type: failed to decode type "
@@ -1393,7 +1393,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Pack(
13931393

13941394
// Build a TypeRef from the demangle tree.
13951395
auto typeref_or_err =
1396-
decodeMangledType(reflection_ctx->getBuilder(), pack_element);
1396+
decodeMangledType(reflection_ctx->GetBuilder(), pack_element);
13971397
if (typeref_or_err.isError()) {
13981398
LLDB_LOGF(log, "Couldn't get TypeRef for %s",
13991399
pack_type.GetMangledTypeName().GetCString());
@@ -1403,7 +1403,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Pack(
14031403

14041404
// Apply the substitutions.
14051405
auto bound_typeref =
1406-
typeref->subst(reflection_ctx->getBuilder(), substitutions);
1406+
typeref->subst(reflection_ctx->GetBuilder(), substitutions);
14071407
swift::Demangle::NodePointer node = bound_typeref->getDemangling(dem);
14081408
CompilerType type = ts->RemangleAsType(dem, node);
14091409

@@ -1555,7 +1555,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Class(
15551555
}
15561556
Log *log(GetLog(LLDBLog::Types));
15571557
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
1558-
const auto *typeref = reflection_ctx->readTypeFromInstance(instance_ptr);
1558+
const auto *typeref = reflection_ctx->ReadTypeFromInstance(instance_ptr);
15591559
if (!typeref) {
15601560
LLDB_LOGF(log,
15611561
"could not read typeref for type: %s (instance_ptr = 0x%" PRIx64
@@ -1706,7 +1706,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Protocol(
17061706
swift::remote::RemoteAddress remote_existential(existential_address);
17071707

17081708
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
1709-
auto pair = reflection_ctx->projectExistentialAndUnwrapClass(
1709+
auto pair = reflection_ctx->ProjectExistentialAndUnwrapClass(
17101710
remote_existential, *protocol_typeref);
17111711
if (use_local_buffer)
17121712
PopLocalBuffer();
@@ -1818,7 +1818,7 @@ CompilerType SwiftLanguageRuntimeImpl::BindGenericTypeParameters(
18181818
NodePointer unbound_node =
18191819
dem.demangleSymbol(unbound_type.GetMangledTypeName().GetStringRef());
18201820
auto type_ref_or_err =
1821-
decodeMangledType(reflection_ctx->getBuilder(), unbound_node);
1821+
decodeMangledType(reflection_ctx->GetBuilder(), unbound_node);
18221822
if (type_ref_or_err.isError()) {
18231823
LLDB_LOG(GetLog(LLDBLog::Expressions | LLDBLog::Types),
18241824
"Couldn't get TypeRef of unbound type.");
@@ -1844,7 +1844,7 @@ CompilerType SwiftLanguageRuntimeImpl::BindGenericTypeParameters(
18441844
NodePointer child_node =
18451845
dem.demangleSymbol(type.GetMangledTypeName().GetStringRef());
18461846
auto type_ref_or_err =
1847-
decodeMangledType(reflection_ctx->getBuilder(), child_node);
1847+
decodeMangledType(reflection_ctx->GetBuilder(), child_node);
18481848
if (type_ref_or_err.isError()) {
18491849
LLDB_LOG(GetLog(LLDBLog::Expressions | LLDBLog::Types),
18501850
"Couldn't get TypeRef when binding generic type parameters.");
@@ -1862,7 +1862,7 @@ CompilerType SwiftLanguageRuntimeImpl::BindGenericTypeParameters(
18621862

18631863
// Apply the substitutions.
18641864
const swift::reflection::TypeRef *bound_type_ref =
1865-
type_ref->subst(reflection_ctx->getBuilder(), substitutions);
1865+
type_ref->subst(reflection_ctx->GetBuilder(), substitutions);
18661866
NodePointer node = bound_type_ref->getDemangling(dem);
18671867
return ts->GetTypeSystemSwiftTypeRef().RemangleAsType(dem, node);
18681868
}
@@ -1900,7 +1900,7 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
19001900
if (!metadata_location)
19011901
return;
19021902
const swift::reflection::TypeRef *type_ref =
1903-
reflection_ctx->readTypeFromMetadata(*metadata_location);
1903+
reflection_ctx->ReadTypeFromMetadata(*metadata_location);
19041904
if (!type_ref)
19051905
return;
19061906
substitutions.insert({{depth, index}, type_ref});
@@ -1918,7 +1918,7 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
19181918

19191919
// Build a TypeRef from the demangle tree.
19201920
auto type_ref_or_err =
1921-
decodeMangledType(reflection_ctx->getBuilder(), canonical);
1921+
decodeMangledType(reflection_ctx->GetBuilder(), canonical);
19221922
if (type_ref_or_err.isError()) {
19231923
LLDB_LOG(GetLog(LLDBLog::Expressions | LLDBLog::Types),
19241924
"Couldn't get TypeRef");
@@ -1928,7 +1928,7 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
19281928

19291929
// Apply the substitutions.
19301930
const swift::reflection::TypeRef *bound_type_ref =
1931-
type_ref->subst(reflection_ctx->getBuilder(), substitutions);
1931+
type_ref->subst(reflection_ctx->GetBuilder(), substitutions);
19321932
NodePointer node = bound_type_ref->getDemangling(dem);
19331933

19341934
// Import the type into the scratch context. Subsequent conversions
@@ -2165,7 +2165,7 @@ SwiftLanguageRuntimeImpl::GetValueType(ValueObject &in_value,
21652165
swift::remote::RemoteAddress remote_existential(existential_address);
21662166
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
21672167
llvm::Optional<bool> is_inlined =
2168-
reflection_ctx->isValueInlinedInExistentialContainer(
2168+
reflection_ctx->IsValueInlinedInExistentialContainer(
21692169
remote_existential);
21702170

21712171
if (use_local_buffer)
@@ -2548,7 +2548,7 @@ SwiftLanguageRuntimeImpl::GetTypeRef(CompilerType type,
25482548
return nullptr;
25492549

25502550
auto type_ref_or_err =
2551-
swift::Demangle::decodeMangledType(reflection_ctx->getBuilder(), node);
2551+
swift::Demangle::decodeMangledType(reflection_ctx->GetBuilder(), node);
25522552
if (type_ref_or_err.isError()) {
25532553
LLDB_LOGF(log,
25542554
"[SwiftLanguageRuntimeImpl::GetTypeRef] Could not find typeref "
@@ -2623,7 +2623,7 @@ SwiftLanguageRuntimeImpl::GetSwiftRuntimeTypeInfo(
26232623
return nullptr;
26242624

26252625
LLDBTypeInfoProvider provider(*this, *ts);
2626-
return reflection_ctx->getTypeInfo(type_ref, &provider);
2626+
return reflection_ctx->GetTypeInfo(type_ref, &provider);
26272627
}
26282628

26292629
bool SwiftLanguageRuntimeImpl::IsStoredInlineInBuffer(CompilerType type) {

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeImpl.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,42 +224,42 @@ class SwiftLanguageRuntimeImpl {
224224

225225
virtual ~ReflectionContextInterface();
226226

227-
virtual llvm::Optional<uint32_t> addImage(
227+
virtual llvm::Optional<uint32_t> AddImage(
228228
llvm::function_ref<std::pair<swift::remote::RemoteRef<void>, uint64_t>(
229229
swift::ReflectionSectionKind)>
230230
find_section,
231231
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) = 0;
232-
virtual llvm::Optional<uint32_t> addImage(
232+
virtual llvm::Optional<uint32_t> AddImage(
233233
swift::remote::RemoteAddress image_start,
234234
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) = 0;
235235
virtual llvm::Optional<uint32_t>
236-
readELF(swift::remote::RemoteAddress ImageStart,
236+
ReadELF(swift::remote::RemoteAddress ImageStart,
237237
llvm::Optional<llvm::sys::MemoryBlock> FileBuffer,
238238
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) = 0;
239239
virtual const swift::reflection::TypeInfo *
240-
getTypeInfo(const swift::reflection::TypeRef *type_ref,
240+
GetTypeInfo(const swift::reflection::TypeRef *type_ref,
241241
swift::remote::TypeInfoProvider *provider) = 0;
242-
virtual swift::remote::MemoryReader &getReader() = 0;
242+
virtual swift::remote::MemoryReader &GetReader() = 0;
243243
virtual bool
244244
ForEachSuperClassType(swift::remote::TypeInfoProvider *tip,
245245
lldb::addr_t pointer,
246246
std::function<bool(SuperClassType)> fn) = 0;
247247
virtual llvm::Optional<std::pair<const swift::reflection::TypeRef *,
248248
swift::remote::RemoteAddress>>
249-
projectExistentialAndUnwrapClass(
249+
ProjectExistentialAndUnwrapClass(
250250
swift::remote::RemoteAddress existential_addess,
251251
const swift::reflection::TypeRef &existential_tr) = 0;
252252
virtual const swift::reflection::TypeRef *
253-
readTypeFromMetadata(lldb::addr_t metadata_address,
253+
ReadTypeFromMetadata(lldb::addr_t metadata_address,
254254
bool skip_artificial_subclasses = false) = 0;
255255
virtual const swift::reflection::TypeRef *
256-
readTypeFromInstance(lldb::addr_t instance_address,
256+
ReadTypeFromInstance(lldb::addr_t instance_address,
257257
bool skip_artificial_subclasses = false) = 0;
258-
virtual swift::reflection::TypeRefBuilder &getBuilder() = 0;
259-
virtual llvm::Optional<bool> isValueInlinedInExistentialContainer(
258+
virtual swift::reflection::TypeRefBuilder &GetBuilder() = 0;
259+
virtual llvm::Optional<bool> IsValueInlinedInExistentialContainer(
260260
swift::remote::RemoteAddress existential_address) = 0;
261261
virtual swift::remote::RemoteAbsolutePointer
262-
stripSignedPointer(swift::remote::RemoteAbsolutePointer pointer) = 0;
262+
StripSignedPointer(swift::remote::RemoteAbsolutePointer pointer) = 0;
263263
};
264264

265265
/// A wrapper around TargetReflectionContext, which holds a lock to ensure

0 commit comments

Comments
 (0)