Skip to content

Commit b9f5dde

Browse files
committed
Convert ReflectionContext to LLDB coding style (NFC)
1 parent 010726b commit b9f5dde

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
@@ -671,7 +671,7 @@ bool SwiftLanguageRuntimeImpl::AddJitObjectFileToReflectionContext(
671671
if (!obj_file_format)
672672
return false;
673673

674-
auto reflection_info_id = m_reflection_ctx->addImage(
674+
auto reflection_info_id = m_reflection_ctx->AddImage(
675675
[&](swift::ReflectionSectionKind section_kind)
676676
-> std::pair<swift::remote::RemoteRef<void>, uint64_t> {
677677
auto section_name = obj_file_format->getSectionName(section_kind);
@@ -836,7 +836,7 @@ SwiftLanguageRuntimeImpl::AddObjectFileToReflectionContext(
836836
return {};
837837
};
838838

839-
return m_reflection_ctx->addImage(
839+
return m_reflection_ctx->AddImage(
840840
[&](swift::ReflectionSectionKind section_kind)
841841
-> std::pair<swift::remote::RemoteRef<void>, uint64_t> {
842842
auto pair = find_section_with_kind(segment, section_kind);
@@ -895,18 +895,18 @@ bool SwiftLanguageRuntimeImpl::AddModuleToReflectionContext(
895895
auto size = obj_file->GetData(0, obj_file->GetByteSize(), extractor);
896896
const uint8_t *file_data = extractor.GetDataStart();
897897
llvm::sys::MemoryBlock file_buffer((void *)file_data, size);
898-
info_id = m_reflection_ctx->readELF(
898+
info_id = m_reflection_ctx->ReadELF(
899899
swift::remote::RemoteAddress(load_ptr),
900900
llvm::Optional<llvm::sys::MemoryBlock>(file_buffer),
901901
likely_module_names);
902902
} else if (read_from_file_cache &&
903903
obj_file->GetPluginName().equals("mach-o")) {
904904
info_id = AddObjectFileToReflectionContext(module_sp, likely_module_names);
905905
if (!info_id)
906-
info_id = m_reflection_ctx->addImage(swift::remote::RemoteAddress(load_ptr),
906+
info_id = m_reflection_ctx->AddImage(swift::remote::RemoteAddress(load_ptr),
907907
likely_module_names);
908908
} else {
909-
info_id = m_reflection_ctx->addImage(swift::remote::RemoteAddress(load_ptr),
909+
info_id = m_reflection_ctx->AddImage(swift::remote::RemoteAddress(load_ptr),
910910
likely_module_names);
911911
}
912912

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

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

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

671671
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
672-
auto &builder = reflection_ctx->getBuilder();
672+
auto &builder = reflection_ctx->GetBuilder();
673673
auto tc = swift::reflection::TypeConverter(builder);
674674
LLDBTypeInfoProvider tip(*this, *ts);
675675
auto *cti = tc.getClassInstanceTypeInfo(tr, 0, &tip);
@@ -743,7 +743,7 @@ SwiftLanguageRuntimeImpl::GetNumFields(CompilerType type,
743743
return referent.GetNumFields(exe_ctx);
744744
return 0;
745745
case ReferenceKind::Strong:
746-
TypeConverter tc(GetReflectionContext()->getBuilder());
746+
TypeConverter tc(GetReflectionContext()->GetBuilder());
747747
LLDBTypeInfoProvider tip(*this, *ts);
748748
auto *cti = tc.getClassInstanceTypeInfo(tr, 0, &tip);
749749
if (auto *rti = llvm::dyn_cast_or_null<RecordTypeInfo>(cti)) {
@@ -876,7 +876,7 @@ SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
876876
child_indexes);
877877
case ReferenceKind::Strong: {
878878
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
879-
auto &builder = reflection_ctx->getBuilder();
879+
auto &builder = reflection_ctx->GetBuilder();
880880
TypeConverter tc(builder);
881881
LLDBTypeInfoProvider tip(*this, *ts);
882882
// `current_tr` iterates the class hierarchy, from the current class, each
@@ -1367,7 +1367,7 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Pack(
13671367
return {};
13681368
}
13691369

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

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

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

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

17091709
ThreadSafeReflectionContext reflection_ctx = GetReflectionContext();
1710-
auto pair = reflection_ctx->projectExistentialAndUnwrapClass(
1710+
auto pair = reflection_ctx->ProjectExistentialAndUnwrapClass(
17111711
remote_existential, *protocol_typeref);
17121712
if (use_local_buffer)
17131713
PopLocalBuffer();
@@ -1819,7 +1819,7 @@ CompilerType SwiftLanguageRuntimeImpl::BindGenericTypeParameters(
18191819
NodePointer unbound_node =
18201820
dem.demangleSymbol(unbound_type.GetMangledTypeName().GetStringRef());
18211821
auto type_ref_or_err =
1822-
decodeMangledType(reflection_ctx->getBuilder(), unbound_node);
1822+
decodeMangledType(reflection_ctx->GetBuilder(), unbound_node);
18231823
if (type_ref_or_err.isError()) {
18241824
LLDB_LOG(GetLog(LLDBLog::Expressions | LLDBLog::Types),
18251825
"Couldn't get TypeRef of unbound type.");
@@ -1845,7 +1845,7 @@ CompilerType SwiftLanguageRuntimeImpl::BindGenericTypeParameters(
18451845
NodePointer child_node =
18461846
dem.demangleSymbol(type.GetMangledTypeName().GetStringRef());
18471847
auto type_ref_or_err =
1848-
decodeMangledType(reflection_ctx->getBuilder(), child_node);
1848+
decodeMangledType(reflection_ctx->GetBuilder(), child_node);
18491849
if (type_ref_or_err.isError()) {
18501850
LLDB_LOG(GetLog(LLDBLog::Expressions | LLDBLog::Types),
18511851
"Couldn't get TypeRef when binding generic type parameters.");
@@ -1863,7 +1863,7 @@ CompilerType SwiftLanguageRuntimeImpl::BindGenericTypeParameters(
18631863

18641864
// Apply the substitutions.
18651865
const swift::reflection::TypeRef *bound_type_ref =
1866-
type_ref->subst(reflection_ctx->getBuilder(), substitutions);
1866+
type_ref->subst(reflection_ctx->GetBuilder(), substitutions);
18671867
NodePointer node = bound_type_ref->getDemangling(dem);
18681868
return ts->GetTypeSystemSwiftTypeRef().RemangleAsType(dem, node);
18691869
}
@@ -1901,7 +1901,7 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
19011901
if (!metadata_location)
19021902
return;
19031903
const swift::reflection::TypeRef *type_ref =
1904-
reflection_ctx->readTypeFromMetadata(*metadata_location);
1904+
reflection_ctx->ReadTypeFromMetadata(*metadata_location);
19051905
if (!type_ref)
19061906
return;
19071907
substitutions.insert({{depth, index}, type_ref});
@@ -1919,7 +1919,7 @@ SwiftLanguageRuntimeImpl::BindGenericTypeParameters(StackFrame &stack_frame,
19191919

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

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

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

21722172
if (use_local_buffer)
@@ -2648,7 +2648,7 @@ SwiftLanguageRuntimeImpl::GetTypeRef(CompilerType type,
26482648
return nullptr;
26492649

26502650
auto type_ref_or_err =
2651-
swift::Demangle::decodeMangledType(reflection_ctx->getBuilder(), node);
2651+
swift::Demangle::decodeMangledType(reflection_ctx->GetBuilder(), node);
26522652
if (type_ref_or_err.isError()) {
26532653
LLDB_LOGF(log,
26542654
"[SwiftLanguageRuntimeImpl::GetTypeRef] Could not find typeref "
@@ -2723,7 +2723,7 @@ SwiftLanguageRuntimeImpl::GetSwiftRuntimeTypeInfo(
27232723
return nullptr;
27242724

27252725
LLDBTypeInfoProvider provider(*this, *ts);
2726-
return reflection_ctx->getTypeInfo(type_ref, &provider);
2726+
return reflection_ctx->GetTypeInfo(type_ref, &provider);
27272727
}
27282728

27292729
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
@@ -220,42 +220,42 @@ class SwiftLanguageRuntimeImpl {
220220

221221
virtual ~ReflectionContextInterface();
222222

223-
virtual llvm::Optional<uint32_t> addImage(
223+
virtual llvm::Optional<uint32_t> AddImage(
224224
llvm::function_ref<std::pair<swift::remote::RemoteRef<void>, uint64_t>(
225225
swift::ReflectionSectionKind)>
226226
find_section,
227227
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) = 0;
228-
virtual llvm::Optional<uint32_t> addImage(
228+
virtual llvm::Optional<uint32_t> AddImage(
229229
swift::remote::RemoteAddress image_start,
230230
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) = 0;
231231
virtual llvm::Optional<uint32_t>
232-
readELF(swift::remote::RemoteAddress ImageStart,
232+
ReadELF(swift::remote::RemoteAddress ImageStart,
233233
llvm::Optional<llvm::sys::MemoryBlock> FileBuffer,
234234
llvm::SmallVector<llvm::StringRef, 1> likely_module_names = {}) = 0;
235235
virtual const swift::reflection::TypeInfo *
236-
getTypeInfo(const swift::reflection::TypeRef *type_ref,
236+
GetTypeInfo(const swift::reflection::TypeRef *type_ref,
237237
swift::remote::TypeInfoProvider *provider) = 0;
238-
virtual swift::remote::MemoryReader &getReader() = 0;
238+
virtual swift::remote::MemoryReader &GetReader() = 0;
239239
virtual bool
240240
ForEachSuperClassType(swift::remote::TypeInfoProvider *tip,
241241
lldb::addr_t pointer,
242242
std::function<bool(SuperClassType)> fn) = 0;
243243
virtual llvm::Optional<std::pair<const swift::reflection::TypeRef *,
244244
swift::remote::RemoteAddress>>
245-
projectExistentialAndUnwrapClass(
245+
ProjectExistentialAndUnwrapClass(
246246
swift::remote::RemoteAddress existential_addess,
247247
const swift::reflection::TypeRef &existential_tr) = 0;
248248
virtual const swift::reflection::TypeRef *
249-
readTypeFromMetadata(lldb::addr_t metadata_address,
249+
ReadTypeFromMetadata(lldb::addr_t metadata_address,
250250
bool skip_artificial_subclasses = false) = 0;
251251
virtual const swift::reflection::TypeRef *
252-
readTypeFromInstance(lldb::addr_t instance_address,
252+
ReadTypeFromInstance(lldb::addr_t instance_address,
253253
bool skip_artificial_subclasses = false) = 0;
254-
virtual swift::reflection::TypeRefBuilder &getBuilder() = 0;
255-
virtual llvm::Optional<bool> isValueInlinedInExistentialContainer(
254+
virtual swift::reflection::TypeRefBuilder &GetBuilder() = 0;
255+
virtual llvm::Optional<bool> IsValueInlinedInExistentialContainer(
256256
swift::remote::RemoteAddress existential_address) = 0;
257257
virtual swift::remote::RemoteAbsolutePointer
258-
stripSignedPointer(swift::remote::RemoteAbsolutePointer pointer) = 0;
258+
StripSignedPointer(swift::remote::RemoteAbsolutePointer pointer) = 0;
259259
};
260260

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

0 commit comments

Comments
 (0)