Skip to content

Commit d4b4877

Browse files
committed
[lldb][Expression] Don't create Objective-C IR checker for pure-C++ targets/frames (llvm#144503)
There's no need to create this utility function (and run it) for targets/frames that aren't Objective-C/Objective-C++. (cherry picked from commit 4ced29b)
1 parent da3efb2 commit d4b4877

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "lldb/Expression/UtilityFunction.h"
2020
#include "lldb/Target/ExecutionContext.h"
21+
#include "lldb/Target/Language.h"
2122
#include "lldb/Target/Process.h"
2223
#include "lldb/Target/StackFrame.h"
2324
#include "lldb/Target/Target.h"
@@ -46,7 +47,13 @@ ClangDynamicCheckerFunctions::Install(DiagnosticManager &diagnostic_manager,
4647
ObjCLanguageRuntime *objc_language_runtime =
4748
ObjCLanguageRuntime::Get(*process);
4849

49-
if (objc_language_runtime) {
50+
SourceLanguage lang = process->GetTarget().GetLanguage();
51+
if (!lang)
52+
if (auto *frame = exe_ctx.GetFramePtr())
53+
lang = frame->GetLanguage();
54+
55+
if (objc_language_runtime &&
56+
Language::LanguageIsObjC(lang.AsLanguageType())) {
5057
Expected<std::unique_ptr<UtilityFunction>> checker_fn =
5158
objc_language_runtime->CreateObjectChecker(VALID_OBJC_OBJECT_CHECK_NAME, exe_ctx);
5259
if (!checker_fn)

0 commit comments

Comments
 (0)