Replace std::string with StringRef in MessageInfo for macro capture

Because the macro name is compile-time constant, we do not have to
worry about lifetimes and will avoid allocation in case of missing
SSO or long macro name.
This commit is contained in:
Martin Hořeňovský 2018-07-23 13:42:44 +02:00
parent b93284716e
commit 78804ea304
2 changed files with 6 additions and 5 deletions

View file

@ -12,7 +12,7 @@
namespace Catch {
MessageInfo::MessageInfo( std::string const& _macroName,
MessageInfo::MessageInfo( StringRef const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type )
: macroName( _macroName ),
@ -35,7 +35,7 @@ namespace Catch {
////////////////////////////////////////////////////////////////////////////
Catch::MessageBuilder::MessageBuilder( std::string const& macroName,
Catch::MessageBuilder::MessageBuilder( StringRef const& macroName,
SourceLineInfo const& lineInfo,
ResultWas::OfType type )
:m_info(macroName, lineInfo, type) {}