ITracker::parent returns pointer not reference

We were already using it mostly to get pointers rather than
references, so this makes it make more sense.
This commit is contained in:
Martin Hořeňovský 2021-06-09 22:01:49 +02:00
parent 4ce8a23edd
commit a14d67cace
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
3 changed files with 7 additions and 7 deletions

View File

@ -50,7 +50,7 @@ namespace Catch {
// without it, the code above creates 5 nested generators. // without it, the code above creates 5 nested generators.
if ( currentTracker.nameAndLocation() == nameAndLocation ) { if ( currentTracker.nameAndLocation() == nameAndLocation ) {
auto thisTracker = auto thisTracker =
currentTracker.parent().findChild( nameAndLocation ); currentTracker.parent()->findChild( nameAndLocation );
assert( thisTracker ); assert( thisTracker );
assert( thisTracker->isGeneratorTracker() ); assert( thisTracker->isGeneratorTracker() );
tracker = static_cast<GeneratorTracker*>( thisTracker ); tracker = static_cast<GeneratorTracker*>( thisTracker );
@ -110,7 +110,7 @@ namespace Catch {
// This is safe: there is always at least one section // This is safe: there is always at least one section
// tracker in a test case tracking tree // tracker in a test case tracking tree
while ( !parent->isSectionTracker() ) { while ( !parent->isSectionTracker() ) {
parent = &( parent->parent() ); parent = parent->parent();
} }
assert( parent && assert( parent &&
"Missing root (test case) level section" ); "Missing root (test case) level section" );

View File

@ -99,9 +99,9 @@ namespace TestCaseTracking {
return m_runState != NotStarted && !isComplete(); return m_runState != NotStarted && !isComplete();
} }
ITracker& TrackerBase::parent() { ITracker* TrackerBase::parent() {
assert( m_parent ); // Should always be non-null except for root assert( m_parent ); // Should always be non-null except for root
return *m_parent; return m_parent;
} }
void TrackerBase::openChild() { void TrackerBase::openChild() {
@ -176,7 +176,7 @@ namespace TestCaseTracking {
{ {
if( parent ) { if( parent ) {
while( !parent->isSectionTracker() ) while( !parent->isSectionTracker() )
parent = &parent->parent(); parent = parent->parent();
SectionTracker& parentSection = static_cast<SectionTracker&>( *parent ); SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
addNextFilters( parentSection.m_filters ); addNextFilters( parentSection.m_filters );

View File

@ -60,7 +60,7 @@ namespace TestCaseTracking {
virtual bool isOpen() const = 0; // Started but not complete virtual bool isOpen() const = 0; // Started but not complete
virtual bool hasStarted() const = 0; virtual bool hasStarted() const = 0;
virtual ITracker& parent() = 0; virtual ITracker* parent() = 0;
// actions // actions
virtual void close() = 0; // Successfully complete virtual void close() = 0; // Successfully complete
@ -138,7 +138,7 @@ namespace TestCaseTracking {
return m_runState != NotStarted; return m_runState != NotStarted;
} }
ITracker& parent() override; ITracker* parent() override;
void openChild() override; void openChild() override;