[clang] [Clang][CodeGen] Make UnqualPtrTy match llvm::PointerType::getUnqual (PR #163207)
Björn Pettersson via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 15 07:57:34 PDT 2025
bjope wrote:
> I think on the rare occasion where we actually want addrspace 0, regardless of the target's addrspace preferences, I'd prefer to change it to explicitly request addrspace 0. `Builder.getPtrTy(/*AddrSpace*/0)` is unambiguous.
I guess the question/ambiguity is about what "unqual" means. I'd imagine that we want to say something like
`This constructs an pointer to an object that is considered as unqualified (not really having any address space). Address space zero just happens to be used for this purpose as we need to set the address space to something.`
when describing PointerType::getUnqual.
But that may be a bit controversial given how many PointerType::getUnqual calls there is a in the code base that seem to assume the current wording (that it returns a pointer to "default address space"). And then it is even more confusing since in reality it seem to be that getUnqual always return an opaque pointer in address space zero, which for certain targets isn't the default address space.
If we want "unqual" to refer to some kind of generic unnumbered address space, then we probably want to update lots of getUnqual calls to specify address space explicitly (possibly with some new wrappers for selecting address space zero or the targets default address space).
https://github.com/llvm/llvm-project/pull/163207
More information about the cfe-commits
mailing list