Skip to content

Commit a614c34

Browse files
[lldb][swift] Handle NoEscapeFunctionType in async demangling
These are another variant of "FunctionType".
1 parent 59cb28d commit a614c34

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static bool IsSwiftAsyncFunctionSymbol(swift::Demangle::NodePointer node) {
102102
static const llvm::SmallVector<llvm::SmallVector<Kind>>
103103
async_annotation_paths = {
104104
{Kind::Type, Kind::FunctionType, Kind::AsyncAnnotation},
105+
{Kind::Type, Kind::NoEscapeFunctionType, Kind::AsyncAnnotation},
105106
{Kind::Type, Kind::DependentGenericType, Kind::Type,
106107
Kind::FunctionType, Kind::AsyncAnnotation},
107108
};

lldb/unittests/Symbol/TestSwiftDemangler.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ TEST(TestSwiftDemangleAsyncNames, BasicAsync) {
119119
// async let x = await async_int();
120120
// print(await x);
121121
// await closure(10)
122+
// async let explicit_inside_implicit_closure =
123+
// { _ in
124+
// print("hello")
125+
// await work()
126+
// print("hello")
127+
// return 42
128+
// }(10)
129+
// print(await explicit_inside_implicit_closure)
122130
// }
123131
TEST(TestSwiftDemangleAsyncNames, ClosureAsync) {
124132
// These are all async closures
@@ -160,6 +168,12 @@ TEST(TestSwiftDemangleAsyncNames, ClosureAsync) {
160168
"$s1a8sayHelloyyYaFyypYacfU_SiyYaYbcfu_TQ0_",
161169
"$s1a8sayHelloyyYaFyypYacfU_SiyYaYbcfu_TY1_",
162170
};
171+
SmallVector<StringRef> explicit_closure_inside_implicit_closure = {
172+
"$s1a8sayHelloyyYaFSiyYaYbcfu0_S2iYaXEfU0_",
173+
"$s1a8sayHelloyyYaFSiyYaYbcfu0_S2iYaXEfU0_TY0_",
174+
"$s1a8sayHelloyyYaFSiyYaYbcfu0_S2iYaXEfU0_TQ1_",
175+
"$s1a8sayHelloyyYaFSiyYaYbcfu0_S2iYaXEfU0_TY2_",
176+
};
163177

164178
SmallVector<ArrayRef<StringRef>, 0> funclet_groups = {
165179
nested1_funclets,
@@ -168,6 +182,7 @@ TEST(TestSwiftDemangleAsyncNames, ClosureAsync) {
168182
nested2_funclets_top_not_async,
169183
implicit_closure_inside_function,
170184
implicit_closure_inside_explicit_closure,
185+
explicit_closure_inside_implicit_closure,
171186
};
172187

173188
for (ArrayRef<StringRef> funclet_group : funclet_groups)

0 commit comments

Comments
 (0)