@@ -791,7 +791,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
791
791
792
792
auto visit_pack_element = [&](CompilerType pack_element_type,
793
793
unsigned idx) {
794
- auto get_name = [&]() {
794
+ auto get_name = [&]() -> std::string {
795
795
std::string name;
796
796
llvm::raw_string_ostream os (name);
797
797
os << ' .' << idx;
@@ -844,13 +844,13 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
844
844
std::optional<TypeSystemSwift::TupleElement> tuple,
845
845
bool hide_existentials, bool is_enum,
846
846
unsigned depth = 0 ) -> llvm::Expected<unsigned > {
847
- auto get_name = [&]() {
847
+ auto get_name = [&]() -> std::string {
848
848
return tuple ? tuple->element_name .GetStringRef ().str () : field.Name ;
849
849
};
850
850
// SwiftASTContext hardcodes the members of protocols as raw
851
851
// pointers. Remote Mirrors reports them as UnknownObject instead.
852
852
if (hide_existentials && ts.IsExistentialType (m_type.GetOpaqueQualType ())) {
853
- auto get_info = [&]() {
853
+ auto get_info = [&]() -> llvm::Expected<ChildInfo> {
854
854
ChildInfo child;
855
855
child.byte_size = field.TI .getSize ();
856
856
child.byte_offset = field.Offset ;
@@ -873,7 +873,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
873
873
if (!field_type)
874
874
field_type = GetTypeFromTypeRef (ts, field.TR );
875
875
}
876
- auto get_info = [&]() {
876
+ auto get_info = [&]() -> llvm::Expected<ChildInfo> {
877
877
ChildInfo child;
878
878
child.byte_size = field.TI .getSize ();
879
879
// Bug-for-bug compatibility. See comment in
@@ -928,7 +928,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
928
928
auto visit_existential = [&](unsigned idx) -> llvm::Expected<unsigned > {
929
929
// Compatibility with SwiftASTContext.
930
930
if (idx < 3 ) {
931
- auto get_name = [&]() {
931
+ auto get_name = [&]() -> std::string {
932
932
std::string child_name = " payload_data_" ;
933
933
child_name += (' 0' + idx);
934
934
return child_name;
@@ -972,7 +972,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
972
972
if (count_only)
973
973
return children.size ();
974
974
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
975
- auto get_name = [&]() { return c.name ; };
975
+ auto get_name = [&]() -> std::string { return c.name ; };
976
976
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
977
977
ChildInfo child;
978
978
child.byte_size = ts.GetPointerByteSize ();
@@ -1024,7 +1024,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1024
1024
if (count_only)
1025
1025
return children.size ();
1026
1026
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
1027
- auto get_name = [&]() { return c.name ; };
1027
+ auto get_name = [&]() -> std::string { return c.name ; };
1028
1028
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
1029
1029
ChildInfo child;
1030
1030
child.byte_size = ts.GetPointerByteSize ();
@@ -1110,7 +1110,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1110
1110
*tr, ts.GetDescriptorFinder ()))
1111
1111
if (auto error = visit_callback (
1112
1112
GetTypeFromTypeRef (ts, super_tr), depth,
1113
- []() { return " <base class>" ; },
1113
+ []() -> std::string { return " <base class>" ; },
1114
1114
[]() -> llvm::Expected<ChildInfo> {
1115
1115
return ChildInfo ();
1116
1116
})) {
@@ -1138,7 +1138,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1138
1138
}
1139
1139
if (auto *super_tr = reflection_ctx->LookupSuperclass (
1140
1140
*tr, ts.GetDescriptorFinder ())) {
1141
- auto get_name = []() { return " <base class>" ; };
1141
+ auto get_name = []() -> std::string { return " <base class>" ; };
1142
1142
auto get_info = []() -> llvm::Expected<ChildInfo> {
1143
1143
return ChildInfo ();
1144
1144
};
@@ -1252,7 +1252,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1252
1252
// base class gets injected. Its parent will be a nested
1253
1253
// field in the base class.
1254
1254
if (!type_ref) {
1255
- auto get_name = [&]() { return " <base class>" ; };
1255
+ auto get_name = [&]() -> std::string { return " <base class>" ; };
1256
1256
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
1257
1257
return ChildInfo ();
1258
1258
};
@@ -1264,7 +1264,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1264
1264
}
1265
1265
1266
1266
CompilerType super_type = GetTypeFromTypeRef (ts, type_ref);
1267
- auto get_name = [&]() {
1267
+ auto get_name = [&]() -> std::string {
1268
1268
auto child_name = super_type.GetTypeName ().GetStringRef ().str ();
1269
1269
// FIXME: This should be fixed in GetDisplayTypeName instead!
1270
1270
if (child_name == " __C.NSObject" )
@@ -1346,8 +1346,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1346
1346
CompilerType type =
1347
1347
ts.RemangleAsType (dem, dem_array_type->getChild (1 ), flavor);
1348
1348
1349
- auto visit_element = [&](unsigned idx) {
1350
- auto get_name = [&]() {
1349
+ auto visit_element = [&](unsigned idx) -> llvm::Error {
1350
+ auto get_name = [&]() -> std::string {
1351
1351
std::string child_name;
1352
1352
llvm::raw_string_ostream (child_name) << idx;
1353
1353
return child_name;
@@ -1394,8 +1394,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
1394
1394
if (count_only)
1395
1395
return 0 ;
1396
1396
if (auto err = visit_callback (
1397
- CompilerType (), 0 , []() { return " " ; },
1398
- []() { return ChildInfo (); }))
1397
+ CompilerType (), 0 , []() -> std::string { return " " ; },
1398
+ []() -> llvm::Expected<ChildInfo> { return ChildInfo (); }))
1399
1399
return err;
1400
1400
return success;
1401
1401
}
0 commit comments