Skip to content

Commit 07104d3

Browse files
Merge pull request #10844 from adrian-prantl/cherry-pick-next-lldb-Add-missing-return-type-annotations
[Cherry-pick into next] [lldb] Add missing return type annotations
2 parents 0026dc7 + c855877 commit 07104d3

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
@@ -806,7 +806,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
806806

807807
auto visit_pack_element = [&](CompilerType pack_element_type,
808808
unsigned idx) {
809-
auto get_name = [&]() {
809+
auto get_name = [&]() -> std::string {
810810
std::string name;
811811
llvm::raw_string_ostream os(name);
812812
os << '.' << idx;
@@ -859,13 +859,13 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
859859
std::optional<TypeSystemSwift::TupleElement> tuple,
860860
bool hide_existentials, bool is_enum,
861861
unsigned depth = 0) -> llvm::Expected<unsigned> {
862-
auto get_name = [&]() {
862+
auto get_name = [&]() -> std::string {
863863
return tuple ? tuple->element_name.GetStringRef().str() : field.Name;
864864
};
865865
// SwiftASTContext hardcodes the members of protocols as raw
866866
// pointers. Remote Mirrors reports them as UnknownObject instead.
867867
if (hide_existentials && ts.IsExistentialType(m_type.GetOpaqueQualType())) {
868-
auto get_info = [&]() {
868+
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
869869
ChildInfo child;
870870
child.byte_size = field.TI.getSize();
871871
child.byte_offset = field.Offset;
@@ -888,7 +888,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
888888
if (!field_type)
889889
field_type = GetTypeFromTypeRef(ts, field.TR);
890890
}
891-
auto get_info = [&]() {
891+
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
892892
ChildInfo child;
893893
child.byte_size = field.TI.getSize();
894894
// Bug-for-bug compatibility. See comment in
@@ -943,7 +943,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
943943
auto visit_existential = [&](unsigned idx) -> llvm::Expected<unsigned> {
944944
// Compatibility with SwiftASTContext.
945945
if (idx < 3) {
946-
auto get_name = [&]() {
946+
auto get_name = [&]() -> std::string {
947947
std::string child_name = "payload_data_";
948948
child_name += ('0' + idx);
949949
return child_name;
@@ -987,7 +987,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
987987
if (count_only)
988988
return children.size();
989989
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
990-
auto get_name = [&]() { return c.name; };
990+
auto get_name = [&]() -> std::string { return c.name; };
991991
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
992992
ChildInfo child;
993993
child.byte_size = ts.GetPointerByteSize();
@@ -1039,7 +1039,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
10391039
if (count_only)
10401040
return children.size();
10411041
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
1042-
auto get_name = [&]() { return c.name; };
1042+
auto get_name = [&]() -> std::string { return c.name; };
10431043
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
10441044
ChildInfo child;
10451045
child.byte_size = ts.GetPointerByteSize();
@@ -1125,7 +1125,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
11251125
*tr, ts.GetDescriptorFinder()))
11261126
if (auto error = visit_callback(
11271127
GetTypeFromTypeRef(ts, super_tr), depth,
1128-
[]() { return "<base class>"; },
1128+
[]() -> std::string { return "<base class>"; },
11291129
[]() -> llvm::Expected<ChildInfo> {
11301130
return ChildInfo();
11311131
})) {
@@ -1153,7 +1153,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
11531153
}
11541154
if (auto *super_tr = reflection_ctx->LookupSuperclass(
11551155
*tr, ts.GetDescriptorFinder())) {
1156-
auto get_name = []() { return "<base class>"; };
1156+
auto get_name = []() -> std::string { return "<base class>"; };
11571157
auto get_info = []() -> llvm::Expected<ChildInfo> {
11581158
return ChildInfo();
11591159
};
@@ -1267,7 +1267,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
12671267
// base class gets injected. Its parent will be a nested
12681268
// field in the base class.
12691269
if (!type_ref) {
1270-
auto get_name = [&]() { return "<base class>"; };
1270+
auto get_name = [&]() -> std::string { return "<base class>"; };
12711271
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
12721272
return ChildInfo();
12731273
};
@@ -1279,7 +1279,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
12791279
}
12801280

12811281
CompilerType super_type = GetTypeFromTypeRef(ts, type_ref);
1282-
auto get_name = [&]() {
1282+
auto get_name = [&]() -> std::string {
12831283
auto child_name = super_type.GetTypeName().GetStringRef().str();
12841284
// FIXME: This should be fixed in GetDisplayTypeName instead!
12851285
if (child_name == "__C.NSObject")
@@ -1361,8 +1361,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
13611361
CompilerType type =
13621362
ts.RemangleAsType(dem, dem_array_type->getChild(1), flavor);
13631363

1364-
auto visit_element = [&](unsigned idx) {
1365-
auto get_name = [&]() {
1364+
auto visit_element = [&](unsigned idx) -> llvm::Error {
1365+
auto get_name = [&]() -> std::string {
13661366
std::string child_name;
13671367
llvm::raw_string_ostream(child_name) << idx;
13681368
return child_name;
@@ -1409,8 +1409,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
14091409
if (count_only)
14101410
return 0;
14111411
if (auto err = visit_callback(
1412-
CompilerType(), 0, []() { return ""; },
1413-
[]() { return ChildInfo(); }))
1412+
CompilerType(), 0, []() -> std::string { return ""; },
1413+
[]() -> llvm::Expected<ChildInfo> { return ChildInfo(); }))
14141414
return err;
14151415
return success;
14161416
}

0 commit comments

Comments
 (0)