8000 [lldb][NFC] Update API of GetParentNameIfClosure · felipepiovezan/llvm-project@e066168 · GitHub
[go: up one dir, main page]

Skip to content

Commit e066168

Browse files
felipepiovezanadrian-prantl
authored andcommitted
[lldb][NFC] Update API of GetParentNameIfClosure
1 parent fc28763 commit e066168

File tree

6 files changed

+8
-11
lines changed

6 files changed

+8
-11
lines changed

lldb/include/lldb/Target/Language.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ class Language : public PluginInterface {
409409
/// returns the name of the parent function where the input closure was
410410
/// defined. Returns an empty string if there is no such parent, or if the
411411
/// query does not make sense for this language.
412-
virtual std::string
413-
GetParentNameIfClosure(llvm::StringRef mangled_name) const {
412+
virtual std::string GetParentNameIfClosure(Function &function) const {
414413
return "";
415414
}
416415

lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,9 +2167,8 @@ SwiftLanguage::AreEqualForFrameComparison(const SymbolContext &sc1,
21672167
llvm_unreachable("unhandled enumeration in AreEquivalentFunctions");
21682168
}
21692169

2170-
std::string
2171-
SwiftLanguage::GetParentNameIfClosure(llvm::StringRef mangled_name) const {
2172-
return SwiftLanguageRuntime::GetParentNameIfClosure(mangled_name);
2170+
std::string SwiftLanguage::GetParentNameIfClosure(Function &func) const {
2171+
return SwiftLanguageRuntime::GetParentNameIfClosure(func);
21732172
}
21742173

21752174
//------------------------------------------------------------------

lldb/source/Plugins/Language/Swift/SwiftLanguage.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ class SwiftLanguage : public Language {
113113
AreEqualForFrameComparison(const SymbolContext &sc1,
114114
const SymbolContext &sc2) const override;
115115

116-
std::string
117-
GetParentNameIfClosure(llvm::StringRef mangled_name) const override;
116+
std::string GetParentNameIfClosure(Function &func) const override;
118117
//------------------------------------------------------------------
119118
// Static Functions
120119
//------------------------------------------------------------------

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class SwiftLanguageRuntime : public LanguageRuntime {
205205
const SymbolContext *sc = nullptr,
206206
const ExecutionContext *exe_ctx = nullptr);
207207

208-
static std::string GetParentNameIfClosure(llvm::StringRef mangled_name);
208+
static std::string GetParentNameIfClosure(Function &func);
209209

210210
/// Demangle a symbol to a swift::Demangle node tree.
211211
///

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1499,9 +1499,10 @@ SwiftLanguageRuntime::GetGenericSignature(llvm::StringRef function_name,
14991499
return signature;
15001500
}
15011501

1502-
std::string SwiftLanguageRuntime::GetParentNameIfClosure(StringRef name) {
1502+
std::string SwiftLanguageRuntime::GetParentNameIfClosure(Function &func) {
15031503
using Kind = Node::Kind;
15041504
swift::Demangle::Context ctx;
1505+
ConstString name = func.GetMangled().GetMangledName();
15051506
auto *node = SwiftLanguageRuntime::DemangleSymbolAsNode(name, ctx);
15061507
if (!node || node->getKind() != Node::Kind::Global)
15071508
return "";

lldb/source/Target/Language.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,7 @@ GetParentFunctionsWhileClosure(const SymbolContext &sc,
601601

602602
parents.push_back(root);
603603
for (int idx = 0; idx < upper_limit; idx++) {
604-
ConstString mangled = root->GetMangled().GetMangledName();
605-
std::string parent = language.GetParentNameIfClosure(mangled);
604+
std::string parent = language.GetParentNameIfClosure(*root);
606605
if (parent.empty())
607606
break;
608607

0 commit comments

Comments
 (0)
0