Skip to content

[lldb] Add missing return type annotations #10837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,

auto visit_pack_element = [&](CompilerType pack_element_type,
unsigned idx) {
auto get_name = [&]() {
auto get_name = [&]() -> std::string {
std::string name;
llvm::raw_string_ostream os(name);
os << '.' << idx;
Expand Down Expand Up @@ -844,13 +844,13 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
std::optional<TypeSystemSwift::TupleElement> tuple,
bool hide_existentials, bool is_enum,
unsigned depth = 0) -> llvm::Expected<unsigned> {
auto get_name = [&]() {
auto get_name = [&]() -> std::string {
return tuple ? tuple->element_name.GetStringRef().str() : field.Name;
};
// SwiftASTContext hardcodes the members of protocols as raw
// pointers. Remote Mirrors reports them as UnknownObject instead.
if (hide_existentials && ts.IsExistentialType(m_type.GetOpaqueQualType())) {
auto get_info = [&]() {
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
ChildInfo child;
child.byte_size = field.TI.getSize();
child.byte_offset = field.Offset;
Expand All @@ -873,7 +873,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
if (!field_type)
field_type = GetTypeFromTypeRef(ts, field.TR);
}
auto get_info = [&]() {
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
ChildInfo child;
child.byte_size = field.TI.getSize();
// Bug-for-bug compatibility. See comment in
Expand Down Expand Up @@ -928,7 +928,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
auto visit_existential = [&](unsigned idx) -> llvm::Expected<unsigned> {
// Compatibility with SwiftASTContext.
if (idx < 3) {
auto get_name = [&]() {
auto get_name = [&]() -> std::string {
std::string child_name = "payload_data_";
child_name += ('0' + idx);
return child_name;
Expand Down Expand Up @@ -972,7 +972,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
if (count_only)
return children.size();
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
auto get_name = [&]() { return c.name; };
auto get_name = [&]() -> std::string { return c.name; };
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
ChildInfo child;
child.byte_size = ts.GetPointerByteSize();
Expand Down Expand Up @@ -1024,7 +1024,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
if (count_only)
return children.size();
auto visit_existential = [&](ExistentialSyntheticChild c, unsigned idx) {
auto get_name = [&]() { return c.name; };
auto get_name = [&]() -> std::string { return c.name; };
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
ChildInfo child;
child.byte_size = ts.GetPointerByteSize();
Expand Down Expand Up @@ -1110,7 +1110,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
*tr, ts.GetDescriptorFinder()))
if (auto error = visit_callback(
GetTypeFromTypeRef(ts, super_tr), depth,
[]() { return "<base class>"; },
[]() -> std::string { return "<base class>"; },
[]() -> llvm::Expected<ChildInfo> {
return ChildInfo();
})) {
Expand Down Expand Up @@ -1138,7 +1138,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
}
if (auto *super_tr = reflection_ctx->LookupSuperclass(
*tr, ts.GetDescriptorFinder())) {
auto get_name = []() { return "<base class>"; };
auto get_name = []() -> std::string { return "<base class>"; };
auto get_info = []() -> llvm::Expected<ChildInfo> {
return ChildInfo();
};
Expand Down Expand Up @@ -1252,7 +1252,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
// base class gets injected. Its parent will be a nested
// field in the base class.
if (!type_ref) {
auto get_name = [&]() { return "<base class>"; };
auto get_name = [&]() -> std::string { return "<base class>"; };
auto get_info = [&]() -> llvm::Expected<ChildInfo> {
return ChildInfo();
};
Expand All @@ -1264,7 +1264,7 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
}

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

auto visit_element = [&](unsigned idx) {
auto get_name = [&]() {
auto visit_element = [&](unsigned idx) -> llvm::Error {
auto get_name = [&]() -> std::string {
std::string child_name;
llvm::raw_string_ostream(child_name) << idx;
return child_name;
Expand Down Expand Up @@ -1394,8 +1394,8 @@ SwiftRuntimeTypeVisitor::VisitImpl(std::optional<unsigned> visit_only,
if (count_only)
return 0;
if (auto err = visit_callback(
CompilerType(), 0, []() { return ""; },
[]() { return ChildInfo(); }))
CompilerType(), 0, []() -> std::string { return ""; },
[]() -> llvm::Expected<ChildInfo> { return ChildInfo(); }))
return err;
return success;
}
Expand Down