Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal/catch_section.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2023-01-28 13:00:24 +0100
committerMartin Hořeňovský2023-01-28 13:00:30 +0100
commit2403f5620e60b41d84e35a88bacbb8bd8e1d92a8 (patch)
treeb26a699a75f717f8dec9a8b86dbaf35556bd0956 /src/catch2/internal/catch_section.cpp
parentd58491c85a534a9348634ac3e4eb384df22f4d71 (diff)
downloadcatch3-2403f5620e60b41d84e35a88bacbb8bd8e1d92a8.tar.gz
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.
Diffstat (limited to 'src/catch2/internal/catch_section.cpp')
-rw-r--r--src/catch2/internal/catch_section.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/catch2/internal/catch_section.cpp b/src/catch2/internal/catch_section.cpp
index 63b4abd3..9d110dfa 100644
--- a/src/catch2/internal/catch_section.cpp
+++ b/src/catch2/internal/catch_section.cpp
@@ -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 ) );
+ }
}
}