mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Avoid copying NameAndLocationRef when passed as argument
`NameAndLocationRef` is pretty large type, so even in release build, it is unlikely to be passed in registers. In addition to the fact that some platforms currently do not allow passing even small types in register (Windows ABI!!), it is better to pass it as a ref, effectively passing around a pointer.
This commit is contained in:
parent
e1dbad4c9e
commit
4f7c8cb28a
@ -34,7 +34,7 @@ namespace Catch {
|
|||||||
{}
|
{}
|
||||||
~GeneratorTracker() override;
|
~GeneratorTracker() override;
|
||||||
|
|
||||||
static GeneratorTracker* acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocationRef nameAndLocation ) {
|
static GeneratorTracker* acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocationRef const& nameAndLocation ) {
|
||||||
GeneratorTracker* tracker;
|
GeneratorTracker* tracker;
|
||||||
|
|
||||||
ITracker& currentTracker = ctx.currentTracker();
|
ITracker& currentTracker = ctx.currentTracker();
|
||||||
|
@ -38,7 +38,7 @@ namespace TestCaseTracking {
|
|||||||
m_children.push_back( CATCH_MOVE(child) );
|
m_children.push_back( CATCH_MOVE(child) );
|
||||||
}
|
}
|
||||||
|
|
||||||
ITracker* ITracker::findChild( NameAndLocationRef nameAndLocation ) {
|
ITracker* ITracker::findChild( NameAndLocationRef const& nameAndLocation ) {
|
||||||
auto it = std::find_if(
|
auto it = std::find_if(
|
||||||
m_children.begin(),
|
m_children.begin(),
|
||||||
m_children.end(),
|
m_children.end(),
|
||||||
@ -177,7 +177,7 @@ namespace TestCaseTracking {
|
|||||||
|
|
||||||
bool SectionTracker::isSectionTracker() const { return true; }
|
bool SectionTracker::isSectionTracker() const { return true; }
|
||||||
|
|
||||||
SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef nameAndLocation ) {
|
SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ) {
|
||||||
SectionTracker* tracker;
|
SectionTracker* tracker;
|
||||||
|
|
||||||
ITracker& currentTracker = ctx.currentTracker();
|
ITracker& currentTracker = ctx.currentTracker();
|
||||||
|
@ -49,11 +49,11 @@ namespace TestCaseTracking {
|
|||||||
name( name_ ), location( location_ ) {}
|
name( name_ ), location( location_ ) {}
|
||||||
|
|
||||||
friend bool operator==( NameAndLocation const& lhs,
|
friend bool operator==( NameAndLocation const& lhs,
|
||||||
NameAndLocationRef rhs ) {
|
NameAndLocationRef const& rhs ) {
|
||||||
return StringRef( lhs.name ) == rhs.name &&
|
return StringRef( lhs.name ) == rhs.name &&
|
||||||
lhs.location == rhs.location;
|
lhs.location == rhs.location;
|
||||||
}
|
}
|
||||||
friend bool operator==( NameAndLocationRef lhs,
|
friend bool operator==( NameAndLocationRef const& lhs,
|
||||||
NameAndLocation const& rhs ) {
|
NameAndLocation const& rhs ) {
|
||||||
return rhs == lhs;
|
return rhs == lhs;
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ namespace TestCaseTracking {
|
|||||||
*
|
*
|
||||||
* Returns nullptr if not found.
|
* Returns nullptr if not found.
|
||||||
*/
|
*/
|
||||||
ITracker* findChild( NameAndLocationRef nameAndLocation );
|
ITracker* findChild( NameAndLocationRef const& nameAndLocation );
|
||||||
//! Have any children been added?
|
//! Have any children been added?
|
||||||
bool hasChildren() const {
|
bool hasChildren() const {
|
||||||
return !m_children.empty();
|
return !m_children.empty();
|
||||||
@ -212,7 +212,7 @@ namespace TestCaseTracking {
|
|||||||
|
|
||||||
bool isComplete() const override;
|
bool isComplete() const override;
|
||||||
|
|
||||||
static SectionTracker& acquire( TrackerContext& ctx, NameAndLocationRef nameAndLocation );
|
static SectionTracker& acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation );
|
||||||
|
|
||||||
void tryOpen();
|
void tryOpen();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user