Skip to content

Commit 9fbfe66

Browse files
committed
Rename GetLanguageInfo to GetLanguageSpecificData (llvm#117012)
Unbeknownst to me the Swift LLDB branch already had an almost identical API with this name, so it makes sense to merge the two. (cherry picked from commit 8f8dced) (cherry picked from commit 0ed103b)
1 parent 82dffd2 commit 9fbfe66

File tree

9 files changed

+13
-25
lines changed

9 files changed

+13
-25
lines changed

lldb/include/lldb/API/SBFrame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class LLDB_API SBFrame {
130130
/// Language plugins can use this API to report language-specific
131131
/// runtime information about this compile unit, such as additional
132132
/// language version details or feature flags.
133-
SBStructuredData GetLanguageInfo();
133+
SBStructuredData GetLanguageSpecificData();
134134

135135
/// Gets the lexical block that defines the stack frame. Another way to think
136136
/// of this is it will return the block that contains all of the variables

lldb/include/lldb/Target/LanguageRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class LanguageRuntime : public Runtime, public PluginInterface {
288288
/// Language runtime plugins can use this API to report
289289
/// language-specific runtime information about this compile unit,
290290
/// such as additional language version details or feature flags.
291-
virtual StructuredData::ObjectSP GetLanguageInfo(SymbolContext sc);
291+
virtual StructuredData::ObjectSP GetLanguageSpecificData(SymbolContext sc);
292292

293293
protected:
294294
// The static GetRuntimeUnwindPlan method above is only implemented in the

lldb/include/lldb/Target/StackFrame.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ class StackFrame : public ExecutionContextScope,
416416
/// Language plugins can use this API to report language-specific
417417
/// runtime information about this compile unit, such as additional
418418
/// language version details or feature flags.
419-
StructuredData::ObjectSP GetLanguageInfo();
419+
StructuredData::ObjectSP GetLanguageSpecificData();
420420

421421
/// Get the frame's demangled name.
422422
///

lldb/source/API/SBFrame.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
11631163
return expr_result;
11641164
}
11651165

1166-
SBStructuredData SBFrame::GetLanguageInfo() {
1166+
SBStructuredData SBFrame::GetLanguageSpecificData() {
11671167
LLDB_INSTRUMENT_VA(this);
11681168

11691169
SBStructuredData sb_data;
@@ -1173,7 +1173,7 @@ SBStructuredData SBFrame::GetLanguageInfo() {
11731173
if (!frame)
11741174
return sb_data;
11751175

1176-
StructuredData::ObjectSP data(frame->GetLanguageInfo());
1176+
StructuredData::ObjectSP data(frame->GetLanguageSpecificData());
11771177
sb_data.m_impl_up->SetObjectSP(data);
11781178
return sb_data;
11791179
}
@@ -1261,20 +1261,6 @@ lldb::LanguageType SBFrame::GuessLanguage() const {
12611261
return eLanguageTypeUnknown;
12621262
}
12631263

1264-
lldb::SBStructuredData SBFrame::GetLanguageSpecificData() const {
1265-
std::unique_lock<std::recursive_mutex> lock;
1266-
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
1267-
auto *process = exe_ctx.GetProcessPtr();
1268-
auto *frame = exe_ctx.GetFramePtr();
1269-
if (process && frame)
1270-
if (auto *runtime = process->GetLanguageRuntime(
1271-
frame->GuessLanguage().AsLanguageType()))
1272-
if (auto *data = runtime->GetLanguageSpecificData(*frame))
1273-
return SBStructuredData(*data);
1274-
1275-
return {};
1276-
}
1277-
12781264
// BEGIN SWIFT
12791265
bool SBFrame::IsSwiftThunk() const {
12801266
std::unique_lock<std::recursive_mutex> lock;

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3411,7 +3411,8 @@ std::optional<uint64_t> AppleObjCRuntimeV2::GetSharedCacheImageHeaderVersion() {
34113411
return std::nullopt;
34123412
}
34133413

3414-
StructuredData::ObjectSP AppleObjCRuntimeV2::GetLanguageInfo(SymbolContext sc) {
3414+
StructuredData::ObjectSP
3415+
AppleObjCRuntimeV2::GetLanguageSpecificData(SymbolContext sc) {
34153416
auto dict_up = std::make_unique<StructuredData::Dictionary>();
34163417
dict_up->AddItem("Objective-C runtime version",
34173418
std::make_unique<StructuredData::UnsignedInteger>(2));

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime {
106106

107107
std::optional<uint64_t> GetSharedCacheImageHeaderVersion();
108108

109-
StructuredData::ObjectSP GetLanguageInfo(SymbolContext sc) override;
109+
StructuredData::ObjectSP GetLanguageSpecificData(SymbolContext sc) override;
110110

111111
protected:
112112
lldb::BreakpointResolverSP

lldb/source/Target/LanguageRuntime.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ LanguageRuntime::GetRuntimeUnwindPlan(Thread &thread, RegisterContext *regctx,
277277
return UnwindPlanSP();
278278
}
279279

280-
StructuredData::ObjectSP LanguageRuntime::GetLanguageInfo(SymbolContext sc) {
280+
StructuredData::ObjectSP
281+
LanguageRuntime::GetLanguageSpecificData(SymbolContext sc) {
281282
return {};
282283
}
283284

lldb/source/Target/StackFrame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,14 +1255,14 @@ bool StackFrame::IsSwiftThunk() {
12551255
return runtime->IsSymbolARuntimeThunk(*sc.symbol);
12561256
}
12571257

1258-
StructuredData::ObjectSP StackFrame::GetLanguageInfo() {
1258+
StructuredData::ObjectSP StackFrame::GetLanguageSpecificData() {
12591259
auto process_sp = CalculateProcess();
12601260
SourceLanguage language = GetLanguage();
12611261
if (!language)
12621262
return {};
12631263
if (auto runtime_sp =
12641264
process_sp->GetLanguageRuntime(language.AsLanguageType()))
1265-
return runtime_sp->GetLanguageInfo(
1265+
return runtime_sp->GetLanguageSpecificData(
12661266
GetSymbolContext(eSymbolContextFunction));
12671267
return {};
12681268
}

lldb/test/API/lang/objc/languageinfo/TestObjCLanguageInfo.py renamed to lldb/test/API/lang/objc/languageinfo/TestObjCLanguageSpecificData.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ def test_imp_ivar_type(self):
1111
self.build()
1212
target, process, thread, bkpt = lldbutil.run_to_name_breakpoint(self, "main")
1313
frame = thread.GetFrameAtIndex(0)
14-
lang_info = frame.GetLanguageInfo()
14+
lang_info = frame.GetLanguageSpecificData()
1515
version = lang_info.GetValueForKey("Objective-C runtime version")
1616
self.assertEqual(version.GetIntegerValue(), 2)

0 commit comments

Comments
 (0)