Mark some extra classes final

This commit is contained in:
Martin Hořeňovský
2026-04-07 00:13:17 +02:00
parent b670de4fe1
commit 548e14a8c8
11 changed files with 14 additions and 14 deletions
@@ -41,7 +41,7 @@ namespace Catch {
callable& operator=(callable&&) = default;
};
template <typename Fun>
struct model : public callable {
struct model final : public callable {
model(Fun&& fun_) : fun(CATCH_MOVE(fun_)) {}
model(Fun const& fun_) : fun(fun_) {}
@@ -14,7 +14,7 @@
namespace Catch {
namespace Benchmark {
namespace Detail {
struct optimized_away_error : std::exception {
struct optimized_away_error final : std::exception {
const char* what() const noexcept override;
};
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Catch {
class ExceptionTranslatorRegistrar {
template<typename T>
class ExceptionTranslator : public IExceptionTranslator {
class ExceptionTranslator final : public IExceptionTranslator {
public:
constexpr ExceptionTranslator( std::string(*translateFunction)( T const& ) )
+2 -2
View File
@@ -193,7 +193,7 @@ namespace Catch {
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
template<typename LhsT, typename RhsT>
class BinaryExpr : public ITransientExpression {
class BinaryExpr final : public ITransientExpression {
LhsT m_lhs;
StringRef m_op;
RhsT m_rhs;
@@ -269,7 +269,7 @@ namespace Catch {
};
template<typename LhsT>
class UnaryExpr : public ITransientExpression {
class UnaryExpr final : public ITransientExpression {
LhsT m_lhs;
void streamReconstructedExpression( std::ostream &os ) const override {
@@ -20,7 +20,7 @@ namespace Catch {
Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );
class EnumValuesRegistry : public IMutableEnumValuesRegistry {
class EnumValuesRegistry final : public IMutableEnumValuesRegistry {
std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos;
@@ -15,7 +15,7 @@
namespace Catch {
class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {
class ExceptionTranslatorRegistry final : public IExceptionTranslatorRegistry {
public:
~ExceptionTranslatorRegistry() override;
void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator );
@@ -33,7 +33,7 @@ namespace Catch {
namespace {
//! A no-op implementation, used if no reporter wants output
//! redirection.
class NoopRedirect : public OutputRedirect {
class NoopRedirect final : public OutputRedirect {
void activateImpl() override {}
void deactivateImpl() override {}
std::string getStdout() override { return {}; }
@@ -70,7 +70,7 @@ namespace Catch {
* Redirects the `std::cout`, `std::cerr`, `std::clog` streams,
* but does not touch the actual `stdout`/`stderr` file descriptors.
*/
class StreamRedirect : public OutputRedirect {
class StreamRedirect final : public OutputRedirect {
ReusableStringStream m_redirectedOut, m_redirectedErr;
RedirectedStreamNew m_cout, m_cerr, m_clog;
@@ -181,7 +181,7 @@ namespace Catch {
* Works by replacing the file descriptors numbered 1 and 2
* with an open temporary file.
*/
class FileRedirect : public OutputRedirect {
class FileRedirect final : public OutputRedirect {
TempFile m_outFile, m_errFile;
int m_originalOut = -1;
int m_originalErr = -1;
+1 -1
View File
@@ -20,7 +20,7 @@ namespace Catch {
template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT>
class Singleton : SingletonImplT, public ISingleton {
class Singleton final : SingletonImplT, public ISingleton {
static auto getInternal() -> Singleton* {
static Singleton* s_instance = nullptr;
@@ -17,7 +17,7 @@
namespace Catch {
struct SourceLineInfo;
class TagAliasRegistry : public ITagAliasRegistry {
class TagAliasRegistry final : public ITagAliasRegistry {
public:
~TagAliasRegistry() override;
TagAlias const* find( std::string const& alias ) const override;
@@ -28,7 +28,7 @@ namespace Catch {
std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config );
std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config );
class TestRegistry : public ITestCaseRegistry {
class TestRegistry final : public ITestCaseRegistry {
public:
void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker );
@@ -29,7 +29,7 @@ namespace Catch {
#endif
template<typename ArgT, typename MatcherT>
class MatchExpr : public ITransientExpression {
class MatchExpr final : public ITransientExpression {
ArgT && m_arg;
MatcherT const& m_matcher;
public: