[Lldb-commits] [lldb] Rename GetLanguageInfo to GetLanguageSpecificData (PR #117012)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 20 09:15:49 PST 2024


https://github.com/adrian-prantl created https://github.com/llvm/llvm-project/pull/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.

>From 92408ce615fe9abdfa69f0e6309a39d9f87a764a Mon Sep 17 00:00:00 2001
From: Adrian Prantl <aprantl at apple.com>
Date: Wed, 20 Nov 2024 09:14:09 -0800
Subject: [PATCH] Rename GetLanguageInfo to GetLanguageSpecificData

Unbeknownst to me the Swift LLDB branch already had an almost
identical API with this name, so it makes sense to merge the two.
---
 lldb/include/lldb/API/SBFrame.h                               | 2 +-
 lldb/include/lldb/Target/LanguageRuntime.h                    | 2 +-
 lldb/include/lldb/Target/StackFrame.h                         | 2 +-
 lldb/source/API/SBFrame.cpp                                   | 4 ++--
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp              | 3 ++-
 .../ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h                | 2 +-
 lldb/source/Target/LanguageRuntime.cpp                        | 3 ++-
 lldb/source/Target/StackFrame.cpp                             | 4 ++--
 ...estObjCLanguageInfo.py => TestObjCLanguageSpecificData.py} | 2 +-
 9 files changed, 13 insertions(+), 11 deletions(-)
 rename lldb/test/API/lang/objc/languageinfo/{TestObjCLanguageInfo.py => TestObjCLanguageSpecificData.py} (90%)

diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h
index e1ff217767cb98..629d4e5bc61f46 100644
--- a/lldb/include/lldb/API/SBFrame.h
+++ b/lldb/include/lldb/API/SBFrame.h
@@ -125,7 +125,7 @@ class LLDB_API SBFrame {
   /// Language plugins can use this API to report language-specific
   /// runtime information about this compile unit, such as additional
   /// language version details or feature flags.
-  SBStructuredData GetLanguageInfo();
+  SBStructuredData GetLanguageSpecificData();
 
   /// Gets the lexical block that defines the stack frame. Another way to think
   /// of this is it will return the block that contains all of the variables
diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h
index 4f4d426eaa1dab..4a0214b04e235e 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -244,7 +244,7 @@ class LanguageRuntime : public Runtime, public PluginInterface {
   /// Language runtime plugins can use this API to report
   /// language-specific runtime information about this compile unit,
   /// such as additional language version details or feature flags.
-  virtual StructuredData::ObjectSP GetLanguageInfo(SymbolContext sc);
+  virtual StructuredData::ObjectSP GetLanguageSpecificData(SymbolContext sc);
 
 protected:
   // The static GetRuntimeUnwindPlan method above is only implemented in the
diff --git a/lldb/include/lldb/Target/StackFrame.h b/lldb/include/lldb/Target/StackFrame.h
index 5e82657706339c..3f51c9a7f22f09 100644
--- a/lldb/include/lldb/Target/StackFrame.h
+++ b/lldb/include/lldb/Target/StackFrame.h
@@ -412,7 +412,7 @@ class StackFrame : public ExecutionContextScope,
   /// Language plugins can use this API to report language-specific
   /// runtime information about this compile unit, such as additional
   /// language version details or feature flags.
-  StructuredData::ObjectSP GetLanguageInfo();
+  StructuredData::ObjectSP GetLanguageSpecificData();
 
   /// Get the frame's demangled name.
   ///
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index d17bb5cc146086..5c735dd35e1cf3 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -1155,7 +1155,7 @@ lldb::SBValue SBFrame::EvaluateExpression(const char *expr,
   return expr_result;
 }
 
-SBStructuredData SBFrame::GetLanguageInfo() {
+SBStructuredData SBFrame::GetLanguageSpecificData() {
   LLDB_INSTRUMENT_VA(this);
 
   SBStructuredData sb_data;
@@ -1165,7 +1165,7 @@ SBStructuredData SBFrame::GetLanguageInfo() {
   if (!frame)
     return sb_data;
 
-  StructuredData::ObjectSP data(frame->GetLanguageInfo());
+  StructuredData::ObjectSP data(frame->GetLanguageSpecificData());
   sb_data.m_impl_up->SetObjectSP(data);
   return sb_data;
 }
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 7298ab0e7336bf..0083b499656979 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -3398,7 +3398,8 @@ std::optional<uint64_t> AppleObjCRuntimeV2::GetSharedCacheImageHeaderVersion() {
   return std::nullopt;
 }
 
-StructuredData::ObjectSP AppleObjCRuntimeV2::GetLanguageInfo(SymbolContext sc) {
+StructuredData::ObjectSP
+AppleObjCRuntimeV2::GetLanguageSpecificData(SymbolContext sc) {
   auto dict_up = std::make_unique<StructuredData::Dictionary>();
   dict_up->AddItem("Objective-C runtime version",
                    std::make_unique<StructuredData::UnsignedInteger>(2));
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
index 7117b778a1c0e9..2422539b13f13d 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
@@ -106,7 +106,7 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime {
 
   std::optional<uint64_t> GetSharedCacheImageHeaderVersion();
 
-  StructuredData::ObjectSP GetLanguageInfo(SymbolContext sc) override;
+  StructuredData::ObjectSP GetLanguageSpecificData(SymbolContext sc) override;
 
 protected:
   lldb::BreakpointResolverSP
diff --git a/lldb/source/Target/LanguageRuntime.cpp b/lldb/source/Target/LanguageRuntime.cpp
index 89bad75995ff14..269d1e017fdf24 100644
--- a/lldb/source/Target/LanguageRuntime.cpp
+++ b/lldb/source/Target/LanguageRuntime.cpp
@@ -277,7 +277,8 @@ LanguageRuntime::GetRuntimeUnwindPlan(Thread &thread, RegisterContext *regctx,
   return UnwindPlanSP();
 }
 
-StructuredData::ObjectSP LanguageRuntime::GetLanguageInfo(SymbolContext sc) {
+StructuredData::ObjectSP
+LanguageRuntime::GetLanguageSpecificData(SymbolContext sc) {
   return {};
 }
 
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index e7d3b883bdec56..dfbac5a572d00a 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -1231,14 +1231,14 @@ bool StackFrame::IsHidden() {
   return false;
 }
 
-StructuredData::ObjectSP StackFrame::GetLanguageInfo() {
+StructuredData::ObjectSP StackFrame::GetLanguageSpecificData() {
   auto process_sp = CalculateProcess();
   SourceLanguage language = GetLanguage();
   if (!language)
     return {};
   if (auto runtime_sp =
           process_sp->GetLanguageRuntime(language.AsLanguageType()))
-    return runtime_sp->GetLanguageInfo(
+    return runtime_sp->GetLanguageSpecificData(
         GetSymbolContext(eSymbolContextFunction));
   return {};
 }
diff --git a/lldb/test/API/lang/objc/languageinfo/TestObjCLanguageInfo.py b/lldb/test/API/lang/objc/languageinfo/TestObjCLanguageSpecificData.py
similarity index 90%
rename from lldb/test/API/lang/objc/languageinfo/TestObjCLanguageInfo.py
rename to lldb/test/API/lang/objc/languageinfo/TestObjCLanguageSpecificData.py
index 18e04c9e8bac50..5558abed929dac 100644
--- a/lldb/test/API/lang/objc/languageinfo/TestObjCLanguageInfo.py
+++ b/lldb/test/API/lang/objc/languageinfo/TestObjCLanguageSpecificData.py
@@ -11,6 +11,6 @@ def test_imp_ivar_type(self):
         self.build()
         target, process, thread, bkpt = lldbutil.run_to_name_breakpoint(self, "main")
         frame = thread.GetFrameAtIndex(0)
-        lang_info = frame.GetLanguageInfo()
+        lang_info = frame.GetLanguageSpecificData()
         version = lang_info.GetValueForKey("Objective-C runtime version")
         self.assertEqual(version.GetIntegerValue(), 2)



More information about the lldb-commits mailing list