[llvm] r231114 - DeltaAlgorithm: Provide protected default copy ctor for use by test derived class.
David Blaikie
dblaikie at gmail.com
Tue Mar 3 11:53:04 PST 2015
Author: dblaikie
Date: Tue Mar 3 13:53:04 2015
New Revision: 231114
URL: http://llvm.org/viewvc/llvm-project?rev=231114&view=rev
Log:
DeltaAlgorithm: Provide protected default copy ctor for use by test derived class.
Without this, use of this copy ctor is deprecated in C++11 due to the
presence of a user-declared dtor.
Marking the class final is just a little extra security that there are
no further derived classes that may then end up using the intermediate
base class's copy assignment operator and cause slicing to occur.
I didn't bother marking the other (non-test) base class final, since it
has reference members so it won't have any implicit assignment operators
anyway. Open to ideas on that, though.
We probably want a warning about use of a slicing assignment operator,
then I wouldn't worry so much about marking the class as final.
Modified:
llvm/trunk/include/llvm/ADT/DeltaAlgorithm.h
llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp
Modified: llvm/trunk/include/llvm/ADT/DeltaAlgorithm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DeltaAlgorithm.h?rev=231114&r1=231113&r2=231114&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DeltaAlgorithm.h (original)
+++ llvm/trunk/include/llvm/ADT/DeltaAlgorithm.h Tue Mar 3 13:53:04 2015
@@ -77,6 +77,8 @@ protected:
/// ExecuteOneTest - Execute a single test predicate on the change set \p S.
virtual bool ExecuteOneTest(const changeset_ty &S) = 0;
+ DeltaAlgorithm& operator=(const DeltaAlgorithm&) = default;
+
public:
virtual ~DeltaAlgorithm();
Modified: llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp?rev=231114&r1=231113&r2=231114&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp (original)
+++ llvm/trunk/unittests/ADT/DeltaAlgorithmTest.cpp Tue Mar 3 13:53:04 2015
@@ -32,7 +32,7 @@ std::ostream &operator<<(std::ostream &O
namespace {
-class FixedDeltaAlgorithm : public DeltaAlgorithm {
+class FixedDeltaAlgorithm final : public DeltaAlgorithm {
changeset_ty FailingSet;
unsigned NumTests;
More information about the llvm-commits
mailing list