summaryrefslogtreecommitdiff
path: root/unittests/IR/ValueHandleTest.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-08-03 22:30:24 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-08-03 22:30:24 +0000
commitc4423f0478641e9c93d305e6424a9fca53264c71 (patch)
treee102a06bc545b751e7cd6b1a4dcf4178e6ee5899 /unittests/IR/ValueHandleTest.cpp
parent5647cdb099acd9fd212073121793af56916ca466 (diff)
-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11
Various value handles needed to be copy constructible and copy assignable (mostly for their use in DenseMap). But to avoid an API that might allow accidental slicing, make these members protected in the base class and make derived classes final (the special members become implicitly public there - but disallowing further derived classes that might be sliced to the intermediate type). Might be worth having a warning a bit like -Wnon-virtual-dtor that catches public move/copy assign/ctors in classes with virtual functions. (suppressable in the same way - by making them protected in the base, and making the derived classes final) Could be fancier and only diagnose them when they're actually called, potentially. Also allow a few default implementations where custom implementations (especially with non-standard return types) were implemented. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR/ValueHandleTest.cpp')
-rw-r--r--unittests/IR/ValueHandleTest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/unittests/IR/ValueHandleTest.cpp b/unittests/IR/ValueHandleTest.cpp
index e6eb7cbedc6..e1d598bbc58 100644
--- a/unittests/IR/ValueHandleTest.cpp
+++ b/unittests/IR/ValueHandleTest.cpp
@@ -29,7 +29,7 @@ protected:
}
};
-class ConcreteCallbackVH : public CallbackVH {
+class ConcreteCallbackVH final : public CallbackVH {
public:
ConcreteCallbackVH(Value *V) : CallbackVH(V) {}
};
@@ -235,7 +235,7 @@ TEST_F(ValueHandle, CallbackVH_Comparisons) {
}
TEST_F(ValueHandle, CallbackVH_CallbackOnDeletion) {
- class RecordingVH : public CallbackVH {
+ class RecordingVH final : public CallbackVH {
public:
int DeletedCalls;
int AURWCalls;
@@ -261,7 +261,7 @@ TEST_F(ValueHandle, CallbackVH_CallbackOnDeletion) {
}
TEST_F(ValueHandle, CallbackVH_CallbackOnRAUW) {
- class RecordingVH : public CallbackVH {
+ class RecordingVH final : public CallbackVH {
public:
int DeletedCalls;
Value *AURWArgument;
@@ -291,7 +291,7 @@ TEST_F(ValueHandle, CallbackVH_CallbackOnRAUW) {
}
TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) {
- class RecoveringVH : public CallbackVH {
+ class RecoveringVH final : public CallbackVH {
public:
int DeletedCalls;
Value *AURWArgument;
@@ -339,7 +339,7 @@ TEST_F(ValueHandle, DestroyingOtherVHOnSameValueDoesntBreakIteration) {
// arrangement of other VHs so that the bad behavior would be
// triggered in whichever order callbacks run.
- class DestroyingVH : public CallbackVH {
+ class DestroyingVH final : public CallbackVH {
public:
std::unique_ptr<WeakVH> ToClear[2];
DestroyingVH(Value *V) {
@@ -384,7 +384,7 @@ TEST_F(ValueHandle, AssertingVHCheckedLast) {
// Value deletion, the CallbackVH should get a chance to do so
// before the AssertingVHs assert.
- class ClearingVH : public CallbackVH {
+ class ClearingVH final : public CallbackVH {
public:
AssertingVH<Value> *ToClear[2];
ClearingVH(Value *V,