Skip to content

Commit c60cb52

Browse files
[lldb][swift][nfc] Add new overload for AreFuncletsOfSameAsyncFunction
This takes demangling Nodes instead of strings, to allow libraries to more efficiently re-use demangling nodes.
1 parent 8181ec4 commit c60cb52

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,11 @@ class SwiftLanguageRuntime : public LanguageRuntime {
165165
static FuncletComparisonResult
166166
AreFuncletsOfSameAsyncFunction(llvm::StringRef name1, llvm::StringRef name2);
167167

168+
/// See AreFuncletsOfSameAsyncFunction(StringRef, StringRef).
169+
static FuncletComparisonResult
170+
AreFuncletsOfSameAsyncFunction(swift::Demangle::NodePointer node1,
171+
swift::Demangle::NodePointer node2);
172+
168173
/// Return true if name is a Swift async function symbol.
169174
static bool IsSwiftAsyncFunctionSymbol(llvm::StringRef name);
170175

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeNames.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,12 @@ SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(llvm::StringRef name1,
143143
Context ctx;
144144
NodePointer node1 = DemangleSymbolAsNode(name1, ctx);
145145
NodePointer node2 = DemangleSymbolAsNode(name2, ctx);
146+
return AreFuncletsOfSameAsyncFunction(node1, node2);
147+
}
146148

149+
SwiftLanguageRuntime::FuncletComparisonResult
150+
SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(
151+
swift::Demangle::NodePointer node1, swift::Demangle::NodePointer node2) {
147152
if (!IsAnySwiftAsyncFunctionSymbol(node1) ||
148153
!IsAnySwiftAsyncFunctionSymbol(node2))
149154
return FuncletComparisonResult::NotBothFunclets;

lldb/unittests/Symbol/TestSwiftDemangler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ static constexpr auto IsSwiftMangledName =
1010
static constexpr auto IsAnySwiftAsyncFunctionSymbol = [](StringRef name) {
1111
return SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol(name);
1212
};
13+
static constexpr auto AreFuncletsOfSameAsyncFunction = [](StringRef name1,
14+
StringRef name2) {
15+
return SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(name1, name2);
16+
};
17+
1318

1419
using FuncletComparisonResult = SwiftLanguageRuntime::FuncletComparisonResult;
15-
static constexpr auto AreFuncletsOfSameAsyncFunction =
16-
SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction;
1720

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

0 commit comments

Comments
 (0)