[Lldb-commits] [lldb] 0ec567c - Revert "[lldb][ObjC] Don't query objective-c runtime for decls in C++ contexts (#95963)"

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 20 09:54:56 PDT 2024


Author: Michael Buch
Date: 2024-06-20T17:53:37+01:00
New Revision: 0ec567c370df86893a22bf59d2716f6e553ca63b

URL: https://github.com/llvm/llvm-project/commit/0ec567c370df86893a22bf59d2716f6e553ca63b
DIFF: https://github.com/llvm/llvm-project/commit/0ec567c370df86893a22bf59d2716f6e553ca63b.diff

LOG: Revert "[lldb][ObjC] Don't query objective-c runtime for decls in C++ contexts (#95963)"

This reverts commit dadf960607bb429baebd3f523ce5b93260a154d2.

The commit caused `TestEarlyProcessLaunch.py` to fail on the
macOS bots.

Added: 
    

Modified: 
    lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
    lldb/test/API/lang/objcxx/objc-from-cpp-frames-without-debuginfo/TestObjCFromCppFramesWithoutDebugInfo.py

Removed: 
    lldb/test/Shell/Expr/TestObjCInCXXContext.test


################################################################################
diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 1fdd272dcbece..82a7a2cc3f1ef 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -637,7 +637,7 @@ void ClangASTSource::FindExternalVisibleDecls(
     FindDeclInModules(context, name);
   }
 
-  if (!context.m_found_type && m_ast_context->getLangOpts().ObjC) {
+  if (!context.m_found_type) {
     FindDeclInObjCRuntime(context, name);
   }
 }

diff  --git a/lldb/test/API/lang/objcxx/objc-from-cpp-frames-without-debuginfo/TestObjCFromCppFramesWithoutDebugInfo.py b/lldb/test/API/lang/objcxx/objc-from-cpp-frames-without-debuginfo/TestObjCFromCppFramesWithoutDebugInfo.py
index 497c0dd128f48..ef8d5540fa4ef 100644
--- a/lldb/test/API/lang/objcxx/objc-from-cpp-frames-without-debuginfo/TestObjCFromCppFramesWithoutDebugInfo.py
+++ b/lldb/test/API/lang/objcxx/objc-from-cpp-frames-without-debuginfo/TestObjCFromCppFramesWithoutDebugInfo.py
@@ -15,11 +15,4 @@ def test(self):
         (_, process, _, _) = lldbutil.run_to_name_breakpoint(self, "main")
 
         self.assertState(process.GetState(), lldb.eStateStopped)
-
-        # Tests that we can use builtin Objective-C identifiers.
         self.expect("expr id", error=False)
-
-        # Tests that we can lookup Objective-C decls in the ObjC runtime plugin.
-        self.expect_expr(
-            "NSString *c; c == nullptr", result_value="true", result_type="bool"
-        )

diff  --git a/lldb/test/Shell/Expr/TestObjCInCXXContext.test b/lldb/test/Shell/Expr/TestObjCInCXXContext.test
deleted file mode 100644
index 8537799bdeb67..0000000000000
--- a/lldb/test/Shell/Expr/TestObjCInCXXContext.test
+++ /dev/null
@@ -1,21 +0,0 @@
-// UNSUPPORTED: system-linux, system-windows
-
-// Tests that we don't consult the the Objective-C runtime
-// plugin when in a purely C++ context.
-//
-// RUN: %clangxx_host %p/Inputs/objc-cast.cpp -g -o %t
-// RUN: %lldb %t \
-// RUN:   -o "b main" -o run \
-// RUN:   -o "expression --language objective-c -- NSString * a; a" \
-// RUN:   -o "expression --language objective-c++ -- NSString * b; b" \
-// RUN:   -o "expression NSString" \
-// RUN:   2>&1 | FileCheck %s
-
-// CHECK:      (lldb) expression --language objective-c -- NSString * a; a
-// CHECK-NEXT: (NSString *){{.*}}= nil
-
-// CHECK:      (lldb) expression --language objective-c++ -- NSString * b; b
-// CHECK-NEXT: (NSString *){{.*}}= nil
-
-// CHECK:      (lldb) expression NSString
-// CHECK-NEXT: error:{{.*}} use of undeclared identifier 'NSString'


        


More information about the lldb-commits mailing list