[clang] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)

Alexander Richardson via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 10:13:47 PDT 2024


================
@@ -2216,7 +2216,7 @@ static llvm::Value *EmitTypeidFromVTable(CodeGenFunction &CGF, const Expr *E,
 }
 
 llvm::Value *CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
-  llvm::Type *PtrTy = llvm::PointerType::getUnqual(getLLVMContext());
+  llvm::Type *PtrTy = Int8PtrTy;
----------------
arichardson wrote:

I also find this somewhat surprising. Looking at the discussion that linked review the concern seems to be that you'd end up emitting e.g. `ptr addrspace(1)` here and users of EmitCXXTypeidLValue do not expect to handle that?

Could you add a comment that the result of this type is used in contexts where the "default" address space is expected. Without the comment I find this very confusing.

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


More information about the cfe-commits mailing list