mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-16 14:26:17 +00:00
Treat nothrow forms of ::operator delete and ::operator delete[] as
deallocation functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186798 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -318,9 +318,15 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
|
||||
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
|
||||
return 0;
|
||||
|
||||
if (TLIFn != LibFunc::free &&
|
||||
TLIFn != LibFunc::ZdlPv && // operator delete(void*)
|
||||
TLIFn != LibFunc::ZdaPv) // operator delete[](void*)
|
||||
unsigned ExpectedNumParams;
|
||||
if (TLIFn == LibFunc::free ||
|
||||
TLIFn == LibFunc::ZdlPv || // operator delete(void*)
|
||||
TLIFn == LibFunc::ZdaPv) // operator delete[](void*)
|
||||
ExpectedNumParams = 1;
|
||||
else if (TLIFn == LibFunc::ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
|
||||
TLIFn == LibFunc::ZdaPvRKSt9nothrow_t) // delete[](void*, nothrow)
|
||||
ExpectedNumParams = 2;
|
||||
else
|
||||
return 0;
|
||||
|
||||
// Check free prototype.
|
||||
@@ -329,7 +335,7 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
|
||||
FunctionType *FTy = Callee->getFunctionType();
|
||||
if (!FTy->getReturnType()->isVoidTy())
|
||||
return 0;
|
||||
if (FTy->getNumParams() != 1)
|
||||
if (FTy->getNumParams() != ExpectedNumParams)
|
||||
return 0;
|
||||
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user