@@ -806,7 +806,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
806
806
807
807
auto visit_pack_element = [&](CompilerType pack_element_type,
808
808
unsigned idx) {
809
- auto get_name = [&]() {
809
+ auto get_name = [&]() -> std::string {
810
810
std::string name;
811
811
llvm::raw_string_ostream os (name);
812
812
os << ' .' << idx;
@@ -859,13 +859,13 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
859
859
std::optional<TypeSystemSwift::TupleElement> tuple,
860
860
bool hide_existentials, bool is_enum,
861
861
unsigned depth = 0 ) -> llvm::Expected<unsigned > {
862
- auto get_name = [&]() {
862
+ auto get_name = [&]() -> std::string {
863
863
return tuple ? tuple->element_name .GetStringRef ().str () : field.Name ;
864
864
};
865
865
// SwiftASTContext hardcodes the members of protocols as raw
866
866
// pointers. Remote Mirrors reports them as UnknownObject instead.
867
867
if (hide_existentials && ts.IsExistentialType (m_type.GetOpaqueQualType ())) {
868
- auto get_info = [&]() {
868
+ auto get_info = [&]() -> llvm::Expected<ChildInfo> {
869
869
ChildInfo child;
870
870
child.byte_size = field.TI .getSize ();
871
871
child.byte_offset = field.Offset ;
@@ -888,7 +888,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
888
888
if (!field_type)
889
889
field_type = GetTypeFromTypeRef (ts, field.TR );
890
890
}
891
- auto get_info = [&]() {
891
+ auto get_info = [&]() -> llvm::Expected<ChildInfo> {
892
892
ChildInfo child;
893
893
child.byte_size = field.TI .getSize ();
894
894
// Bug-for-bug compatibility. See comment in
@@ -943,7 +943,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
943
943
auto visit_existential = [&](unsigned idx) -> llvm::Expected<unsigned > {
944
944
// Compatibility with SwiftASTContext.
945
945
if (idx < 3 ) {
946
- auto get_name = [&]() {
946
+ auto get_name = [&]() -> std::string {
947
947
std::string child_name = " payload_data_" ;
948
948
child_name += (' 0' + idx);
949
949
return child_name;
@@ -987,7 +987,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
987
987
if (count_only)
988
988
return children.size ();
989
989
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
990
- auto get_name = [&]() { return c.name ; };
990
+ auto get_name = [&]() -> std::string { return c.name ; };
991
991
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
992
992
ChildInfo child;
993
993
child.byte_size = ts.GetPointerByteSize ();
@@ -1039,7 +1039,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1039
1039
if (count_only)
1040
1040
return children.size ();
1041
1041
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
1042
- auto get_name = [&]() { return c.name ; };
1042
+ auto get_name = [&]() -> std::string { return c.name ; };
1043
1043
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
1044
1044
ChildInfo child;
1045
1045
child.byte_size = ts.GetPointerByteSize ();
@@ -1125,7 +1125,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1125
1125
*tr, ts.GetDescriptorFinder ()))
1126
1126
if (auto error = visit_callback (
1127
1127
GetTypeFromTypeRef (ts, super_tr), depth,
1128
- []() { return " <base class>" ; },
1128
+ []() -> std::string { return " <base class>" ; },
1129
1129
[]() -> llvm::Expected<ChildInfo> {
1130
1130
return ChildInfo ();
1131
1131
})) {
@@ -1153,7 +1153,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1153
1153
}
1154
1154
if (auto *super_tr = reflection_ctx->LookupSuperclass (
1155
1155
*tr, ts.GetDescriptorFinder ())) {
1156
- auto get_name = []() { return " <base class>" ; };
1156
+ auto get_name = []() -> std::string { return " <base class>" ; };
1157
1157
auto get_info = []() -> llvm::Expected<ChildInfo> {
1158
1158
return ChildInfo ();
1159
1159
};
@@ -1267,7 +1267,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1267
1267
// base class gets injected. Its parent will be a nested
1268
1268
// field in the base class.
1269
1269
if (!type_ref) {
1270
- auto get_name = [&]() { return " <base class>" ; };
1270
+ auto get_name = [&]() -> std::string { return " <base class>" ; };
1271
1271
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
1272
1272
return ChildInfo ();
1273
1273
};
@@ -1279,7 +1279,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1279
1279
}
1280
1280
1281
1281
CompilerType super_type = GetTypeFromTypeRef (ts, type_ref);
1282
- auto get_name = [&]() {
1282
+ auto get_name = [&]() -> std::string {
1283
1283
auto child_name = super_type.GetTypeName ().GetStringRef ().str ();
1284
1284
// FIXME: This should be fixed in GetDisplayTypeName instead!
1285
1285
if (child_name == " __C.NSObject" )
@@ -1361,8 +1361,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1361
1361
CompilerType type =
1362
1362
ts.RemangleAsType (dem, dem_array_type->getChild (1 ), flavor);
1363
1363
1364
- auto visit_element = [&](unsigned idx) {
1365
- auto get_name = [&]() {
1364
+ auto visit_element = [&](unsigned idx) -> llvm::Error {
1365
+ auto get_name = [&]() -> std::string {
1366
1366
std::string child_name;
1367
1367
llvm::raw_string_ostream (child_name) << idx;
1368
1368
return child_name;
@@ -1409,8 +1409,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1409
1409
if (count_only)
1410
1410
return 0 ;
1411
1411
if (auto err = visit_callback (
1412
- CompilerType (), 0 , []() { return " " ; },
1413
- []() { return ChildInfo (); }))
1412
+ CompilerType (), 0 , []() -> std::string { return " " ; },
1413
+ []() -> llvm::Expected<ChildInfo> { return ChildInfo (); }))
1414
1414
return err;
1415
1415
return success;
1416
1416
}
0 commit comments