Devirtualize EHScopeStack::Cleanup's dtor because it's never destroyed polymorphically
llvm-svn: 245378
This commit is contained in:
parent
d85f7010cc
commit
7e70d6803d
|
@ -2239,7 +2239,7 @@ void CodeGenFunction::BuildBlockRelease(llvm::Value *V, BlockFieldFlags flags) {
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallBlockRelease : EHScopeStack::Cleanup {
|
||||
struct CallBlockRelease final : EHScopeStack::Cleanup {
|
||||
llvm::Value *Addr;
|
||||
CallBlockRelease(llvm::Value *Addr) : Addr(Addr) {}
|
||||
|
||||
|
|
|
@ -2851,7 +2851,7 @@ void CodeGenFunction::EmitCallArgs(
|
|||
|
||||
namespace {
|
||||
|
||||
struct DestroyUnpassedArg : EHScopeStack::Cleanup {
|
||||
struct DestroyUnpassedArg final : EHScopeStack::Cleanup {
|
||||
DestroyUnpassedArg(llvm::Value *Addr, QualType Ty)
|
||||
: Addr(Addr), Ty(Ty) {}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ llvm::Value *CodeGenFunction::GetVTTParameter(GlobalDecl GD,
|
|||
|
||||
namespace {
|
||||
/// Call the destructor for a direct base class.
|
||||
struct CallBaseDtor : EHScopeStack::Cleanup {
|
||||
struct CallBaseDtor final : EHScopeStack::Cleanup {
|
||||
const CXXRecordDecl *BaseClass;
|
||||
bool BaseIsVirtual;
|
||||
CallBaseDtor(const CXXRecordDecl *Base, bool BaseIsVirtual)
|
||||
|
@ -1526,7 +1526,7 @@ void CodeGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList &Args)
|
|||
|
||||
namespace {
|
||||
/// Call the operator delete associated with the current destructor.
|
||||
struct CallDtorDelete : EHScopeStack::Cleanup {
|
||||
struct CallDtorDelete final : EHScopeStack::Cleanup {
|
||||
CallDtorDelete() {}
|
||||
|
||||
void Emit(CodeGenFunction &CGF, Flags flags) override {
|
||||
|
@ -1537,7 +1537,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
struct CallDtorDeleteConditional : EHScopeStack::Cleanup {
|
||||
struct CallDtorDeleteConditional final : EHScopeStack::Cleanup {
|
||||
llvm::Value *ShouldDeleteCondition;
|
||||
public:
|
||||
CallDtorDeleteConditional(llvm::Value *ShouldDeleteCondition)
|
||||
|
@ -1563,7 +1563,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
class DestroyField : public EHScopeStack::Cleanup {
|
||||
class DestroyField final : public EHScopeStack::Cleanup {
|
||||
const FieldDecl *field;
|
||||
CodeGenFunction::Destroyer *destroyer;
|
||||
bool useEHCleanupForArray;
|
||||
|
@ -1933,7 +1933,7 @@ CodeGenFunction::EmitDelegateCXXConstructorCall(const CXXConstructorDecl *Ctor,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallDelegatingCtorDtor : EHScopeStack::Cleanup {
|
||||
struct CallDelegatingCtorDtor final : EHScopeStack::Cleanup {
|
||||
const CXXDestructorDecl *Dtor;
|
||||
llvm::Value *Addr;
|
||||
CXXDtorType Type;
|
||||
|
@ -1987,7 +1987,7 @@ void CodeGenFunction::EmitCXXDestructorCall(const CXXDestructorDecl *DD,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallLocalDtor : EHScopeStack::Cleanup {
|
||||
struct CallLocalDtor final : EHScopeStack::Cleanup {
|
||||
const CXXDestructorDecl *Dtor;
|
||||
llvm::Value *Addr;
|
||||
|
||||
|
|
|
@ -400,7 +400,7 @@ void CodeGenFunction::EmitStaticVarDecl(const VarDecl &D,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct DestroyObject : EHScopeStack::Cleanup {
|
||||
struct DestroyObject final : EHScopeStack::Cleanup {
|
||||
DestroyObject(llvm::Value *addr, QualType type,
|
||||
CodeGenFunction::Destroyer *destroyer,
|
||||
bool useEHCleanupForArray)
|
||||
|
@ -421,7 +421,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
struct DestroyNRVOVariable : EHScopeStack::Cleanup {
|
||||
struct DestroyNRVOVariable final : EHScopeStack::Cleanup {
|
||||
DestroyNRVOVariable(llvm::Value *addr,
|
||||
const CXXDestructorDecl *Dtor,
|
||||
llvm::Value *NRVOFlag)
|
||||
|
@ -454,7 +454,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
struct CallStackRestore : EHScopeStack::Cleanup {
|
||||
struct CallStackRestore final : EHScopeStack::Cleanup {
|
||||
llvm::Value *Stack;
|
||||
CallStackRestore(llvm::Value *Stack) : Stack(Stack) {}
|
||||
void Emit(CodeGenFunction &CGF, Flags flags) override {
|
||||
|
@ -464,7 +464,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
struct ExtendGCLifetime : EHScopeStack::Cleanup {
|
||||
struct ExtendGCLifetime final : EHScopeStack::Cleanup {
|
||||
const VarDecl &Var;
|
||||
ExtendGCLifetime(const VarDecl *var) : Var(*var) {}
|
||||
|
||||
|
@ -479,7 +479,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
struct CallCleanupFunction : EHScopeStack::Cleanup {
|
||||
struct CallCleanupFunction final : EHScopeStack::Cleanup {
|
||||
llvm::Constant *CleanupFn;
|
||||
const CGFunctionInfo &FnInfo;
|
||||
const VarDecl &Var;
|
||||
|
@ -513,7 +513,7 @@ namespace {
|
|||
};
|
||||
|
||||
/// A cleanup to call @llvm.lifetime.end.
|
||||
class CallLifetimeEnd : public EHScopeStack::Cleanup {
|
||||
class CallLifetimeEnd final : public EHScopeStack::Cleanup {
|
||||
llvm::Value *Addr;
|
||||
llvm::Value *Size;
|
||||
public:
|
||||
|
@ -1548,7 +1548,7 @@ namespace {
|
|||
/// RegularPartialArrayDestroy - a cleanup which performs a partial
|
||||
/// array destroy where the end pointer is regularly determined and
|
||||
/// does not need to be loaded from a local.
|
||||
class RegularPartialArrayDestroy : public EHScopeStack::Cleanup {
|
||||
class RegularPartialArrayDestroy final : public EHScopeStack::Cleanup {
|
||||
llvm::Value *ArrayBegin;
|
||||
llvm::Value *ArrayEnd;
|
||||
QualType ElementType;
|
||||
|
@ -1569,7 +1569,7 @@ namespace {
|
|||
/// IrregularPartialArrayDestroy - a cleanup which performs a
|
||||
/// partial array destroy where the end pointer is irregularly
|
||||
/// determined and must be loaded from a local.
|
||||
class IrregularPartialArrayDestroy : public EHScopeStack::Cleanup {
|
||||
class IrregularPartialArrayDestroy final : public EHScopeStack::Cleanup {
|
||||
llvm::Value *ArrayBegin;
|
||||
llvm::Value *ArrayEndPointer;
|
||||
QualType ElementType;
|
||||
|
@ -1641,7 +1641,7 @@ namespace {
|
|||
/// function. This is used to balance out the incoming +1 of a
|
||||
/// ns_consumed argument when we can't reasonably do that just by
|
||||
/// not doing the initial retain for a __block argument.
|
||||
struct ConsumeARCParameter : EHScopeStack::Cleanup {
|
||||
struct ConsumeARCParameter final : EHScopeStack::Cleanup {
|
||||
ConsumeARCParameter(llvm::Value *param,
|
||||
ARCPreciseLifetime_t precise)
|
||||
: Param(param), Precise(precise) {}
|
||||
|
|
|
@ -327,7 +327,7 @@ static llvm::Constant *getCatchAllValue(CodeGenFunction &CGF) {
|
|||
namespace {
|
||||
/// A cleanup to free the exception object if its initialization
|
||||
/// throws.
|
||||
struct FreeException : EHScopeStack::Cleanup {
|
||||
struct FreeException final : EHScopeStack::Cleanup {
|
||||
llvm::Value *exn;
|
||||
FreeException(llvm::Value *exn) : exn(exn) {}
|
||||
void Emit(CodeGenFunction &CGF, Flags flags) override {
|
||||
|
@ -1087,7 +1087,7 @@ void CodeGenFunction::ExitCXXTryStmt(const CXXTryStmt &S, bool IsFnTryBlock) {
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallEndCatchForFinally : EHScopeStack::Cleanup {
|
||||
struct CallEndCatchForFinally final : EHScopeStack::Cleanup {
|
||||
llvm::Value *ForEHVar;
|
||||
llvm::Value *EndCatchFn;
|
||||
CallEndCatchForFinally(llvm::Value *ForEHVar, llvm::Value *EndCatchFn)
|
||||
|
@ -1107,7 +1107,7 @@ namespace {
|
|||
}
|
||||
};
|
||||
|
||||
struct PerformFinally : EHScopeStack::Cleanup {
|
||||
struct PerformFinally final : EHScopeStack::Cleanup {
|
||||
const Stmt *Body;
|
||||
llvm::Value *ForEHVar;
|
||||
llvm::Value *EndCatchFn;
|
||||
|
@ -1395,7 +1395,7 @@ void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt &S) {
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct PerformSEHFinally : EHScopeStack::Cleanup {
|
||||
struct PerformSEHFinally final : EHScopeStack::Cleanup {
|
||||
llvm::Function *OutlinedFinally;
|
||||
PerformSEHFinally(llvm::Function *OutlinedFinally)
|
||||
: OutlinedFinally(OutlinedFinally) {}
|
||||
|
|
|
@ -1104,7 +1104,7 @@ RValue CodeGenFunction::EmitBuiltinNewDeleteCall(const FunctionProtoType *Type,
|
|||
namespace {
|
||||
/// A cleanup to call the given 'operator delete' function upon
|
||||
/// abnormal exit from a new expression.
|
||||
class CallDeleteDuringNew : public EHScopeStack::Cleanup {
|
||||
class CallDeleteDuringNew final : public EHScopeStack::Cleanup {
|
||||
size_t NumPlacementArgs;
|
||||
const FunctionDecl *OperatorDelete;
|
||||
llvm::Value *Ptr;
|
||||
|
@ -1157,7 +1157,7 @@ namespace {
|
|||
/// A cleanup to call the given 'operator delete' function upon
|
||||
/// abnormal exit from a new expression when the new expression is
|
||||
/// conditional.
|
||||
class CallDeleteDuringConditionalNew : public EHScopeStack::Cleanup {
|
||||
class CallDeleteDuringConditionalNew final : public EHScopeStack::Cleanup {
|
||||
size_t NumPlacementArgs;
|
||||
const FunctionDecl *OperatorDelete;
|
||||
DominatingValue<RValue>::saved_type Ptr;
|
||||
|
@ -1422,7 +1422,7 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD,
|
|||
|
||||
namespace {
|
||||
/// Calls the given 'operator delete' on a single object.
|
||||
struct CallObjectDelete : EHScopeStack::Cleanup {
|
||||
struct CallObjectDelete final : EHScopeStack::Cleanup {
|
||||
llvm::Value *Ptr;
|
||||
const FunctionDecl *OperatorDelete;
|
||||
QualType ElementType;
|
||||
|
@ -1507,7 +1507,7 @@ static void EmitObjectDelete(CodeGenFunction &CGF,
|
|||
|
||||
namespace {
|
||||
/// Calls the given 'operator delete' on an array of objects.
|
||||
struct CallArrayDelete : EHScopeStack::Cleanup {
|
||||
struct CallArrayDelete final : EHScopeStack::Cleanup {
|
||||
llvm::Value *Ptr;
|
||||
const FunctionDecl *OperatorDelete;
|
||||
llvm::Value *NumElements;
|
||||
|
|
|
@ -451,7 +451,7 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct FinishARCDealloc : EHScopeStack::Cleanup {
|
||||
struct FinishARCDealloc final : EHScopeStack::Cleanup {
|
||||
void Emit(CodeGenFunction &CGF, Flags flags) override {
|
||||
const ObjCMethodDecl *method = cast<ObjCMethodDecl>(CGF.CurCodeDecl);
|
||||
|
||||
|
@ -1304,7 +1304,7 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct DestroyIvar : EHScopeStack::Cleanup {
|
||||
struct DestroyIvar final : EHScopeStack::Cleanup {
|
||||
private:
|
||||
llvm::Value *addr;
|
||||
const ObjCIvarDecl *ivar;
|
||||
|
@ -1743,7 +1743,7 @@ llvm::Value *CodeGenFunction::EmitObjCProduceObject(QualType type,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallObjCRelease : EHScopeStack::Cleanup {
|
||||
struct CallObjCRelease final : EHScopeStack::Cleanup {
|
||||
CallObjCRelease(llvm::Value *object) : object(object) {}
|
||||
llvm::Value *object;
|
||||
|
||||
|
@ -2350,7 +2350,7 @@ void CodeGenFunction::destroyARCWeak(CodeGenFunction &CGF,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallObjCAutoreleasePoolObject : EHScopeStack::Cleanup {
|
||||
struct CallObjCAutoreleasePoolObject final : EHScopeStack::Cleanup {
|
||||
llvm::Value *Token;
|
||||
|
||||
CallObjCAutoreleasePoolObject(llvm::Value *token) : Token(token) {}
|
||||
|
@ -2359,7 +2359,7 @@ namespace {
|
|||
CGF.EmitObjCAutoreleasePoolPop(Token);
|
||||
}
|
||||
};
|
||||
struct CallObjCMRRAutoreleasePoolObject : EHScopeStack::Cleanup {
|
||||
struct CallObjCMRRAutoreleasePoolObject final : EHScopeStack::Cleanup {
|
||||
llvm::Value *Token;
|
||||
|
||||
CallObjCMRRAutoreleasePoolObject(llvm::Value *token) : Token(token) {}
|
||||
|
|
|
@ -3421,7 +3421,7 @@ void CGObjCMac::EmitSynchronizedStmt(CodeGenFunction &CGF,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct PerformFragileFinally : EHScopeStack::Cleanup {
|
||||
struct PerformFragileFinally final : EHScopeStack::Cleanup {
|
||||
const Stmt &S;
|
||||
llvm::Value *SyncArgSlot;
|
||||
llvm::Value *CallTryExitVar;
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace {
|
|||
llvm::Constant *TypeInfo;
|
||||
};
|
||||
|
||||
struct CallObjCEndCatch : EHScopeStack::Cleanup {
|
||||
struct CallObjCEndCatch final : EHScopeStack::Cleanup {
|
||||
CallObjCEndCatch(bool MightThrow, llvm::Value *Fn) :
|
||||
MightThrow(MightThrow), Fn(Fn) {}
|
||||
bool MightThrow;
|
||||
|
@ -297,7 +297,7 @@ void CGObjCRuntime::EmitTryCatchStmt(CodeGenFunction &CGF,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallSyncExit : EHScopeStack::Cleanup {
|
||||
struct CallSyncExit final : EHScopeStack::Cleanup {
|
||||
llvm::Value *SyncExitFn;
|
||||
llvm::Value *SyncArg;
|
||||
CallSyncExit(llvm::Value *SyncExitFn, llvm::Value *SyncArg)
|
||||
|
|
|
@ -1246,7 +1246,7 @@ llvm::Value *CGOpenMPRuntime::getCriticalRegionLock(StringRef CriticalName) {
|
|||
}
|
||||
|
||||
namespace {
|
||||
template <size_t N> class CallEndCleanup : public EHScopeStack::Cleanup {
|
||||
template <size_t N> class CallEndCleanup final : public EHScopeStack::Cleanup {
|
||||
llvm::Value *Callee;
|
||||
llvm::Value *Args[N];
|
||||
|
||||
|
|
|
@ -145,6 +145,9 @@ public:
|
|||
// Anchor the construction vtable.
|
||||
virtual void anchor();
|
||||
|
||||
protected:
|
||||
~Cleanup() = default;
|
||||
|
||||
public:
|
||||
Cleanup(const Cleanup &) = default;
|
||||
Cleanup(Cleanup &&) {}
|
||||
|
@ -176,10 +179,6 @@ public:
|
|||
void setIsEHCleanupKind() { flags |= F_IsEHCleanupKind; }
|
||||
};
|
||||
|
||||
// Provide a virtual destructor to suppress a very common warning
|
||||
// that unfortunately cannot be suppressed without this. Cleanups
|
||||
// should not rely on this destructor ever being called.
|
||||
virtual ~Cleanup() {}
|
||||
|
||||
/// Emit the cleanup. For normal cleanups, this is run in the
|
||||
/// same EH context as when the cleanup was pushed, i.e. the
|
||||
|
@ -192,7 +191,8 @@ public:
|
|||
|
||||
/// ConditionalCleanup stores the saved form of its parameters,
|
||||
/// then restores them and performs the cleanup.
|
||||
template <class T, class... As> class ConditionalCleanup : public Cleanup {
|
||||
template <class T, class... As>
|
||||
class ConditionalCleanup final : public Cleanup {
|
||||
typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
|
||||
SavedTuple Saved;
|
||||
|
||||
|
|
|
@ -1766,7 +1766,7 @@ static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM,
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallGuardAbort : EHScopeStack::Cleanup {
|
||||
struct CallGuardAbort final : EHScopeStack::Cleanup {
|
||||
llvm::GlobalVariable *Guard;
|
||||
CallGuardAbort(llvm::GlobalVariable *Guard) : Guard(Guard) {}
|
||||
|
||||
|
@ -3367,7 +3367,7 @@ namespace {
|
|||
/// of the caught type, so we have to assume the actual thrown
|
||||
/// exception type might have a throwing destructor, even if the
|
||||
/// caught type's destructor is trivial or nothrow.
|
||||
struct CallEndCatch : EHScopeStack::Cleanup {
|
||||
struct CallEndCatch final : EHScopeStack::Cleanup {
|
||||
CallEndCatch(bool MightThrow) : MightThrow(MightThrow) {}
|
||||
bool MightThrow;
|
||||
|
||||
|
|
|
@ -851,7 +851,7 @@ void MicrosoftCXXABI::emitRethrow(CodeGenFunction &CGF, bool isNoReturn) {
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct CallEndCatchMSVC : EHScopeStack::Cleanup {
|
||||
struct CallEndCatchMSVC final : EHScopeStack::Cleanup {
|
||||
llvm::CatchPadInst *CPI;
|
||||
|
||||
CallEndCatchMSVC(llvm::CatchPadInst *CPI) : CPI(CPI) {}
|
||||
|
@ -2252,7 +2252,7 @@ static llvm::Constant *getInitThreadAbortFn(CodeGenModule &CGM) {
|
|||
}
|
||||
|
||||
namespace {
|
||||
struct ResetGuardBit : EHScopeStack::Cleanup {
|
||||
struct ResetGuardBit final : EHScopeStack::Cleanup {
|
||||
llvm::GlobalVariable *Guard;
|
||||
unsigned GuardNum;
|
||||
ResetGuardBit(llvm::GlobalVariable *Guard, unsigned GuardNum)
|
||||
|
@ -2269,7 +2269,7 @@ struct ResetGuardBit : EHScopeStack::Cleanup {
|
|||
}
|
||||
};
|
||||
|
||||
struct CallInitThreadAbort : EHScopeStack::Cleanup {
|
||||
struct CallInitThreadAbort final : EHScopeStack::Cleanup {
|
||||
llvm::GlobalVariable *Guard;
|
||||
CallInitThreadAbort(llvm::GlobalVariable *Guard) : Guard(Guard) {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue