[Lldb-commits] [lldb] 4ced29b - [lldb][Expression] Don't create Objective-C IR checker for pure-C++ targets/frames (#144503)

via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 17 08:33:27 PDT 2025


Author: Michael Buch
Date: 2025-06-17T16:33:24+01:00
New Revision: 4ced29b8482e3537da7d27d410bf7947b0666b4c

URL: https://github.com/llvm/llvm-project/commit/4ced29b8482e3537da7d27d410bf7947b0666b4c
DIFF: https://github.com/llvm/llvm-project/commit/4ced29b8482e3537da7d27d410bf7947b0666b4c.diff

LOG: [lldb][Expression] Don't create Objective-C IR checker for pure-C++ targets/frames (#144503)

There's no need to create this utility function (and run it) for
targets/frames that aren't Objective-C/Objective-C++.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
index 6ef5d3f5be6d9..be17c5421fc51 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
@@ -18,6 +18,7 @@
 
 #include "lldb/Expression/UtilityFunction.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -46,7 +47,13 @@ ClangDynamicCheckerFunctions::Install(DiagnosticManager &diagnostic_manager,
     ObjCLanguageRuntime *objc_language_runtime =
         ObjCLanguageRuntime::Get(*process);
 
-    if (objc_language_runtime) {
+    SourceLanguage lang = process->GetTarget().GetLanguage();
+    if (!lang)
+      if (auto *frame = exe_ctx.GetFramePtr())
+        lang = frame->GetLanguage();
+
+    if (objc_language_runtime &&
+        Language::LanguageIsObjC(lang.AsLanguageType())) {
       Expected<std::unique_ptr<UtilityFunction>> checker_fn =
           objc_language_runtime->CreateObjectChecker(VALID_OBJC_OBJECT_CHECK_NAME, exe_ctx);
       if (!checker_fn)


        


More information about the lldb-commits mailing list