Skip to content

Commit 8657189

Browse files
committed
WIP: lazy clear of unscoped messages
1 parent 016894f commit 8657189

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/catch2/internal/catch_run_context.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ namespace Catch {
296296
}
297297

298298
{
299+
if ( m_clearMessageScopes ) {
300+
m_messageScopes.clear();
301+
m_clearMessageScopes = false;
302+
}
299303
auto _ = scopedDeactivate( *m_outputRedirect );
300304
m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );
301305
}
@@ -524,9 +528,10 @@ namespace Catch {
524528

525529
void RunContext::assertionPassedFastPath(SourceLineInfo lineInfo) {
526530
m_lastKnownLineInfo = lineInfo;
527-
m_lastAssertionPassed = true;
528531
++m_totals.assertions.passed;
529-
m_messageScopes.clear();
532+
m_lastAssertionPassed = true;
533+
m_clearMessageScopes = true;
534+
//m_messageScopes.clear();
530535
}
531536

532537
bool RunContext::aborting() const {

src/catch2/internal/catch_run_context.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ namespace Catch {
158158
// Caches m_config->abortAfter() to avoid vptr calls/allow inlining
159159
size_t m_abortAfterXFailedAssertions;
160160
bool m_lastAssertionPassed = false;
161+
bool m_clearMessageScopes = false;
161162
bool m_shouldReportUnexpected = true;
162163
// Caches whether `assertionStarting` events should be sent to the reporter.
163164
bool m_reportAssertionStarting;

0 commit comments

Comments
 (0)