Cleanup for performance reasons

* Eliminated some copies
* Made makeTestCase fit into 4 arguments -- avoids spills on Win64
* Made string literals into StringRef literals
This commit is contained in:
Martin Hořeňovský 2018-03-02 16:22:18 +01:00
parent 865d5f59b4
commit d2ddb997a7
8 changed files with 21 additions and 22 deletions

View file

@ -48,8 +48,7 @@ namespace Catch {
TestCase makeTestCase( ITestInvoker* _testCase,
std::string const& _className,
std::string const& _name,
std::string const& _descOrTags,
NameAndTags const& nameAndTags,
SourceLineInfo const& _lineInfo )
{
bool isHidden = false;
@ -58,6 +57,7 @@ namespace Catch {
std::vector<std::string> tags;
std::string desc, tag;
bool inTag = false;
std::string _descOrTags = nameAndTags.tags;
for (char c : _descOrTags) {
if( !inTag ) {
if( c == '[' )
@ -85,8 +85,8 @@ namespace Catch {
tags.push_back( "." );
}
TestCaseInfo info( _name, _className, desc, tags, _lineInfo );
return TestCase( _testCase, info );
TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo );
return TestCase( _testCase, std::move(info) );
}
void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {
@ -147,7 +147,7 @@ namespace Catch {
}
TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo const& info ) : TestCaseInfo( info ), test( testCase ) {}
TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {}
TestCase TestCase::withName( std::string const& _newName ) const {