[Lldb-commits] [PATCH] D152837: [lldb] Identify Swift-implemented ObjC classes

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 13 11:07:28 PDT 2023


aprantl added inline comments.


================
Comment at: lldb/source/Core/ValueObjectDynamicValue.cpp:169
+  if (known_type == lldb::eLanguageTypeObjC &&
+      UseSwiftRuntime(*m_parent, exe_ctx)) {
+    runtime = process->GetLanguageRuntime(lldb::eLanguageTypeSwift);
----------------
This is a bit of a layering violation. Could the ObjC language runtime perform this check in `GetDynamicTypeAndAddress` and dispatch to the Swift runtime there?

If you do this, we need to ensure we can't get into an infinite loop between the runtimes.

Alternatively, we could add a virtual GetPreferredLanguageRuntime() method to LanguageRuntime that we call here, maybe?


================
Comment at: lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h:89
 
+    virtual bool IsSwift() const { return false; }
+
----------------
Can you add a Doxygen commen?
/// Determine whether this class is implemented in Swift.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152837/new/

https://reviews.llvm.org/D152837



More information about the lldb-commits mailing list