Skip to content

Conversation

@Michael137
Copy link

No description provided.

…LVM IR (llvm#165286)

There's a couple of tests like this.

This patch series renames these to something more descriptive and
adjusts the tests to check IR. Currently the tests check raw assembly
output (not even dwarfdump). Which most likely hid some bugs around
property debug-info.

(cherry picked from commit cc868f6)
Changes test name to something more meaningful. In preparation to
refactoring the test to check LLVM IR instead of assembly.

(cherry picked from commit 267b5b8)
Check for lack of `setter` and `getter` attributes on `DIObjCProperty`

(cherry picked from commit 7694817)
…lvm#165298)

We already have the same test (just different variable names) in
`property-basic.m`.

(cherry picked from commit e44dce3)
…k LLVM IR (llvm#165297)

This patch series renames these Objective-C property tests to something
more descriptive and adjusts them to check IR. Currently the tests check
raw assembly output (not even dwarfdump). Which most likely hid some
bugs around property debug-info.

(cherry picked from commit 5d9df8f)
New name makes it easer to find and checking IR is less likely to hide
bugs (and is more consistent with the other Clang debug-info tests).

(cherry picked from commit d0a7411)
…-info (llvm#165373)

The IR->DWARF pipeline was not properly tested before. This patch adds a
test to generate DWARF for various `DIObjCProperty` constructions.

This caught a couple of bugs:
1. The `DW_AT_APPLE_property_getter` and `DW_AT_APPLE_property_setter`
properties were emitted the wrong way around.
2. The `DW_TAG_member` ivars were not linking back to the property that
they back.

These will be fixed in follow-up patches.

(cherry picked from commit 7fb6fae)
…Property constructor (llvm#165401)

Depends on:
* llvm#165373

This caused the `DW_AT_APPLE_property_(setter|getter)` to be inverted
when compiling from LLVM IR.

(cherry picked from commit dda95d9)
Fails with:
```
******************** TEST 'LLVM :: DebugInfo/Generic/objc-property.ll' FAILED ********************
Exit Code: 2
Command Output (stdout):
--
RUN: at line 1
ome/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -filetype=obj -o - /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/DebugInfo/Generic/objc-property.ll | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-dwarfdump --debug-info - | /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/DebugInfo/Generic/objc-property.ll
executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -filetype=obj -o - /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/DebugInfo/Generic/objc-property.ll
.---command stderr------------
| Assertion failed: Section && "Cannot switch to a null section!", file  /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/lib/MC/MCStreamer.cpp, line 1364, virtual void llvm::MCStreamer::switchSection(MCSection *, uint32_t)()
| PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
| Stack dump:
| 0.	Program arguments: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llc -filetype=obj -o - /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/DebugInfo/Generic/objc-property.ll
`-----------------------------
error: command failed with exit status: -6
executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/llvm-dwarfdump --debug-info -
.---command stderr------------
| error: -: The file was not recognized as a valid object file
`-----------------------------
error: command failed with exit status: 1
executed command: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/DebugInfo/Generic/objc-property.ll
.---command stderr------------
| FileCheck error: '<stdin>' is empty.
| FileCheck command line:  /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/test/DebugInfo/Generic/objc-property.ll
`-----------------------------
error: command failed with exit status: 2
```

Presumably due to unsupported debug-info section (see
llvm#71814)

(cherry picked from commit 31180ba)
…operty constructor (llvm#165421)

Depends on:
* llvm#165401

We weren't testing `DIObjCProperty` roundtripping. So this was never
caught.

The consequence of this is that the `setter:` would have the getter name
and `getter:` would have the setter name.

(cherry picked from commit 49f918d)
…#165537)

This patch makes `dwarfdump` show the `DW_AT_APPLE_property_name` of a
referenced `DW_TAG_APPLE_property` (similar to how we show the name of a
referenced `DW_AT_type`). Eventually we'll extend this to the DWARFv6
property tags too.

Before:
```
0x00000013:     DW_TAG_APPLE_property
                  DW_AT_APPLE_property_name     ("propertyName")

0x0000001b:     DW_TAG_member
                  DW_AT_name    ("_ivar")
                  DW_AT_APPLE_property  (0x00000013)
```
After:
```
0x00000013:     DW_TAG_APPLE_property
                  DW_AT_APPLE_property_name     ("propertyName")

0x0000001b:     DW_TAG_member
                  DW_AT_name    ("_ivar")
                  DW_AT_APPLE_property  (0x00000013 "propertyName")
```

(cherry picked from commit 1e7c082)
…AG_APPLE_property (llvm#165409)

Depends on:
* llvm#165373

When an Objective-C property has a backing ivar, we would previously not
add a `DW_AT_APPLE_property` to the ivar's `DW_TAG_member`. This is what
was intended based on the [Objective-C DebugInfo
docs](https://github.com/llvm/llvm-project/blob/main/llvm/docs/SourceLevelDebugging.rst#proposal)
but is not what LLVM currently generates.

LLDB currently doesn't ever try linking the `ObjCPropertyDecl`s to their
`ObjCIvarDecl`s, but if we wanted to, this debug-info patch is a
pre-requisite.

(cherry picked from commit 10fbbb6)
@Michael137
Copy link
Author

@swift-ci test

@Michael137
Copy link
Author

@swift-ci test llvm

@Michael137 Michael137 merged commit bdd02c8 into stable/21.x Nov 6, 2025
5 checks passed
@Michael137 Michael137 deleted the objc-property-fixes-to-21.x branch November 6, 2025 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants