[clang] [clang][bytecode] Add `PtrView` for non-tracking pointers (PR #184129)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 19:52:56 PST 2026


tbaederr wrote:

> Given the semantics of pointers at the moment this seems very reasonable, but I need to spend more time looking at how the bytecode interpreter works to really feel comfortable voicing an opinion.
> 
> Given my lack of familiarity I'm basing this on reading of your description and the change itself, so I'd like to confirm my understanding:
> 
> Currently when interacting with block (or whatever) pointers, the design assumes all access it mutating. Given the assumption of mutation, this means any pointers/references to the block or its members are treated essentially as weak pointers, and so you get a pile of excess work that isn't necessary if you're not actually modifying the object[s].
> 
> So the PtrView provides a known readonly view, which covers all the non-mutating operations, and everything becomes much better.
> 
> If that's a correct understanding this seems like a fundamentally Good Thing.

It's not about mutability really, just about the pointer tracking. `PtrView` still has `deref()` and `elem()` functions after all, which allow changing the block contents.





https://github.com/llvm/llvm-project/pull/184129


More information about the cfe-commits mailing list