@@ -752,9 +752,9 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
752
752
} else {
753
753
llvm::Value *VFPAddr =
754
754
CGF.Builder .CreateGEP (CGF.Int8Ty , VTable, VTableOffset);
755
- VirtualFn = CGF.Builder .CreateAlignedLoad (
756
- llvm::PointerType::getUnqual ( CGF.getLLVMContext ()), VFPAddr ,
757
- CGF. getPointerAlign (), " memptr.virtualfn" );
755
+ VirtualFn = CGF.Builder .CreateAlignedLoad (CGF. UnqualPtrTy , VFPAddr,
756
+ CGF.getPointerAlign () ,
757
+ " memptr.virtualfn" );
758
758
}
759
759
}
760
760
assert (VirtualFn && " Virtual fuction pointer not created!" );
@@ -794,9 +794,8 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
794
794
// In the non-virtual path, the function pointer is actually a
795
795
// function pointer.
796
796
CGF.EmitBlock (FnNonVirtual);
797
- llvm::Value *NonVirtualFn = Builder.CreateIntToPtr (
798
- FnAsInt, llvm::PointerType::getUnqual (CGF.getLLVMContext ()),
799
- " memptr.nonvirtualfn" );
797
+ llvm::Value *NonVirtualFn =
798
+ Builder.CreateIntToPtr (FnAsInt, CGF.UnqualPtrTy , " memptr.nonvirtualfn" );
800
799
801
800
// Check the function pointer if CFI on member function pointers is enabled.
802
801
if (ShouldEmitCFICheck) {
@@ -835,8 +834,7 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
835
834
836
835
// We're done.
837
836
CGF.EmitBlock (FnEnd);
838
- llvm::PHINode *CalleePtr =
839
- Builder.CreatePHI (llvm::PointerType::getUnqual (CGF.getLLVMContext ()), 2 );
837
+ llvm::PHINode *CalleePtr = Builder.CreatePHI (CGF.UnqualPtrTy , 2 );
840
838
CalleePtr->addIncoming (VirtualFn, FnVirtual);
841
839
CalleePtr->addIncoming (NonVirtualFn, FnNonVirtual);
842
840
@@ -1380,8 +1378,7 @@ void ItaniumCXXABI::emitVirtualObjectDelete(CodeGenFunction &CGF,
1380
1378
// Grab the vtable pointer as an intptr_t*.
1381
1379
auto *ClassDecl =
1382
1380
cast<CXXRecordDecl>(ElementType->castAs <RecordType>()->getDecl ());
1383
- llvm::Value *VTable = CGF.GetVTablePtr (
1384
- Ptr, llvm::PointerType::getUnqual (CGF.getLLVMContext ()), ClassDecl);
1381
+ llvm::Value *VTable = CGF.GetVTablePtr (Ptr, CGF.UnqualPtrTy , ClassDecl);
1385
1382
1386
1383
// Track back to entry -2 and pull out the offset there.
1387
1384
llvm::Value *OffsetPtr = CGF.Builder .CreateConstInBoundsGEP1_64 (
@@ -1754,9 +1751,8 @@ llvm::Value *ItaniumCXXABI::emitDynamicCastToVoid(CodeGenFunction &CGF,
1754
1751
llvm::Value *OffsetToTop;
1755
1752
if (CGM.getItaniumVTableContext ().isRelativeLayout ()) {
1756
1753
// Get the vtable pointer.
1757
- llvm::Value *VTable = CGF.GetVTablePtr (
1758
- ThisAddr, llvm::PointerType::getUnqual (CGF.getLLVMContext ()),
1759
- ClassDecl);
1754
+ llvm::Value *VTable =
1755
+ CGF.GetVTablePtr (ThisAddr, CGF.UnqualPtrTy , ClassDecl);
1760
1756
1761
1757
// Get the offset-to-top from the vtable.
1762
1758
OffsetToTop =
@@ -1768,9 +1764,8 @@ llvm::Value *ItaniumCXXABI::emitDynamicCastToVoid(CodeGenFunction &CGF,
1768
1764
CGF.ConvertType (CGF.getContext ().getPointerDiffType ());
1769
1765
1770
1766
// Get the vtable pointer.
1771
- llvm::Value *VTable = CGF.GetVTablePtr (
1772
- ThisAddr, llvm::PointerType::getUnqual (CGF.getLLVMContext ()),
1773
- ClassDecl);
1767
+ llvm::Value *VTable =
1768
+ CGF.GetVTablePtr (ThisAddr, CGF.UnqualPtrTy , ClassDecl);
1774
1769
1775
1770
// Get the offset-to-top from the vtable.
1776
1771
OffsetToTop =
@@ -2182,7 +2177,8 @@ llvm::GlobalVariable *ItaniumCXXABI::getAddrOfVTable(const CXXRecordDecl *RD,
2182
2177
}
2183
2178
2184
2179
CGCallee ItaniumCXXABI::getVirtualFunctionPointer (CodeGenFunction &CGF,
2185
- GlobalDecl GD, Address This,
2180
+ GlobalDecl GD,
2181
+ Address This,
2186
2182
llvm::Type *Ty,
2187
2183
SourceLocation Loc) {
2188
2184
llvm::Type *PtrTy = CGM.GlobalsInt8PtrTy ;
@@ -2502,8 +2498,8 @@ llvm::Value *ItaniumCXXABI::readArrayCookieImpl(CodeGenFunction &CGF,
2502
2498
// cookie, otherwise return 0 to avoid an infinite loop calling DTORs.
2503
2499
// We can't simply ignore this load using nosanitize metadata because
2504
2500
// the metadata may be lost.
2505
- llvm::FunctionType *FTy = llvm::FunctionType::get (
2506
- CGF. SizeTy , llvm::PointerType::getUnqual (CGF.getLLVMContext ()) , false );
2501
+ llvm::FunctionType *FTy =
2502
+ llvm::FunctionType::get (CGF.SizeTy , CGF. UnqualPtrTy , false );
2507
2503
llvm::FunctionCallee F =
2508
2504
CGM.CreateRuntimeFunction (FTy, " __asan_load_cxx_array_cookie" );
2509
2505
return CGF.Builder .CreateCall (F, numElementsPtr.emitRawPointer (CGF));
@@ -2846,7 +2842,7 @@ static void emitGlobalDtorWithCXAAtExit(CodeGenFunction &CGF,
2846
2842
2847
2843
// We're assuming that the destructor function is something we can
2848
2844
// reasonably call with the default CC.
2849
- llvm::Type *dtorTy = llvm::PointerType::getUnqual ( CGF.getLLVMContext ()) ;
2845
+ llvm::Type *dtorTy = CGF.UnqualPtrTy ;
2850
2846
2851
2847
// Preserve address space of addr.
2852
2848
auto AddrAS = addr ? addr->getType ()->getPointerAddressSpace () : 0 ;
@@ -4968,8 +4964,7 @@ static void InitCatchParam(CodeGenFunction &CGF,
4968
4964
auto catchRD = CatchType->getAsCXXRecordDecl ();
4969
4965
CharUnits caughtExnAlignment = CGF.CGM .getClassPointerAlignment (catchRD);
4970
4966
4971
- llvm::Type *PtrTy =
4972
- llvm::PointerType::getUnqual (CGF.getLLVMContext ()); // addrspace 0 ok
4967
+ llvm::Type *PtrTy = CGF.UnqualPtrTy ; // addrspace 0 ok
4973
4968
4974
4969
// Check for a copy expression. If we don't have a copy expression,
4975
4970
// that means a trivial copy is okay.
@@ -5169,8 +5164,7 @@ void XLCXXABI::registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
5169
5164
llvm::FunctionCallee Dtor,
5170
5165
llvm::Constant *Addr) {
5171
5166
if (D.getTLSKind () != VarDecl::TLS_None) {
5172
- llvm::PointerType *PtrTy =
5173
- llvm::PointerType::getUnqual (CGF.getLLVMContext ());
5167
+ llvm::PointerType *PtrTy = CGF.UnqualPtrTy ;
5174
5168
5175
5169
// extern "C" int __pt_atexit_np(int flags, int(*)(int,...), ...);
5176
5170
llvm::FunctionType *AtExitTy =
0 commit comments