[PATCH] D152321: [clang] Replace use of Type::getPointerTo() (NFC)

Youngsuk Kim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 16 08:24:56 PDT 2023


JOE1994 added inline comments.


================
Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:2552-2554
   auto AddrAS = addr ? addr->getType()->getPointerAddressSpace() : 0;
-  auto AddrInt8PtrTy =
-      AddrAS ? CGF.Int8Ty->getPointerTo(AddrAS) : CGF.Int8PtrTy;
+  auto AddrPtrTy =
+    AddrAS ? llvm::PointerType::get(CGF.getLLVMContext(), AddrAS) : CGF.Int8PtrTy;
----------------
barannikov88 wrote:
> barannikov88 wrote:
> > I think this can be simplified further to just:
> > `llvm::Type *AddrPtrTy = addr->getType();`
> > 
> I was wrong, `addr` can be null here. Sorry.
> 
Thanks for finding this!

Updating code to handle the nullptr case fixes the Clang regression test `Clang :: CodeGen/constructor-attribute.c`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152321/new/

https://reviews.llvm.org/D152321



More information about the cfe-commits mailing list