Skip to content

[lldb] Implement check for potential Swift interop types in DWARF #8009

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

Conversation

augusto2112
Copy link

Add a cheaper pre-check for Swift/C++ interop types when parsing the type in DWARF.

Add a cheaper pre-check for Swift/C++ interop types when parsing the
type in DWARF.
@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

@adrian-prantl this is a potential solution to avoid completing the types when checking if they're Swift interop types. It does require iterating over the type's first level children when first parsing the type (before completing it).

bool DWARFASTParserClang::IsSwiftInteropType(const DWARFDIE &die) {
for (DWARFDIE die : die.children())
if (die.Tag() == llvm::dwarf::DW_TAG_member &&
llvm::StringRef(die.GetName()) == "__swift_mangled_name")

Choose a reason for hiding this comment

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

Regarding a conversation @felipepiovezan and I had offline about query APIs: I'm curious if this if (die.GetName() == string) also happens often enough to warrant a faster die.IsName(string) API.

Choose a reason for hiding this comment

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

Probably worth having a die.CompareName(other) method too, as it is always faster to compare it that way in the negative case.

Copy link

@Michael137 Michael137 left a comment

Choose a reason for hiding this comment

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

LGTM

@augusto2112 augusto2112 marked this pull request as ready for review January 25, 2024 19:18
@augusto2112 augusto2112 merged commit b889ab8 into swiftlang:stable/20230725 Jan 25, 2024
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.

4 participants