24
24
#include " lldb/Utility/Log.h"
25
25
#include " swift/ABI/Task.h"
26
26
#include " swift/Demangling/Demangle.h"
27
+ #include " swift/Demangling/Demangler.h"
27
28
28
29
#include " Plugins/Process/Utility/RegisterContext_x86.h"
29
30
#include " Utility/ARM64_DWARF_Registers.h"
@@ -105,8 +106,10 @@ static bool IsSwiftAsyncFunctionSymbol(swift::Demangle::NodePointer node) {
105
106
106
107
// / Returns true if closure1 and closure2 have the same number, type, and
107
108
// / parent closures / function.
108
- static bool AreFuncletsOfSameAsyncClosure (NodePointer closure1,
109
- NodePointer closure2) {
109
+ static bool
110
+ AreFuncletsOfSameAsyncClosure (swift::Demangle::NodePointer closure1,
111
+ swift::Demangle::NodePointer closure2) {
112
+ using namespace swift ::Demangle;
110
113
NodePointer closure1_number = childAtPath (closure1, Node::Kind::Number);
111
114
NodePointer closure2_number = childAtPath (closure2, Node::Kind::Number);
112
115
if (!Node::deepEquals (closure1_number, closure2_number))
@@ -134,8 +137,8 @@ static bool AreFuncletsOfSameAsyncClosure(NodePointer closure1,
134
137
}
135
138
136
139
SwiftLanguageRuntime::FuncletComparisonResult
137
- SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction (StringRef name1,
138
- StringRef name2) {
140
+ SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction (llvm:: StringRef name1,
141
+ llvm:: StringRef name2) {
139
142
using namespace swift ::Demangle;
140
143
Context ctx;
141
144
NodePointer node1 = DemangleSymbolAsNode (name1, ctx);
@@ -174,7 +177,7 @@ SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(StringRef name1,
174
177
: FuncletComparisonResult::DifferentAsyncFunctions;
175
178
}
176
179
177
- bool SwiftLanguageRuntime::IsSwiftAsyncFunctionSymbol (StringRef name) {
180
+ bool SwiftLanguageRuntime::IsSwiftAsyncFunctionSymbol (llvm:: StringRef name) {
178
181
if (!IsSwiftMangledName (name))
179
182
return false ;
180
183
using namespace swift ::Demangle;
@@ -184,7 +187,7 @@ bool SwiftLanguageRuntime::IsSwiftAsyncFunctionSymbol(StringRef name) {
184
187
}
185
188
186
189
bool SwiftLanguageRuntime::IsSwiftAsyncAwaitResumePartialFunctionSymbol (
187
- StringRef name) {
190
+ llvm:: StringRef name) {
188
191
if (!IsSwiftMangledName (name))
189
192
return false ;
190
193
using namespace swift ::Demangle;
@@ -193,7 +196,7 @@ bool SwiftLanguageRuntime::IsSwiftAsyncAwaitResumePartialFunctionSymbol(
193
196
return hasChild (node, Node::Kind::AsyncAwaitResumePartialFunction);
194
197
}
195
198
196
- bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (StringRef name) {
199
+ bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (llvm:: StringRef name) {
197
200
if (!IsSwiftMangledName (name))
198
201
return false ;
199
202
using namespace swift ::Demangle;
@@ -202,7 +205,9 @@ bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol(StringRef name) {
202
205
return IsAnySwiftAsyncFunctionSymbol (node);
203
206
}
204
207
205
- bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (NodePointer node) {
208
+ bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (
209
+ swift::Demangle::NodePointer node) {
210
+ using namespace swift ::Demangle;
206
211
if (!node || node->getKind () != Node::Kind::Global || !node->getNumChildren ())
207
212
return false ;
208
213
auto marker = node->getFirstChild ()->getKind ();
@@ -322,7 +327,7 @@ CreateRunThroughTaskSwitchThreadPlan(Thread &thread,
322
327
// / a task switch, like `async_task_switch` or `swift_asyncLet_get`.
323
328
static ThreadPlanSP
324
329
CreateRunThroughTaskSwitchingTrampolines (Thread &thread,
325
- StringRef trampoline_name) {
330
+ llvm:: StringRef trampoline_name) {
326
331
// The signature for `swift_task_switch` is as follows:
327
332
// SWIFT_CC(swiftasync)
328
333
// void swift_task_switch(
@@ -434,7 +439,7 @@ static lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
434
439
// of the function this protocol thunk is preparing to call, then
435
440
// step into through the thunk, stopping if I end up in a frame
436
441
// with that function name.
437
- Context ctx;
442
+ swift::Demangle:: Context ctx;
438
443
auto *demangled_nodes =
439
444
SwiftLanguageRuntime::DemangleSymbolAsNode (symbol_name, ctx);
440
445
@@ -554,7 +559,8 @@ bool SwiftLanguageRuntime::IsSwiftMangledName(llvm::StringRef name) {
554
559
void SwiftLanguageRuntime::GetGenericParameterNamesForFunction (
555
560
const SymbolContext &const_sc, const ExecutionContext *exe_ctx,
556
561
swift::Mangle::ManglingFlavor flavor,
557
- llvm::DenseMap<SwiftLanguageRuntime::ArchetypePath, StringRef> &dict) {
562
+ llvm::DenseMap<SwiftLanguageRuntime::ArchetypePath, llvm::StringRef>
563
+ &dict) {
558
564
// This terrifying cast avoids having too many differences with llvm.org.
559
565
SymbolContext &sc = const_cast <SymbolContext &>(const_sc);
560
566
@@ -575,7 +581,7 @@ void SwiftLanguageRuntime::GetGenericParameterNamesForFunction(
575
581
576
582
for (unsigned i = 0 ; i < var_list->GetSize (); ++i) {
577
583
VariableSP var_sp = var_list->GetVariableAtIndex (i);
578
- StringRef name = var_sp->GetName ().GetStringRef ();
584
+ llvm:: StringRef name = var_sp->GetName ().GetStringRef ();
579
585
if (!name.consume_front (g_dollar_tau_underscore))
580
586
continue ;
581
587
@@ -633,10 +639,10 @@ void SwiftLanguageRuntime::GetGenericParameterNamesForFunction(
633
639
}
634
640
635
641
std::string SwiftLanguageRuntime::DemangleSymbolAsString (
636
- StringRef symbol, DemangleMode mode, const SymbolContext *sc,
642
+ llvm:: StringRef symbol, DemangleMode mode, const SymbolContext *sc,
637
643
const ExecutionContext *exe_ctx) {
638
644
bool did_init = false ;
639
- llvm::DenseMap<ArchetypePath, StringRef> dict;
645
+ llvm::DenseMap<ArchetypePath, llvm:: StringRef> dict;
640
646
swift::Demangle::DemangleOptions options;
641
647
switch (mode) {
642
648
case eSimplified:
@@ -904,7 +910,7 @@ bool SwiftLanguageRuntime::MethodName::ExtractFunctionBasenameFromMangled(
904
910
// have to demangle the whole name to figure this out anyway.
905
911
// I'm leaving the test here in case we actually need to do this
906
912
// only to functions.
907
- Context ctx;
913
+ swift::Demangle:: Context ctx;
908
914
auto *node = SwiftLanguageRuntime::DemangleSymbolAsNode (mangled_ref, ctx);
909
915
StreamString identifier;
910
916
if (node) {
@@ -1135,14 +1141,14 @@ SwiftLanguageRuntime::GetStepThroughTrampolinePlan(Thread &thread,
1135
1141
}
1136
1142
1137
1143
std::optional<SwiftLanguageRuntime::GenericSignature>
1138
- SwiftLanguageRuntime::GetGenericSignature (StringRef function_name,
1144
+ SwiftLanguageRuntime::GetGenericSignature (llvm:: StringRef function_name,
1139
1145
TypeSystemSwiftTypeRef &ts) {
1140
1146
GenericSignature signature;
1141
1147
unsigned num_generic_params = 0 ;
1142
1148
1143
1149
auto flavor = SwiftLanguageRuntime::GetManglingFlavor (function_name);
1144
1150
// Walk to the function type.
1145
- Context ctx;
1151
+ swift::Demangle:: Context ctx;
1146
1152
auto *node = SwiftLanguageRuntime::DemangleSymbolAsNode (function_name, ctx);
1147
1153
if (!node)
1148
1154
return {};
0 commit comments