In Objective-C, forward declarations are currently represented as:
```
DW_TAG_structure_type
DW_AT_name ("Foo")
DW_AT_declaration (true)
DW_AT_APPLE_runtime_class (DW_LANG_ObjC)
```
However, when compiling with `-gmodules`, when a class definition is
turned into a forward declaration within a `DW_TAG_module`, the DIE for
the forward declaration looks as follows:
```
DW_TAG_structure_type
DW_AT_name ("Foo")
DW_AT_declaration (true)
```
Note the absence of `DW_AT_APPLE_runtime_class`. With recent changes in
LLDB, not being able to differentiate between C++ and Objective-C
forward declarations has become problematic (see attached test-case and
explanation in https://github.com/llvm/llvm-project/pull/119860).
30 lines
790 B
Plaintext
30 lines
790 B
Plaintext
# REQUIRES: system-darwin
|
|
|
|
# Test that we can set a breakpoint in a method of a class extension.
|
|
# This requires us to parse the method into an AST type, and the context
|
|
# too (which in DWARF is just a forward declaration).
|
|
#
|
|
# RUN: split-file %s %t
|
|
# RUN: %clangxx_host %t/lib.m -c -g -gmodules -fmodules -o %t/lib.o
|
|
# RUN: %clangxx_host %t/main.m -g -gmodules -fmodules %t/lib.o -o %t/a.out -framework Foundation
|
|
#
|
|
# RUN: %lldb %t/a.out -o "breakpoint set -f lib.m -l 6" -o exit | FileCheck %s
|
|
|
|
# CHECK: (lldb) breakpoint set -f lib.m -l 6
|
|
# CHECK: Breakpoint 1: where = a.out`-[NSObject(Foo) func]
|
|
|
|
#--- main.m
|
|
int main() {
|
|
return 0;
|
|
}
|
|
|
|
#--- lib.m
|
|
#import <Foundation/Foundation.h>
|
|
|
|
@implementation NSObject (Foo)
|
|
- (NSError *)func {
|
|
NSLog(@"Hello, World!");
|
|
return 0;
|
|
}
|
|
@end
|