Skip to content

Commit e64ef52

Browse files
Merge pull request #10837 from adrian-prantl/153137542
[lldb] Add missing return type annotations
2 parents c093fd9 + 2e2508c commit e64ef52

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
791791

792792
auto visit_pack_element = [&](CompilerType pack_element_type,
793793
unsigned idx) {
794-
auto get_name = [&]() {
794+
auto get_name = [&]() -> std::string {
795795
std::string name;
796796
llvm::raw_string_ostream os(name);
797797
os << '.' << idx;
@@ -844,13 +844,13 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
844844
std::optional<TypeSystemSwift::TupleElement> tuple,
845845
bool hide_existentials, bool is_enum,
846846
unsigned depth = 0) -> llvm::Expected<unsigned> {
847-
auto get_name = [&]() {
847+
auto get_name = [&]() -> std::string {
848848
return tuple ? tuple->element_name.GetStringRef().str() : field.Name;
849849
};
850850
// SwiftASTContext hardcodes the members of protocols as raw
851851
// pointers. Remote Mirrors reports them as UnknownObject instead.
852852
if (hide_existentials && ts.IsExistentialType(m_type.GetOpaqueQualType())) {
853-
auto get_info = [&]() {
853+
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
854854
ChildInfo child;
855855
child.byte_size = field.TI.getSize();
856856
child.byte_offset = field.Offset;
@@ -873,7 +873,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
873873
if (!field_type)
874874
field_type = GetTypeFromTypeRef(ts, field.TR);
875875
}
876-
auto get_info = [&]() {
876+
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
877877
ChildInfo child;
878878
child.byte_size = field.TI.getSize();
879879
// Bug-for-bug compatibility. See comment in
@@ -928,7 +928,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
928928
auto visit_existential = [&](unsigned idx) -> llvm::Expected<unsigned> {
929929
// Compatibility with SwiftASTContext.
930930
if (idx < 3) {
931-
auto get_name = [&]() {
931+
auto get_name = [&]() -> std::string {
932932
std::string child_name = "payload_data_";
933933
child_name += ('0' + idx);
934934
return child_name;
@@ -972,7 +972,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
972972
if (count_only)
973973
return children.size();
974974
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
975-
auto get_name = [&]() { return c.name; };
975+
auto get_name = [&]() -> std::string { return c.name; };
976976
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
977977
ChildInfo child;
978978
child.byte_size = ts.GetPointerByteSize();
@@ -1024,7 +1024,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
10241024
if (count_only)
10251025
return children.size();
10261026
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
1027-
auto get_name = [&]() { return c.name; };
1027+
auto get_name = [&]() -> std::string { return c.name; };
10281028
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
10291029
ChildInfo child;
10301030
child.byte_size = ts.GetPointerByteSize();
@@ -1110,7 +1110,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
11101110
*tr, ts.GetDescriptorFinder()))
11111111
if (auto error = visit_callback(
11121112
GetTypeFromTypeRef(ts, super_tr), depth,
1113-
[]() { return "<base class>"; },
1113+
[]() -> std::string { return "<base class>"; },
11141114
[]() -> llvm::Expected<ChildInfo> {
11151115
return ChildInfo();
11161116
})) {
@@ -1138,7 +1138,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
11381138
}
11391139
if (auto *super_tr = reflection_ctx->LookupSuperclass(
11401140
*tr, ts.GetDescriptorFinder())) {
1141-
auto get_name = []() { return "<base class>"; };
1141+
auto get_name = []() -> std::string { return "<base class>"; };
11421142
auto get_info = []() -> llvm::Expected<ChildInfo> {
11431143
return ChildInfo();
11441144
};
@@ -1252,7 +1252,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
12521252
// base class gets injected. Its parent will be a nested
12531253
// field in the base class.
12541254
if (!type_ref) {
1255-
auto get_name = [&]() { return "<base class>"; };
1255+
auto get_name = [&]() -> std::string { return "<base class>"; };
12561256
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
12571257
return ChildInfo();
12581258
};
@@ -1264,7 +1264,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
12641264
}
12651265

12661266
CompilerType super_type = GetTypeFromTypeRef(ts, type_ref);
1267-
auto get_name = [&]() {
1267+
auto get_name = [&]() -> std::string {
12681268
auto child_name = super_type.GetTypeName().GetStringRef().str();
12691269
// FIXME: This should be fixed in GetDisplayTypeName instead!
12701270
if (child_name == "__C.NSObject")
@@ -1346,8 +1346,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
13461346
CompilerType type =
13471347
ts.RemangleAsType(dem, dem_array_type->getChild(1), flavor);
13481348

1349-
auto visit_element = [&](unsigned idx) {
1350-
auto get_name = [&]() {
1349+
auto visit_element = [&](unsigned idx) -> llvm::Error {
1350+
auto get_name = [&]() -> std::string {
13511351
std::string child_name;
13521352
llvm::raw_string_ostream(child_name) << idx;
13531353
return child_name;
@@ -1394,8 +1394,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
13941394
if (count_only)
13951395
return 0;
13961396
if (auto err = visit_callback(
1397-
CompilerType(), 0, []() { return ""; },
1398-
[]() { return ChildInfo(); }))
1397+
CompilerType(), 0, []() -> std::string { return ""; },
1398+
[]() -> llvm::Expected<ChildInfo> { return ChildInfo(); }))
13991399
return err;
14001400
return success;
14011401
}

0 commit comments

Comments
 (0)