[clang] [Clang][NFC] Rename UnqualPtrTy to DefaultPtrTy (PR #163207)

Björn Pettersson via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 03:05:04 PDT 2025


================
@@ -816,7 +816,7 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
   // function pointer.
   CGF.EmitBlock(FnNonVirtual);
   llvm::Value *NonVirtualFn =
-      Builder.CreateIntToPtr(FnAsInt, CGF.UnqualPtrTy, "memptr.nonvirtualfn");
+      Builder.CreateIntToPtr(FnAsInt, CGF.DefaultPtrTy, "memptr.nonvirtualfn");
----------------
bjope wrote:

I guess this is an example when it gets a bit weird.

Downstream we actually have a special CGF.FnVoidPtrTy that is used here. As we want function pointers to use the ProgramAddressSpace from the DataLayout (the default address space for functions is not necessarily the same as for data). That is however not implemented in the upstream clang.

Using CGF.DefaultPtrTy here (being a pointer to the default data memory) seems a bit weird for Harvard Architectures when the program memory is different from the data memory.

So one could wonder if UnqualPtrTy was used here to denote that these function pointers should be treated as unqualified entities without having any address space associated with them (although then one could wonder how one know the size of the pointers)? Or at least to indicate that this is a pointer to possibly something else than just the default data address space.

(With that being said I'm thinking that maybe this refactoring is OK anyway, since it is only a kind of churn that rename things. Downstream we will have to deal with conflicts due to the fact that we actually identify function pointers a bit differently. Maybe that is something that we should consider upstreaming.)

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


More information about the cfe-commits mailing list