@@ -31,16 +31,6 @@ namespace lldb_private {
3131static const char *g_dollar_tau_underscore = u8" $\u03C4 _" ;
3232static const char *g_tau_underscore = g_dollar_tau_underscore + 1 ;
3333
34- static bool IsSymbolARuntimeThunk (const Symbol &symbol) {
35- llvm::StringRef symbol_name =
36- symbol.GetMangled ().GetMangledName ().GetStringRef ();
37- if (symbol_name.empty ())
38- return false ;
39-
40- swift::Demangle::Context demangle_ctx;
41- return demangle_ctx.isThunkSymbol (symbol_name);
42- }
43-
4434namespace {
4535
4636enum class ThunkKind {
@@ -61,7 +51,9 @@ enum class ThunkAction {
6151
6252} // namespace
6353
64- static ThunkKind GetThunkKind (llvm::StringRef symbol_name) {
54+ static ThunkKind GetThunkKind (Symbol *symbol) {
55+ auto symbol_name = symbol->GetMangled ().GetMangledName ().GetStringRef ();
56+
6557 swift::Demangle::Node::Kind kind;
6658 swift::Demangle::Context demangle_ctx;
6759 if (!demangle_ctx.isThunkSymbol (symbol_name))
@@ -161,10 +153,7 @@ static lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
161153 SymbolContext sc = stack_sp->GetSymbolContext (eSymbolContextEverything);
162154 Symbol *symbol = sc.symbol ;
163155
164- // Note, I don't really need to consult IsSymbolARuntimeThunk here,
165- // but it is fast to do and keeps this list and the one in
166- // IsSymbolARuntimeThunk in sync.
167- if (!symbol || !IsSymbolARuntimeThunk (*symbol))
156+ if (!symbol)
168157 return new_thread_plan_sp;
169158
170159 // Only do this if you are at the beginning of the thunk function:
@@ -176,10 +165,9 @@ static lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
176165 return new_thread_plan_sp;
177166
178167 Address target_address;
179- ConstString symbol_mangled_name = symbol->GetMangled ().GetMangledName ();
180- const char *symbol_name = symbol_mangled_name.AsCString ();
168+ const char *symbol_name = symbol->GetMangled ().GetMangledName ().AsCString ();
181169
182- ThunkKind thunk_kind = GetThunkKind (symbol_mangled_name. GetStringRef () );
170+ ThunkKind thunk_kind = GetThunkKind (symbol );
183171 ThunkAction thunk_action = GetThunkAction (thunk_kind);
184172
185173 switch (thunk_action) {
@@ -225,7 +213,7 @@ static lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
225213 // with that function name.
226214 swift::Demangle::Context demangle_ctx;
227215 swift::Demangle::NodePointer demangled_nodes =
228- demangle_ctx.demangleSymbolAsNode (symbol_mangled_name. GetStringRef () );
216+ demangle_ctx.demangleSymbolAsNode (symbol_name );
229217
230218 // Now find the ProtocolWitness node in the demangled result.
231219
0 commit comments