Use '=default' to define trivial constructor/destructors
https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-equals-default.html
PiperOrigin-RevId: 526079054
Change-Id: Ia4db21e3e5f58b90de05d52fd94b291ed06d785d
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index c0bb8a9..bd9ba73 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -611,7 +611,7 @@
private:
class ValueProducer {
public:
- virtual ~ValueProducer() {}
+ virtual ~ValueProducer() = default;
virtual T Produce() = 0;
};
@@ -699,8 +699,8 @@
typedef typename internal::Function<F>::Result Result;
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
- ActionInterface() {}
- virtual ~ActionInterface() {}
+ ActionInterface() = default;
+ virtual ~ActionInterface() = default;
// Performs the action. This method is not const, as in general an
// action can have side effects and be stateful. For example, a
@@ -749,7 +749,7 @@
// Constructs a null Action. Needed for storing Action objects in
// STL containers.
- Action() {}
+ Action() = default;
// Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be
diff --git a/googlemock/include/gmock/gmock-cardinalities.h b/googlemock/include/gmock/gmock-cardinalities.h
index b6ab648..533e604 100644
--- a/googlemock/include/gmock/gmock-cardinalities.h
+++ b/googlemock/include/gmock/gmock-cardinalities.h
@@ -65,7 +65,7 @@
// The implementation of a cardinality.
class CardinalityInterface {
public:
- virtual ~CardinalityInterface() {}
+ virtual ~CardinalityInterface() = default;
// Conservative estimate on the lower/upper bound of the number of
// calls allowed.
@@ -92,7 +92,7 @@
public:
// Constructs a null cardinality. Needed for storing Cardinality
// objects in STL containers.
- Cardinality() {}
+ Cardinality() = default;
// Constructs a Cardinality from its implementation.
explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index 2a33acb..78ca15d 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -566,7 +566,7 @@
typedef Expectation::Set::value_type value_type;
// Constructs an empty set.
- ExpectationSet() {}
+ ExpectationSet() = default;
// This single-argument ctor must not be explicit, in order to support the
// ExpectationSet es = EXPECT_CALL(...);
@@ -1446,7 +1446,7 @@
using ArgumentTuple = std::tuple<Args...>;
using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>;
- FunctionMocker() {}
+ FunctionMocker() = default;
// There is no generally useful and implementable semantics of
// copying a mock object, so copying a mock is usually a user error.
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h
index d344438..ead6d7c 100644
--- a/googlemock/include/gmock/internal/gmock-internal-utils.h
+++ b/googlemock/include/gmock/internal/gmock-internal-utils.h
@@ -224,7 +224,7 @@
// The type of a failure (either non-fatal or fatal).
enum FailureType { kNonfatal, kFatal };
- virtual ~FailureReporterInterface() {}
+ virtual ~FailureReporterInterface() = default;
// Reports a failure that occurred at the given source file location.
virtual void ReportFailure(FailureType type, const char* file, int line,
diff --git a/googlemock/src/gmock-spec-builders.cc b/googlemock/src/gmock-spec-builders.cc
index df0660b..de89471 100644
--- a/googlemock/src/gmock-spec-builders.cc
+++ b/googlemock/src/gmock-spec-builders.cc
@@ -96,7 +96,7 @@
action_count_checked_(false) {}
// Destructs an ExpectationBase object.
-ExpectationBase::~ExpectationBase() {}
+ExpectationBase::~ExpectationBase() = default;
// Explicitly specifies the cardinality of this expectation. Used by
// the subclasses to implement the .Times() clause.
@@ -309,7 +309,7 @@
UntypedFunctionMockerBase::UntypedFunctionMockerBase()
: mock_obj_(nullptr), name_("") {}
-UntypedFunctionMockerBase::~UntypedFunctionMockerBase() {}
+UntypedFunctionMockerBase::~UntypedFunctionMockerBase() = default;
// Sets the mock object this mock method belongs to, and registers
// this information in the global mock registry. Will be called
@@ -746,13 +746,13 @@
// needed by VerifyAndClearExpectationsLocked().
}
-Expectation::Expectation() {}
+Expectation::Expectation() = default;
Expectation::Expectation(
const std::shared_ptr<internal::ExpectationBase>& an_expectation_base)
: expectation_base_(an_expectation_base) {}
-Expectation::~Expectation() {}
+Expectation::~Expectation() = default;
// Adds an expectation to a sequence.
void Sequence::AddExpectation(const Expectation& expectation) const {
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc
index f2305e5..f569e83 100644
--- a/googlemock/test/gmock-actions_test.cc
+++ b/googlemock/test/gmock-actions_test.cc
@@ -985,7 +985,7 @@
class MockClass {
public:
- MockClass() {}
+ MockClass() = default;
MOCK_METHOD1(IntFunc, int(bool flag)); // NOLINT
MOCK_METHOD0(Foo, MyNonDefaultConstructible());
diff --git a/googlemock/test/gmock-cardinalities_test.cc b/googlemock/test/gmock-cardinalities_test.cc
index 77196d7..ad49752 100644
--- a/googlemock/test/gmock-cardinalities_test.cc
+++ b/googlemock/test/gmock-cardinalities_test.cc
@@ -52,7 +52,7 @@
class MockFoo {
public:
- MockFoo() {}
+ MockFoo() = default;
MOCK_METHOD0(Bar, int()); // NOLINT
private:
diff --git a/googlemock/test/gmock-function-mocker_test.cc b/googlemock/test/gmock-function-mocker_test.cc
index 4db498d..f7b31ae 100644
--- a/googlemock/test/gmock-function-mocker_test.cc
+++ b/googlemock/test/gmock-function-mocker_test.cc
@@ -70,7 +70,7 @@
template <typename T>
class TemplatedCopyable {
public:
- TemplatedCopyable() {}
+ TemplatedCopyable() = default;
template <typename U>
TemplatedCopyable(const U& other) {} // NOLINT
@@ -78,7 +78,7 @@
class FooInterface {
public:
- virtual ~FooInterface() {}
+ virtual ~FooInterface() = default;
virtual void VoidReturning(int x) = 0;
@@ -137,7 +137,7 @@
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4373)
class MockFoo : public FooInterface {
public:
- MockFoo() {}
+ MockFoo() = default;
// Makes sure that a mock function parameter can be named.
MOCK_METHOD(void, VoidReturning, (int n)); // NOLINT
@@ -208,7 +208,7 @@
class LegacyMockFoo : public FooInterface {
public:
- LegacyMockFoo() {}
+ LegacyMockFoo() = default;
// Makes sure that a mock function parameter can be named.
MOCK_METHOD1(VoidReturning, void(int n)); // NOLINT
@@ -487,7 +487,7 @@
class MockB {
public:
- MockB() {}
+ MockB() = default;
MOCK_METHOD(void, DoB, ());
@@ -498,7 +498,7 @@
class LegacyMockB {
public:
- LegacyMockB() {}
+ LegacyMockB() = default;
MOCK_METHOD0(DoB, void());
@@ -534,7 +534,7 @@
template <typename T>
class StackInterface {
public:
- virtual ~StackInterface() {}
+ virtual ~StackInterface() = default;
// Template parameter appears in function parameter.
virtual void Push(const T& value) = 0;
@@ -547,7 +547,7 @@
template <typename T>
class MockStack : public StackInterface<T> {
public:
- MockStack() {}
+ MockStack() = default;
MOCK_METHOD(void, Push, (const T& elem), ());
MOCK_METHOD(void, Pop, (), (final));
@@ -566,7 +566,7 @@
template <typename T>
class LegacyMockStack : public StackInterface<T> {
public:
- LegacyMockStack() {}
+ LegacyMockStack() = default;
MOCK_METHOD1_T(Push, void(const T& elem));
MOCK_METHOD0_T(Pop, void());
@@ -711,7 +711,7 @@
class MockOverloadedOnArgNumber {
public:
- MockOverloadedOnArgNumber() {}
+ MockOverloadedOnArgNumber() = default;
MY_MOCK_METHODS1_;
@@ -723,7 +723,7 @@
class LegacyMockOverloadedOnArgNumber {
public:
- LegacyMockOverloadedOnArgNumber() {}
+ LegacyMockOverloadedOnArgNumber() = default;
LEGACY_MY_MOCK_METHODS1_;
@@ -758,7 +758,7 @@
class MockOverloadedOnConstness {
public:
- MockOverloadedOnConstness() {}
+ MockOverloadedOnConstness() = default;
MY_MOCK_METHODS2_;
diff --git a/googlemock/test/gmock-matchers-arithmetic_test.cc b/googlemock/test/gmock-matchers-arithmetic_test.cc
index 062e2ab..f176962 100644
--- a/googlemock/test/gmock-matchers-arithmetic_test.cc
+++ b/googlemock/test/gmock-matchers-arithmetic_test.cc
@@ -955,7 +955,7 @@
class AllArgsHelper {
public:
- AllArgsHelper() {}
+ AllArgsHelper() = default;
MOCK_METHOD2(Helper, int(char x, int y));
@@ -976,7 +976,7 @@
class OptionalMatchersHelper {
public:
- OptionalMatchersHelper() {}
+ OptionalMatchersHelper() = default;
MOCK_METHOD0(NoArgs, int());
diff --git a/googlemock/test/gmock-matchers-comparisons_test.cc b/googlemock/test/gmock-matchers-comparisons_test.cc
index cf85eb5..b2ce99e 100644
--- a/googlemock/test/gmock-matchers-comparisons_test.cc
+++ b/googlemock/test/gmock-matchers-comparisons_test.cc
@@ -589,8 +589,8 @@
class Base {
public:
- virtual ~Base() {}
- Base() {}
+ virtual ~Base() = default;
+ Base() = default;
private:
Base(const Base&) = delete;
diff --git a/googlemock/test/gmock-matchers-containers_test.cc b/googlemock/test/gmock-matchers-containers_test.cc
index 654a011..38fd9a5 100644
--- a/googlemock/test/gmock-matchers-containers_test.cc
+++ b/googlemock/test/gmock-matchers-containers_test.cc
@@ -2788,7 +2788,7 @@
class NativeArrayPassedAsPointerAndSize {
public:
- NativeArrayPassedAsPointerAndSize() {}
+ NativeArrayPassedAsPointerAndSize() = default;
MOCK_METHOD(void, Helper, (int* array, int size));
diff --git a/googlemock/test/gmock-nice-strict_test.cc b/googlemock/test/gmock-nice-strict_test.cc
index 08254e1..95f0969 100644
--- a/googlemock/test/gmock-nice-strict_test.cc
+++ b/googlemock/test/gmock-nice-strict_test.cc
@@ -40,7 +40,7 @@
// clash with ::testing::Mock.
class Mock {
public:
- Mock() {}
+ Mock() = default;
MOCK_METHOD0(DoThis, void());
@@ -78,7 +78,7 @@
class Foo {
public:
- virtual ~Foo() {}
+ virtual ~Foo() = default;
virtual void DoThis() = 0;
virtual int DoThat(bool flag) = 0;
@@ -86,7 +86,7 @@
class MockFoo : public Foo {
public:
- MockFoo() {}
+ MockFoo() = default;
void Delete() { delete this; }
MOCK_METHOD0(DoThis, void());
@@ -109,7 +109,7 @@
(a10 ? 'T' : 'F');
}
- virtual ~MockBar() {}
+ virtual ~MockBar() = default;
const std::string& str() const { return str_; }
diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc
index d53196b..7ba591a 100644
--- a/googlemock/test/gmock-spec-builders_test.cc
+++ b/googlemock/test/gmock-spec-builders_test.cc
@@ -98,7 +98,7 @@
class MockA {
public:
- MockA() {}
+ MockA() = default;
MOCK_METHOD1(DoA, void(int n));
MOCK_METHOD1(ReturnResult, Result(int n));
@@ -113,7 +113,7 @@
class MockB {
public:
- MockB() {}
+ MockB() = default;
MOCK_CONST_METHOD0(DoB, int()); // NOLINT
MOCK_METHOD1(DoB, int(int n)); // NOLINT
@@ -125,7 +125,7 @@
class ReferenceHoldingMock {
public:
- ReferenceHoldingMock() {}
+ ReferenceHoldingMock() = default;
MOCK_METHOD1(AcceptReference, void(std::shared_ptr<MockA>*));
@@ -143,12 +143,12 @@
class CC {
public:
- virtual ~CC() {}
+ virtual ~CC() = default;
virtual int Method() = 0;
};
class MockCC : public CC {
public:
- MockCC() {}
+ MockCC() = default;
MOCK_METHOD0(Method, int());
@@ -1881,7 +1881,7 @@
class MockC {
public:
- MockC() {}
+ MockC() = default;
MOCK_METHOD6(VoidMethod, void(bool cond, int n, std::string s, void* p,
const Printable& x, Unprintable y));
@@ -2121,7 +2121,7 @@
class LogTestHelper {
public:
- LogTestHelper() {}
+ LogTestHelper() = default;
MOCK_METHOD1(Foo, PrintMeNot(PrintMeNot));
diff --git a/googlemock/test/gmock_leak_test_.cc b/googlemock/test/gmock_leak_test_.cc
index fa64591..a6bb339 100644
--- a/googlemock/test/gmock_leak_test_.cc
+++ b/googlemock/test/gmock_leak_test_.cc
@@ -40,13 +40,13 @@
class FooInterface {
public:
- virtual ~FooInterface() {}
+ virtual ~FooInterface() = default;
virtual void DoThis() = 0;
};
class MockFoo : public FooInterface {
public:
- MockFoo() {}
+ MockFoo() = default;
MOCK_METHOD0(DoThis, void());
diff --git a/googlemock/test/gmock_link_test.h b/googlemock/test/gmock_link_test.h
index 8d2abb1..db11c2d 100644
--- a/googlemock/test/gmock_link_test.h
+++ b/googlemock/test/gmock_link_test.h
@@ -194,7 +194,7 @@
class Interface {
public:
- virtual ~Interface() {}
+ virtual ~Interface() = default;
virtual void VoidFromString(char* str) = 0;
virtual char* StringFromString(char* str) = 0;
virtual int IntFromString(char* str) = 0;
@@ -208,7 +208,7 @@
class Mock : public Interface {
public:
- Mock() {}
+ Mock() = default;
MOCK_METHOD1(VoidFromString, void(char* str));
MOCK_METHOD1(StringFromString, char*(char* str));
diff --git a/googlemock/test/gmock_output_test_.cc b/googlemock/test/gmock_output_test_.cc
index ca5a646..04a6e8b 100644
--- a/googlemock/test/gmock_output_test_.cc
+++ b/googlemock/test/gmock_output_test_.cc
@@ -53,7 +53,7 @@
class MockFoo {
public:
- MockFoo() {}
+ MockFoo() = default;
MOCK_METHOD3(Bar, char(const std::string& s, int i, double x));
MOCK_METHOD2(Bar2, bool(int x, int y));
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index d73d834..eae210e 100644
--- a/googletest/include/gtest/gtest-matchers.h
+++ b/googletest/include/gtest/gtest-matchers.h
@@ -107,13 +107,13 @@
MatchResultListener& operator=(const MatchResultListener&) = delete;
};
-inline MatchResultListener::~MatchResultListener() {}
+inline MatchResultListener::~MatchResultListener() = default;
// An instance of a subclass of this knows how to describe itself as a
// matcher.
class GTEST_API_ MatcherDescriberInterface {
public:
- virtual ~MatcherDescriberInterface() {}
+ virtual ~MatcherDescriberInterface() = default;
// Describes this matcher to an ostream. The function should print
// a verb phrase that describes the property a value matching this
@@ -494,7 +494,7 @@
class GTEST_API_ Matcher<const std::string&>
: public internal::MatcherBase<const std::string&> {
public:
- Matcher() {}
+ Matcher() = default;
explicit Matcher(const MatcherInterface<const std::string&>* impl)
: internal::MatcherBase<const std::string&>(impl) {}
@@ -516,7 +516,7 @@
class GTEST_API_ Matcher<std::string>
: public internal::MatcherBase<std::string> {
public:
- Matcher() {}
+ Matcher() = default;
explicit Matcher(const MatcherInterface<const std::string&>* impl)
: internal::MatcherBase<std::string>(impl) {}
@@ -544,7 +544,7 @@
class GTEST_API_ Matcher<const internal::StringView&>
: public internal::MatcherBase<const internal::StringView&> {
public:
- Matcher() {}
+ Matcher() = default;
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
: internal::MatcherBase<const internal::StringView&>(impl) {}
@@ -570,7 +570,7 @@
class GTEST_API_ Matcher<internal::StringView>
: public internal::MatcherBase<internal::StringView> {
public:
- Matcher() {}
+ Matcher() = default;
explicit Matcher(const MatcherInterface<const internal::StringView&>* impl)
: internal::MatcherBase<internal::StringView>(impl) {}
diff --git a/googletest/include/gtest/gtest-test-part.h b/googletest/include/gtest/gtest-test-part.h
index 8290b4d..41c8a9a 100644
--- a/googletest/include/gtest/gtest-test-part.h
+++ b/googletest/include/gtest/gtest-test-part.h
@@ -133,7 +133,7 @@
// virtual.
class GTEST_API_ TestPartResultArray {
public:
- TestPartResultArray() {}
+ TestPartResultArray() = default;
// Appends the given TestPartResult to the array.
void Append(const TestPartResult& result);
@@ -154,7 +154,7 @@
// This interface knows how to report a test part result.
class GTEST_API_ TestPartResultReporterInterface {
public:
- virtual ~TestPartResultReporterInterface() {}
+ virtual ~TestPartResultReporterInterface() = default;
virtual void ReportTestPartResult(const TestPartResult& result) = 0;
};
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h
index e543826..8412503 100644
--- a/googletest/include/gtest/gtest.h
+++ b/googletest/include/gtest/gtest.h
@@ -894,7 +894,7 @@
class Environment {
public:
// The d'tor is virtual as we need to subclass Environment.
- virtual ~Environment() {}
+ virtual ~Environment() = default;
// Override this to define how to set up the environment.
virtual void SetUp() {}
@@ -925,7 +925,7 @@
// the order the corresponding events are fired.
class TestEventListener {
public:
- virtual ~TestEventListener() {}
+ virtual ~TestEventListener() = default;
// Fired before any test activity starts.
virtual void OnTestProgramStart(const UnitTest& unit_test) = 0;
@@ -1671,7 +1671,7 @@
class WithParamInterface {
public:
typedef T ParamType;
- virtual ~WithParamInterface() {}
+ virtual ~WithParamInterface() = default;
// The current parameter value. Is also available in the test fixture's
// constructor.
diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h
index 522eed8..8e9c988 100644
--- a/googletest/include/gtest/internal/gtest-death-test-internal.h
+++ b/googletest/include/gtest/internal/gtest-death-test-internal.h
@@ -88,7 +88,7 @@
static bool Create(const char* statement, Matcher<const std::string&> matcher,
const char* file, int line, DeathTest** test);
DeathTest();
- virtual ~DeathTest() {}
+ virtual ~DeathTest() = default;
// A helper class that aborts a death test when it's deleted.
class ReturnSentinel {
@@ -153,7 +153,7 @@
// Factory interface for death tests. May be mocked out for testing.
class DeathTestFactory {
public:
- virtual ~DeathTestFactory() {}
+ virtual ~DeathTestFactory() = default;
virtual bool Create(const char* statement,
Matcher<const std::string&> matcher, const char* file,
int line, DeathTest** test) = 0;
diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h
index ae2ca95..317894e 100644
--- a/googletest/include/gtest/internal/gtest-internal.h
+++ b/googletest/include/gtest/internal/gtest-internal.h
@@ -435,7 +435,7 @@
// of a Test object.
class TestFactoryBase {
public:
- virtual ~TestFactoryBase() {}
+ virtual ~TestFactoryBase() = default;
// Creates a test instance to run. The instance is both created and destroyed
// within TestInfoImpl::Run()
diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h
index 50435f5..6a81c37 100644
--- a/googletest/include/gtest/internal/gtest-param-util.h
+++ b/googletest/include/gtest/internal/gtest-param-util.h
@@ -97,7 +97,7 @@
template <typename T>
class ParamIteratorInterface {
public:
- virtual ~ParamIteratorInterface() {}
+ virtual ~ParamIteratorInterface() = default;
// A pointer to the base generator instance.
// Used only for the purposes of iterator comparison
// to make sure that two iterators belong to the same generator.
@@ -171,7 +171,7 @@
public:
typedef T ParamType;
- virtual ~ParamGeneratorInterface() {}
+ virtual ~ParamGeneratorInterface() = default;
// Generator interface definition
virtual ParamIteratorInterface<T>* Begin() const = 0;
@@ -215,7 +215,7 @@
end_(end),
step_(step),
end_index_(CalculateEndIndex(begin, end, step)) {}
- ~RangeGenerator() override {}
+ ~RangeGenerator() override = default;
ParamIteratorInterface<T>* Begin() const override {
return new Iterator(this, begin_, 0, step_);
@@ -230,7 +230,7 @@
Iterator(const ParamGeneratorInterface<T>* base, T value, int index,
IncrementT step)
: base_(base), value_(value), index_(index), step_(step) {}
- ~Iterator() override {}
+ ~Iterator() override = default;
const ParamGeneratorInterface<T>* BaseGenerator() const override {
return base_;
@@ -299,7 +299,7 @@
template <typename ForwardIterator>
ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end)
: container_(begin, end) {}
- ~ValuesInIteratorRangeGenerator() override {}
+ ~ValuesInIteratorRangeGenerator() override = default;
ParamIteratorInterface<T>* Begin() const override {
return new Iterator(this, container_.begin());
@@ -316,7 +316,7 @@
Iterator(const ParamGeneratorInterface<T>* base,
typename ContainerType::const_iterator iterator)
: base_(base), iterator_(iterator) {}
- ~Iterator() override {}
+ ~Iterator() override = default;
const ParamGeneratorInterface<T>* BaseGenerator() const override {
return base_;
@@ -420,7 +420,7 @@
template <class ParamType>
class TestMetaFactoryBase {
public:
- virtual ~TestMetaFactoryBase() {}
+ virtual ~TestMetaFactoryBase() = default;
virtual TestFactoryBase* CreateTestFactory(ParamType parameter) = 0;
};
@@ -439,7 +439,7 @@
public:
using ParamType = typename TestSuite::ParamType;
- TestMetaFactory() {}
+ TestMetaFactory() = default;
TestFactoryBase* CreateTestFactory(ParamType parameter) override {
return new ParameterizedTestFactory<TestSuite>(parameter);
@@ -462,7 +462,7 @@
// and calls RegisterTests() on each of them when asked.
class ParameterizedTestSuiteInfoBase {
public:
- virtual ~ParameterizedTestSuiteInfoBase() {}
+ virtual ~ParameterizedTestSuiteInfoBase() = default;
// Base part of test suite name for display purposes.
virtual const std::string& GetTestSuiteName() const = 0;
@@ -691,7 +691,7 @@
// ParameterizedTestSuiteInfo descriptors.
class ParameterizedTestSuiteRegistry {
public:
- ParameterizedTestSuiteRegistry() {}
+ ParameterizedTestSuiteRegistry() = default;
~ParameterizedTestSuiteRegistry() {
for (auto& test_suite_info : test_suite_infos_) {
delete test_suite_info;
@@ -825,7 +825,7 @@
CartesianProductGenerator(const std::tuple<ParamGenerator<T>...>& g)
: generators_(g) {}
- ~CartesianProductGenerator() override {}
+ ~CartesianProductGenerator() override = default;
ParamIteratorInterface<ParamType>* Begin() const override {
return new Iterator(this, generators_, false);
@@ -850,7 +850,7 @@
current_(is_end ? end_ : begin_) {
ComputeCurrentValue();
}
- ~IteratorImpl() override {}
+ ~IteratorImpl() override = default;
const ParamGeneratorInterface<ParamType>* BaseGenerator() const override {
return base_;
@@ -969,7 +969,7 @@
: base_(base), it_(it), end_(end) {
if (it_ != end_) value_ = std::make_shared<To>(static_cast<To>(*it_));
}
- ~Iterator() override {}
+ ~Iterator() override = default;
const ParamGeneratorInterface<To>* BaseGenerator() const override {
return base_;
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 656a261..c6bc2d7 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -1328,7 +1328,7 @@
// problem.
class ThreadWithParamBase {
public:
- virtual ~ThreadWithParamBase() {}
+ virtual ~ThreadWithParamBase() = default;
virtual void Run() = 0;
};
@@ -1790,7 +1790,7 @@
// ThreadLocalValueHolderBase.
class GTEST_API_ ThreadLocalValueHolderBase {
public:
- virtual ~ThreadLocalValueHolderBase() {}
+ virtual ~ThreadLocalValueHolderBase() = default;
};
// Called by pthread to delete thread-local data stored by
@@ -1862,8 +1862,8 @@
class ValueHolderFactory {
public:
- ValueHolderFactory() {}
- virtual ~ValueHolderFactory() {}
+ ValueHolderFactory() = default;
+ virtual ~ValueHolderFactory() = default;
virtual ValueHolder* MakeNewHolder() const = 0;
private:
@@ -1873,7 +1873,7 @@
class DefaultValueHolderFactory : public ValueHolderFactory {
public:
- DefaultValueHolderFactory() {}
+ DefaultValueHolderFactory() = default;
ValueHolder* MakeNewHolder() const override { return new ValueHolder(); }
private:
diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h
index 08ad949..14c016a 100644
--- a/googletest/samples/prime_tables.h
+++ b/googletest/samples/prime_tables.h
@@ -39,7 +39,7 @@
// The prime table interface.
class PrimeTable {
public:
- virtual ~PrimeTable() {}
+ virtual ~PrimeTable() = default;
// Returns true if and only if n is a prime number.
virtual bool IsPrime(int n) const = 0;
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index 16841b5..0084971 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -407,8 +407,8 @@
// The role interface for getting the OS stack trace as a string.
class OsStackTraceGetterInterface {
public:
- OsStackTraceGetterInterface() {}
- virtual ~OsStackTraceGetterInterface() {}
+ OsStackTraceGetterInterface() = default;
+ virtual ~OsStackTraceGetterInterface() = default;
// Returns the current OS stack trace as an std::string. Parameters:
//
@@ -436,7 +436,7 @@
// A working implementation of the OsStackTraceGetterInterface interface.
class OsStackTraceGetter : public OsStackTraceGetterInterface {
public:
- OsStackTraceGetter() {}
+ OsStackTraceGetter() = default;
std::string CurrentStackTrace(int max_depth, int skip_count) override;
void UponLeavingGTest() override;
@@ -1064,7 +1064,7 @@
// Abstract base class for writing strings to a socket.
class AbstractSocketWriter {
public:
- virtual ~AbstractSocketWriter() {}
+ virtual ~AbstractSocketWriter() = default;
// Sends a string to the socket.
virtual void Send(const std::string& message) = 0;
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 01c0220..9fdca40 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -2241,7 +2241,7 @@
: death_test_count_(0), start_timestamp_(0), elapsed_time_(0) {}
// D'tor.
-TestResult::~TestResult() {}
+TestResult::~TestResult() = default;
// Returns the i-th test part result among all the results. i can
// range from 0 to total_part_count() - 1. If i is not in that range,
@@ -2450,7 +2450,7 @@
// The d'tor restores the states of all flags. The actual work is
// done by the d'tor of the gtest_flag_saver_ field, and thus not
// visible here.
-Test::~Test() {}
+Test::~Test() = default;
// Sets up the test fixture.
//
@@ -3362,7 +3362,7 @@
// Class PrettyUnitTestResultPrinter is copyable.
class PrettyUnitTestResultPrinter : public TestEventListener {
public:
- PrettyUnitTestResultPrinter() {}
+ PrettyUnitTestResultPrinter() = default;
static void PrintTestName(const char* test_suite, const char* test) {
printf("%s.%s", test_suite, test);
}
@@ -3670,7 +3670,7 @@
// Class BriefUnitTestResultPrinter is copyable.
class BriefUnitTestResultPrinter : public TestEventListener {
public:
- BriefUnitTestResultPrinter() {}
+ BriefUnitTestResultPrinter() = default;
static void PrintTestName(const char* test_suite, const char* test) {
printf("%s.%s", test_suite, test);
}
diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc
index 94bb8e3..32a2a7b 100644
--- a/googletest/test/googletest-port-test.cc
+++ b/googletest/test/googletest-port-test.cc
@@ -97,7 +97,7 @@
explicit Base(int n) : member_(n) {}
Base(const Base&) = default;
Base& operator=(const Base&) = default;
- virtual ~Base() {}
+ virtual ~Base() = default;
int member() { return member_; }
private:
@@ -982,7 +982,7 @@
class NoDefaultConstructor {
public:
explicit NoDefaultConstructor(const char*) {}
- NoDefaultConstructor(const NoDefaultConstructor&) {}
+ NoDefaultConstructor(const NoDefaultConstructor&) = default;
};
TEST(ThreadLocalTest, ValueDefaultContructorIsNotRequiredForParamVersion) {
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc
index e667e8f..f44f29a 100644
--- a/googletest/test/googletest-printers-test.cc
+++ b/googletest/test/googletest-printers-test.cc
@@ -108,7 +108,7 @@
// A user-defined streamable type in the global namespace.
class StreamableInGlobal {
public:
- virtual ~StreamableInGlobal() {}
+ virtual ~StreamableInGlobal() = default;
};
inline void operator<<(::std::ostream& os, const StreamableInGlobal& /* x */) {
@@ -216,7 +216,7 @@
using value_type = char;
using const_iterator = iterator;
- PathLike() {}
+ PathLike() = default;
iterator begin() const { return iterator(); }
iterator end() const { return iterator(); }
@@ -749,7 +749,7 @@
struct Foo {
public:
- virtual ~Foo() {}
+ virtual ~Foo() = default;
int MyMethod(char x) { return x + 1; }
virtual char MyVirtualMethod(int /* n */) { return 'a'; }
diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc
index 73fb8dc..f67b788 100644
--- a/googletest/test/gtest_repeat_test.cc
+++ b/googletest/test/gtest_repeat_test.cc
@@ -61,7 +61,7 @@
class MyEnvironment : public testing::Environment {
public:
- MyEnvironment() {}
+ MyEnvironment() = default;
void SetUp() override { g_environment_set_up_count++; }
void TearDown() override { g_environment_tear_down_count++; }
};
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 57041f0..1fde827 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -4951,7 +4951,7 @@
// both in a TEST and in a TEST_F.
class Foo {
public:
- Foo() {}
+ Foo() = default;
private:
int Bar() const { return 1; }