Skip to content

Conversation

@Michael137
Copy link

To improve debuggability, the macro arguments should be resolved to their original location rather than macro expansion location.

Macro.debug.webm

fixes llvm#160667

(cherry picked from commit beadb9e)

rdar://163707092

To improve debuggability, the macro arguments should be resolved to
their original location rather than macro expansion location.

[PR in
cation](https://github.com/user-attachments/assets/994fb89f-83be-4c21-a79c-f8e51d818f7b)

fixes llvm#160667

(cherry picked from commit beadb9e)
@Michael137
Copy link
Author

@swift-ci test

@Michael137
Copy link
Author

Michael137 commented Oct 30, 2025

Going to wait until next week before merging (to give it some time to brew upstream)

@Michael137
Copy link
Author

@swift-ci test macOS

@Michael137 Michael137 merged commit fcedb94 into stable/21.x Nov 3, 2025
3 checks passed
@Michael137 Michael137 deleted the clang/macro-debug-info-to-21.x branch November 3, 2025 18:19
@delcypher
Copy link

@Michael137 This broke some -fbounds-safety tests. I'm investigating now.

********************
Failed Tests (5):
  Clang :: BoundsSafety/CodeGen/opt-remarks/bounds-safety-ptr-conversion-O0.c
  Clang :: BoundsSafety/CodeGen/opt-remarks/ptr-count-assignment-argc-O0.c
  Clang :: BoundsSafety/CodeGen/opt-remarks/ptr-count-assignment-const-O0.c
  Clang :: BoundsSafety/CodeGen/trap-reasons/ptr_ge_upper_bound-deref-array_subscript-O0.c
  Clang :: BoundsSafety/CodeGen/trap-reasons/ptr_lt_lower_bound-deref-array_subscript-O0.c

delcypher added a commit to delcypher/apple-llvm-project that referenced this pull request Nov 4, 2025
… is handled

 swiftlang#11723 change changed how debug info for macros were handled.

```
commit 651cb8a
Author: SKill <skill@google.com>
Date:   Thu Oct 30 14:39:15 2025 +0100

    [clang] Use File Location for debug info resolution. (llvm#163982)

    To improve debuggability, the macro arguments should be resolved to
    their original location rather than macro expansion location.
```

This broke a bunch of the BoundsSafety tests because they were testing
the debug info used by some macros. In particular

* The `opt-remarks` test use debug info and the location of the `<count>`
  in `__counted_by(<count>)` changed to point at the macro argument
  instead the beginning of the macro
* The `trap-reasons` tests explicitly tested the debug location of
  access that happened through a macro. The debug location previously
  pointed at the beginning of the `ARRAY` macro and now it points at the
  `array` argument to the macro.

rdar://163727761&163727775&163727819&163727893&163727903
@delcypher
Copy link

Fix for the tests broken by this change: #11739

@Michael137
Copy link
Author

@Michael137 This broke some -fbounds-safety tests. I'm investigating now.


********************

Failed Tests (5):

  Clang :: BoundsSafety/CodeGen/opt-remarks/bounds-safety-ptr-conversion-O0.c

  Clang :: BoundsSafety/CodeGen/opt-remarks/ptr-count-assignment-argc-O0.c

  Clang :: BoundsSafety/CodeGen/opt-remarks/ptr-count-assignment-const-O0.c

  Clang :: BoundsSafety/CodeGen/trap-reasons/ptr_ge_upper_bound-deref-array_subscript-O0.c

  Clang :: BoundsSafety/CodeGen/trap-reasons/ptr_lt_lower_bound-deref-array_subscript-O0.c

Oh weird that pre-merge CI didnt catch those. Any idea why? Thanks for fixing!

@delcypher
Copy link

@Michael137 I think you need to do “@ swift-ci test llvm” to run the Clang tests

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.

4 participants