Skip to content

[lldb][swift][nfc] Add new overload for AreFuncletsOfSameAsyncFunction #10246

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
Show file tree
Hide file tree
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 @@ -165,6 +165,11 @@ class SwiftLanguageRuntime : public LanguageRuntime {
static FuncletComparisonResult
AreFuncletsOfSameAsyncFunction(llvm::StringRef name1, llvm::StringRef name2);

/// See AreFuncletsOfSameAsyncFunction(StringRef, StringRef).
static FuncletComparisonResult
AreFuncletsOfSameAsyncFunction(swift::Demangle::NodePointer node1,
swift::Demangle::NodePointer node2);

Choose a reason for hiding this comment

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

This may also fit in TypeSystem/Swift/SwiftDemangle.h

Copy link
Author

Choose a reason for hiding this comment

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

I'll need to look at all of these Are<something>Async<something> functions and figure out where they should go

/// Return true if name is a Swift async function symbol.
static bool IsSwiftAsyncFunctionSymbol(llvm::StringRef name);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(llvm::StringRef name1,
Context ctx;
NodePointer node1 = DemangleSymbolAsNode(name1, ctx);
NodePointer node2 = DemangleSymbolAsNode(name2, ctx);
return AreFuncletsOfSameAsyncFunction(node1, node2);
}

SwiftLanguageRuntime::FuncletComparisonResult
SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(
swift::Demangle::NodePointer node1, swift::Demangle::NodePointer node2) {
if (!IsAnySwiftAsyncFunctionSymbol(node1) ||
!IsAnySwiftAsyncFunctionSymbol(node2))
return FuncletComparisonResult::NotBothFunclets;
Expand Down
7 changes: 5 additions & 2 deletions lldb/unittests/Symbol/TestSwiftDemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ static constexpr auto IsSwiftMangledName =
static constexpr auto IsAnySwiftAsyncFunctionSymbol = [](StringRef name) {
return SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol(name);
};
static constexpr auto AreFuncletsOfSameAsyncFunction = [](StringRef name1,
StringRef name2) {
return SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(name1, name2);
};


using FuncletComparisonResult = SwiftLanguageRuntime::FuncletComparisonResult;
static constexpr auto AreFuncletsOfSameAsyncFunction =
SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction;

/// Checks that all names in \c funclets belong to the same function.
static void CheckGroupOfFuncletsFromSameFunction(ArrayRef<StringRef> funclets) {
Expand Down