forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "[lldb][ObjC] Don't query objective-c runtime for decls in C++…
… contexts" This relands llvm#95963. It had to be reverted because the `TestEarlyProcessLaunch.py` test was failing on the incremental macOS bots. The test failed because it was relying on expression log output from the ObjC introspection routines (but was the expression was called from a C++ context). The relanded patch simply ensures that the test runs the expressions as `ObjC` expressions. When LLDB isn't able to find a `clang::Decl` in response to a `FindExternalVisibleDeclsByName`, it will fall-back to looking into the Objective-C runtime for that decl. This ends up doing a lot of work which isn't necessary when we're debugging a C++ program. This patch makes the ObjC lookup conditional on the language that the ExpressionParser deduced (which can be explicitly set using the `expr --language` option or is set implicitly if we're stopped in an ObjC frame or a C++ frame without debug-info). rdar://96236519
- Loading branch information
1 parent
ad39315
commit 9e6ea38
Showing
4 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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' |