2424#include " lldb/Utility/Log.h"
2525#include " swift/ABI/Task.h"
2626#include " swift/Demangling/Demangle.h"
27+ #include " swift/Demangling/Demangler.h"
2728
2829#include " Plugins/Process/Utility/RegisterContext_x86.h"
2930#include " Utility/ARM64_DWARF_Registers.h"
@@ -105,8 +106,10 @@ static bool IsSwiftAsyncFunctionSymbol(swift::Demangle::NodePointer node) {
105106
106107// / Returns true if closure1 and closure2 have the same number, type, and
107108// / 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;
110113 NodePointer closure1_number = childAtPath (closure1, Node::Kind::Number);
111114 NodePointer closure2_number = childAtPath (closure2, Node::Kind::Number);
112115 if (!Node::deepEquals (closure1_number, closure2_number))
@@ -134,8 +137,8 @@ static bool AreFuncletsOfSameAsyncClosure(NodePointer closure1,
134137}
135138
136139SwiftLanguageRuntime::FuncletComparisonResult
137- SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction (StringRef name1,
138- StringRef name2) {
140+ SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction (llvm:: StringRef name1,
141+ llvm:: StringRef name2) {
139142 using namespace swift ::Demangle;
140143 Context ctx;
141144 NodePointer node1 = DemangleSymbolAsNode (name1, ctx);
@@ -174,7 +177,7 @@ SwiftLanguageRuntime::AreFuncletsOfSameAsyncFunction(StringRef name1,
174177 : FuncletComparisonResult::DifferentAsyncFunctions;
175178}
176179
177- bool SwiftLanguageRuntime::IsSwiftAsyncFunctionSymbol (StringRef name) {
180+ bool SwiftLanguageRuntime::IsSwiftAsyncFunctionSymbol (llvm:: StringRef name) {
178181 if (!IsSwiftMangledName (name))
179182 return false ;
180183 using namespace swift ::Demangle;
@@ -184,7 +187,7 @@ bool SwiftLanguageRuntime::IsSwiftAsyncFunctionSymbol(StringRef name) {
184187}
185188
186189bool SwiftLanguageRuntime::IsSwiftAsyncAwaitResumePartialFunctionSymbol (
187- StringRef name) {
190+ llvm:: StringRef name) {
188191 if (!IsSwiftMangledName (name))
189192 return false ;
190193 using namespace swift ::Demangle;
@@ -193,7 +196,7 @@ bool SwiftLanguageRuntime::IsSwiftAsyncAwaitResumePartialFunctionSymbol(
193196 return hasChild (node, Node::Kind::AsyncAwaitResumePartialFunction);
194197}
195198
196- bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (StringRef name) {
199+ bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (llvm:: StringRef name) {
197200 if (!IsSwiftMangledName (name))
198201 return false ;
199202 using namespace swift ::Demangle;
@@ -202,7 +205,9 @@ bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol(StringRef name) {
202205 return IsAnySwiftAsyncFunctionSymbol (node);
203206}
204207
205- bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (NodePointer node) {
208+ bool SwiftLanguageRuntime::IsAnySwiftAsyncFunctionSymbol (
209+ swift::Demangle::NodePointer node) {
210+ using namespace swift ::Demangle;
206211 if (!node || node->getKind () != Node::Kind::Global || !node->getNumChildren ())
207212 return false ;
208213 auto marker = node->getFirstChild ()->getKind ();
@@ -322,7 +327,7 @@ CreateRunThroughTaskSwitchThreadPlan(Thread &thread,
322327// / a task switch, like `async_task_switch` or `swift_asyncLet_get`.
323328static ThreadPlanSP
324329CreateRunThroughTaskSwitchingTrampolines (Thread &thread,
325- StringRef trampoline_name) {
330+ llvm:: StringRef trampoline_name) {
326331 // The signature for `swift_task_switch` is as follows:
327332 // SWIFT_CC(swiftasync)
328333 // void swift_task_switch(
@@ -434,7 +439,7 @@ static lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
434439 // of the function this protocol thunk is preparing to call, then
435440 // step into through the thunk, stopping if I end up in a frame
436441 // with that function name.
437- Context ctx;
442+ swift::Demangle:: Context ctx;
438443 auto *demangled_nodes =
439444 SwiftLanguageRuntime::DemangleSymbolAsNode (symbol_name, ctx);
440445
@@ -554,7 +559,8 @@ bool SwiftLanguageRuntime::IsSwiftMangledName(llvm::StringRef name) {
554559void SwiftLanguageRuntime::GetGenericParameterNamesForFunction (
555560 const SymbolContext &const_sc, const ExecutionContext *exe_ctx,
556561 swift::Mangle::ManglingFlavor flavor,
557- llvm::DenseMap<SwiftLanguageRuntime::ArchetypePath, StringRef> &dict) {
562+ llvm::DenseMap<SwiftLanguageRuntime::ArchetypePath, llvm::StringRef>
563+ &dict) {
558564 // This terrifying cast avoids having too many differences with llvm.org.
559565 SymbolContext &sc = const_cast <SymbolContext &>(const_sc);
560566
@@ -575,7 +581,7 @@ void SwiftLanguageRuntime::GetGenericParameterNamesForFunction(
575581
576582 for (unsigned i = 0 ; i < var_list->GetSize (); ++i) {
577583 VariableSP var_sp = var_list->GetVariableAtIndex (i);
578- StringRef name = var_sp->GetName ().GetStringRef ();
584+ llvm:: StringRef name = var_sp->GetName ().GetStringRef ();
579585 if (!name.consume_front (g_dollar_tau_underscore))
580586 continue ;
581587
@@ -633,10 +639,10 @@ void SwiftLanguageRuntime::GetGenericParameterNamesForFunction(
633639}
634640
635641std::string SwiftLanguageRuntime::DemangleSymbolAsString (
636- StringRef symbol, DemangleMode mode, const SymbolContext *sc,
642+ llvm:: StringRef symbol, DemangleMode mode, const SymbolContext *sc,
637643 const ExecutionContext *exe_ctx) {
638644 bool did_init = false ;
639- llvm::DenseMap<ArchetypePath, StringRef> dict;
645+ llvm::DenseMap<ArchetypePath, llvm:: StringRef> dict;
640646 swift::Demangle::DemangleOptions options;
641647 switch (mode) {
642648 case eSimplified:
@@ -904,7 +910,7 @@ bool SwiftLanguageRuntime::MethodName::ExtractFunctionBasenameFromMangled(
904910 // have to demangle the whole name to figure this out anyway.
905911 // I'm leaving the test here in case we actually need to do this
906912 // only to functions.
907- Context ctx;
913+ swift::Demangle:: Context ctx;
908914 auto *node = SwiftLanguageRuntime::DemangleSymbolAsNode (mangled_ref, ctx);
909915 StreamString identifier;
910916 if (node) {
@@ -1135,14 +1141,14 @@ SwiftLanguageRuntime::GetStepThroughTrampolinePlan(Thread &thread,
11351141}
11361142
11371143std::optional<SwiftLanguageRuntime::GenericSignature>
1138- SwiftLanguageRuntime::GetGenericSignature (StringRef function_name,
1144+ SwiftLanguageRuntime::GetGenericSignature (llvm:: StringRef function_name,
11391145 TypeSystemSwiftTypeRef &ts) {
11401146 GenericSignature signature;
11411147 unsigned num_generic_params = 0 ;
11421148
11431149 auto flavor = SwiftLanguageRuntime::GetManglingFlavor (function_name);
11441150 // Walk to the function type.
1145- Context ctx;
1151+ swift::Demangle:: Context ctx;
11461152 auto *node = SwiftLanguageRuntime::DemangleSymbolAsNode (function_name, ctx);
11471153 if (!node)
11481154 return {};
0 commit comments