Skip to content

Add a TypeSystemSwiftTypeRef::GetTupleElementName() method. #2049

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
Oct 27, 2020

Conversation

adrian-prantl
Copy link

No description provided.

@adrian-prantl
Copy link
Author

@swift-ci test

Copy link

@kastiglione kastiglione left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where will this be used?

return name->getText().str();
}
std::string name;
llvm::raw_string_ostream(name) << idx;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the use case for returning the index if it has no name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is needed by TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex().
The implicit name of an unnamed tuple element is 0:, 1:, ... . See https://github.com/apple/llvm-project/blob/46170cc2f5a9af3db7652ef119ecee0dbc78392d/lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp#L7018

@@ -258,6 +258,10 @@ class TypeSystemSwiftTypeRef : public TypeSystemSwift {
bool print_help_if_available, bool print_extensions_if_available,
lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) override;

/// Return the nth tuple element's name, if it has one.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Return the nth tuple element's name, if it has one.
/// Return the nth tuple element's name, or its index as a string if it has no name.

@adrian-prantl adrian-prantl merged commit c7692c0 into swiftlang:swift/main Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants