mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Anchor some Clara vtables into the cpp file
Anchoring the vtables does 2 things 1) Fixes some instances of `-Wweak-vtables` 2) Decreases code size and linker pressure However, there are still some unanchored ones, and thus we have to keep suppressing `-Wweak-vtables` warning for Clang.
This commit is contained in:
parent
7500ad1ffd
commit
24559493bf
@ -111,6 +111,8 @@ namespace Catch {
|
|||||||
return ParserResult::ok( ParseResultType::Matched );
|
return ParserResult::ok( ParseResultType::Matched );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t ParserBase::cardinality() const { return 1; }
|
||||||
|
|
||||||
InternalParseResult ParserBase::parse( Args const& args ) const {
|
InternalParseResult ParserBase::parse( Args const& args ) const {
|
||||||
return parse( args.exeName(), TokenStream( args ) );
|
return parse( args.exeName(), TokenStream( args ) );
|
||||||
}
|
}
|
||||||
@ -124,6 +126,14 @@ namespace Catch {
|
|||||||
return ParserResult::ok( ParseResultType::Matched );
|
return ParserResult::ok( ParseResultType::Matched );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ResultBase::~ResultBase() = default;
|
||||||
|
|
||||||
|
bool BoundRef::isContainer() const { return false; }
|
||||||
|
|
||||||
|
bool BoundRef::isFlag() const { return false; }
|
||||||
|
|
||||||
|
bool BoundFlagRefBase::isFlag() const { return true; }
|
||||||
|
|
||||||
} // namespace Detail
|
} // namespace Detail
|
||||||
|
|
||||||
Detail::InternalParseResult Arg::parse(std::string const&,
|
Detail::InternalParseResult Arg::parse(std::string const&,
|
||||||
|
@ -132,7 +132,13 @@ namespace Catch {
|
|||||||
class ResultBase {
|
class ResultBase {
|
||||||
protected:
|
protected:
|
||||||
ResultBase( ResultType type ): m_type( type ) {}
|
ResultBase( ResultType type ): m_type( type ) {}
|
||||||
virtual ~ResultBase() = default;
|
virtual ~ResultBase(); // = default;
|
||||||
|
|
||||||
|
|
||||||
|
ResultBase(ResultBase const&) = default;
|
||||||
|
ResultBase& operator=(ResultBase const&) = default;
|
||||||
|
ResultBase(ResultBase&&) = default;
|
||||||
|
ResultBase& operator=(ResultBase&&) = default;
|
||||||
|
|
||||||
virtual void enforceOk() const = 0;
|
virtual void enforceOk() const = 0;
|
||||||
|
|
||||||
@ -295,8 +301,8 @@ namespace Catch {
|
|||||||
|
|
||||||
struct BoundRef : Catch::Detail::NonCopyable {
|
struct BoundRef : Catch::Detail::NonCopyable {
|
||||||
virtual ~BoundRef() = default;
|
virtual ~BoundRef() = default;
|
||||||
virtual auto isContainer() const -> bool { return false; }
|
virtual bool isContainer() const;
|
||||||
virtual auto isFlag() const -> bool { return false; }
|
virtual bool isFlag() const;
|
||||||
};
|
};
|
||||||
struct BoundValueRefBase : BoundRef {
|
struct BoundValueRefBase : BoundRef {
|
||||||
virtual auto setValue( std::string const& arg )
|
virtual auto setValue( std::string const& arg )
|
||||||
@ -304,7 +310,7 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
struct BoundFlagRefBase : BoundRef {
|
struct BoundFlagRefBase : BoundRef {
|
||||||
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
virtual auto setFlag( bool flag ) -> ParserResult = 0;
|
||||||
bool isFlag() const override { return true; }
|
bool isFlag() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T> struct BoundValueRef : BoundValueRefBase {
|
template <typename T> struct BoundValueRef : BoundValueRefBase {
|
||||||
@ -312,8 +318,7 @@ namespace Catch {
|
|||||||
|
|
||||||
explicit BoundValueRef( T& ref ): m_ref( ref ) {}
|
explicit BoundValueRef( T& ref ): m_ref( ref ) {}
|
||||||
|
|
||||||
auto setValue( std::string const& arg )
|
ParserResult setValue( std::string const& arg ) override {
|
||||||
-> ParserResult override {
|
|
||||||
return convertInto( arg, m_ref );
|
return convertInto( arg, m_ref );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -419,7 +424,7 @@ namespace Catch {
|
|||||||
virtual auto parse( std::string const& exeName,
|
virtual auto parse( std::string const& exeName,
|
||||||
TokenStream const& tokens ) const
|
TokenStream const& tokens ) const
|
||||||
-> InternalParseResult = 0;
|
-> InternalParseResult = 0;
|
||||||
virtual auto cardinality() const -> size_t { return 1; }
|
virtual size_t cardinality() const;
|
||||||
|
|
||||||
InternalParseResult parse( Args const& args ) const;
|
InternalParseResult parse( Args const& args ) const;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user