Move SectionEndInfo into sectionEnded call in SECTION's destructor

When running `./tests/SelfTest -o /dev/null`, this saves 1272
allocations (437439 -> 437167). In general, this saves multiple
allocations per end of an entered `SECTION`, if the section name
was too long for SSO, because `RunContext::sectionEnded` can then
move the section's name further down the callstack.
This commit is contained in:
Martin Hořeňovský committed 2023-01-28 13:00:30 +01:00
1 parent d58491c85a
commit 2403f5620e
7 files changed
+24 -21

No files matched your search

+5 -4
View File
@@ -26,10 +26,11 @@ namespace Catch {
Section::~Section() {
if( m_sectionIncluded ) {
SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() };
if( uncaught_exceptions() )
getResultCapture().sectionEndedEarly( endInfo );
else
getResultCapture().sectionEnded( endInfo );
if ( uncaught_exceptions() ) {
getResultCapture().sectionEndedEarly( CATCH_MOVE(endInfo) );
} else {
getResultCapture().sectionEnded( CATCH_MOVE( endInfo ) );
}
}
}