Add QTC_GUARD

Similar to QTC_CHECK, but has the boolean result of the condition as
value. Use it in the form

if (QTC_GUARD(condition)) { ... }

Replace some occurrences of

QTC_CHECK(condition)
if (condition) { .... }

Change-Id: I8eea02f869eb7a183dfbf4810dace48097880519
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Eike Ziller
2016-04-15 15:21:26 +02:00
committed by Eike Ziller
parent 9ac313d8cf
commit a6aafe3c45
8 changed files with 9 additions and 16 deletions

View File

@@ -103,8 +103,7 @@ void SemanticHighlighter::onHighlighterFinished()
QTC_ASSERT(m_watcher, return);
if (!m_watcher->isCanceled() && documentRevision() == m_revision) {
SyntaxHighlighter *highlighter = m_baseTextDocument->syntaxHighlighter();
QTC_CHECK(highlighter);
if (highlighter) {
if (QTC_GUARD(highlighter)) {
qCDebug(log) << "onHighlighterFinished() - clearing formats";
clearExtraAdditionalFormatsUntilEnd(highlighter, m_watcher->future());
}