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ý committed 2018-07-23 14:00:44 +02:00
1 parent b93284716e
commit 78804ea304
2 files changed
+6 -5

No files matched your search

+2 -2
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) {}