Skip to content

Conversation

llvmbot
Copy link
Member

@llvmbot llvmbot commented Sep 3, 2025

Backport 665e875

Requested by: @Michael137

…location, not the binding's declaration's location (llvm#153637)

For structured bindings that use custom `get` specializations, the
resulting LLVM IR ascribes the load of the result of `get` to the
binding's declaration, rather than the place where the binding is
referenced - this caused awkward sequencing in the debug info where,
when stepping through the code you'd step back to the binding
declaration every time there was a reference to the binding.

To fix that - when we cross into IRGening a binding - suppress the debug
info location of that subexpression.

I don't represent this as a great bit of API design - certainly open to
ideas, but putting it out here as a place to start.

It's /possible/ this is an incomplete fix, even - if the binding decl
had other subexpressions, those would still get their location applied &
it'd likely be wrong.

So maybe that's a direction to go with to productionize this - add a new
location scoped device that suppresses any overriding - this might be
more robust. How do people feel about that?

(cherry picked from commit 665e875)
@llvmbot
Copy link
Member Author

llvmbot commented Sep 3, 2025

@Michael137 What do you think about merging this PR to the release branch?

@github-project-automation github-project-automation bot moved this from Needs Triage to Needs Merge in LLVM Release Status Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Merge
Development

Successfully merging this pull request may close these issues.

4 participants