diff --git a/src/plugins/cppeditor/cppchecksymbols.cpp b/src/plugins/cppeditor/cppchecksymbols.cpp index 8b1deeac605..e3ac38221c6 100644 --- a/src/plugins/cppeditor/cppchecksymbols.cpp +++ b/src/plugins/cppeditor/cppchecksymbols.cpp @@ -43,6 +43,8 @@ #include #include +#include + #include #include #include @@ -284,7 +286,7 @@ protected: CheckSymbols::Future CheckSymbols::go(Document::Ptr doc, const LookupContext &context) { - Q_ASSERT(doc); + QTC_ASSERT(doc, return Future()); return (new CheckSymbols(doc, context))->start(); } diff --git a/src/plugins/cppeditor/cppinsertdecldef.cpp b/src/plugins/cppeditor/cppinsertdecldef.cpp index 4a4f4ffa9e5..62005a0d6b1 100644 --- a/src/plugins/cppeditor/cppinsertdecldef.cpp +++ b/src/plugins/cppeditor/cppinsertdecldef.cpp @@ -95,7 +95,7 @@ public: InsertionPointLocator locator(refactoring); const InsertionLocation loc = locator.methodDeclarationInClass( m_targetFileName, m_targetSymbol, m_xsSpec); - Q_ASSERT(loc.isValid()); + QTC_ASSERT(loc.isValid(), return); CppRefactoringFilePtr targetFile = refactoring.file(m_targetFileName); int targetPosition1 = targetFile->position(loc.line(), loc.column()); @@ -120,12 +120,12 @@ private: Class *isMemberFunction(const LookupContext &context, Function *function) { - Q_ASSERT(function); + QTC_ASSERT(function, return 0); Scope *enclosingScope = function->enclosingScope(); while (! (enclosingScope->isNamespace() || enclosingScope->isClass())) enclosingScope = enclosingScope->enclosingScope(); - Q_ASSERT(enclosingScope != 0); + QTC_ASSERT(enclosingScope != 0, return 0); const Name *functionName = function->name(); if (! functionName) @@ -245,7 +245,7 @@ public: void performChanges(const CppRefactoringFilePtr &, const CppRefactoringChanges &refactoring) { - Q_ASSERT(m_loc.isValid()); + QTC_ASSERT(m_loc.isValid(), return); CppRefactoringFilePtr targetFile = refactoring.file(m_loc.fileName()); diff --git a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp index 2834ec3720b..49653864fd7 100644 --- a/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp +++ b/src/plugins/cppeditor/cppinsertqtpropertymembers.cpp @@ -42,6 +42,8 @@ #include #include +#include + #include using namespace CPlusPlus; @@ -159,7 +161,7 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile const QString getterDeclaration = typeName + QLatin1Char(' ') + m_getterName + QLatin1String("() const\n{\nreturn ") + m_storageName + QLatin1String(";\n}\n"); InsertionLocation getterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::Public); - Q_ASSERT(getterLoc.isValid()); + QTC_ASSERT(getterLoc.isValid(), return); insertAndIndent(file, &declarations, getterLoc, getterDeclaration); } @@ -176,7 +178,7 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile << " = arg;\nemit " << m_signalName << "(arg);\n}\n}\n"; } InsertionLocation setterLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::PublicSlot); - Q_ASSERT(setterLoc.isValid()); + QTC_ASSERT(setterLoc.isValid(), return); insertAndIndent(file, &declarations, setterLoc, setterDeclaration); } @@ -185,7 +187,7 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile const QString declaration = QLatin1String("void ") + m_signalName + QLatin1Char('(') + typeName + QLatin1String(" arg);\n"); InsertionLocation loc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::Signals); - Q_ASSERT(loc.isValid()); + QTC_ASSERT(loc.isValid(), return); insertAndIndent(file, &declarations, loc, declaration); } @@ -194,7 +196,7 @@ void InsertQtPropertyMembers::Operation::performChanges(const CppRefactoringFile const QString storageDeclaration = typeName + QLatin1String(" m_") + propertyName + QLatin1String(";\n"); InsertionLocation storageLoc = locator.methodDeclarationInClass(file->fileName(), m_class, InsertionPointLocator::Private); - Q_ASSERT(storageLoc.isValid()); + QTC_ASSERT(storageLoc.isValid(), return); insertAndIndent(file, &declarations, storageLoc, storageDeclaration); } diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp index 0c2a592ab3b..09435037da2 100644 --- a/src/plugins/cppeditor/cppoutline.cpp +++ b/src/plugins/cppeditor/cppoutline.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -206,7 +207,7 @@ TextEditor::IOutlineWidget *CppOutlineWidgetFactory::createWidget(Core::IEditor { CPPEditor *cppEditor = qobject_cast(editor); CPPEditorWidget *cppEditorWidget = qobject_cast(cppEditor->widget()); - Q_ASSERT(cppEditorWidget); + QTC_ASSERT(cppEditorWidget, return 0); CppOutlineWidget *widget = new CppOutlineWidget(cppEditorWidget); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index a75ef11f16a..17aa1f593c6 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -1551,7 +1551,7 @@ private: virtual void performChanges(const CppRefactoringFilePtr ¤tFile, const CppRefactoringChanges &) { - Q_ASSERT(fwdClass != 0); + QTC_ASSERT(fwdClass != 0, return); CppTools::SymbolFinder symbolFinder; if (Class *k = diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 74d63e62563..50df0e1be6e 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -319,14 +320,14 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) case else_clause: // ### shouldn't happen dump(); - Q_ASSERT(false); + QTC_CHECK(false); leave(true); break; case do_statement: // ### shouldn't happen dump(); - Q_ASSERT(false); + QTC_CHECK(false); leave(true); break; @@ -649,7 +650,7 @@ void CodeFormatter::enter(int newState) void CodeFormatter::leave(bool statementDone) { - Q_ASSERT(m_currentState.size() > 1); + QTC_ASSERT(m_currentState.size() > 1, return); if (m_currentState.top().type == topmost_intro) return; @@ -688,7 +689,7 @@ void CodeFormatter::leave(bool statementDone) void CodeFormatter::correctIndentation(const QTextBlock &block) { const int lexerState = tokenizeBlock(block); - Q_ASSERT(m_currentState.size() >= 1); + QTC_ASSERT(m_currentState.size() >= 1, return); adjustIndent(m_tokens, lexerState, &m_indentDepth, &m_paddingDepth); } @@ -979,7 +980,7 @@ int CodeFormatter::tokenizeBlock(const QTextBlock &block, bool *endedJoined) int startState = loadLexerState(block.previous()); if (block.blockNumber() == 0) startState = 0; - Q_ASSERT(startState != -1); + QTC_ASSERT(startState != -1, return 0); SimpleLexer tokenize; tokenize.setQtMocRunEnabled(true); diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index cd6e14be59e..57f2d3e2d66 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -69,6 +69,7 @@ #include #include #include +#include #include #include @@ -1250,7 +1251,7 @@ int CppCompletionAssistProcessor::startCompletionInternal(const QString fileName m_model->m_typeOfExpression->init(thisDocument, m_interface->snapshot()); Scope *scope = thisDocument->scopeAt(line, column); - Q_ASSERT(scope != 0); + QTC_ASSERT(scope != 0, return -1); if (expression.isEmpty()) { if (m_model->m_completionOperator == T_EOF_SYMBOL || m_model->m_completionOperator == T_COLON_COLON) { diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 3f797943605..d59191a5c1b 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -196,7 +196,7 @@ static void find_helper(QFutureInterface &future, Symbol *symbol) { const Identifier *symbolId = symbol->identifier(); - Q_ASSERT(symbolId != 0); + QTC_ASSERT(symbolId != 0, return); const Snapshot snapshot = context.snapshot(); diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp index b75fa51c0e8..2823ede9324 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.cpp +++ b/src/plugins/cpptools/cpprefactoringchanges.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -242,7 +243,7 @@ int CppRefactoringFile::endOf(unsigned index) const int CppRefactoringFile::endOf(const AST *ast) const { unsigned end = ast->lastToken(); - Q_ASSERT(end > 0); + QTC_ASSERT(end > 0, return -1); return endOf(end - 1); } diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index c08b639e47f..c21cb9b5ed8 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -325,7 +326,7 @@ QString CppToolsPlugin::correspondingHeaderOrSourceI(const QString &fileName) co } if (!bestFileName.isEmpty()) { const QFileInfo candidateFi(bestFileName); - Q_ASSERT(candidateFi.isFile()); + QTC_ASSERT(candidateFi.isFile(), return QString()); m_headerSourceMapping[fi.absoluteFilePath()] = candidateFi.absoluteFilePath(); m_headerSourceMapping[candidateFi.absoluteFilePath()] = fi.absoluteFilePath(); return candidateFi.absoluteFilePath(); diff --git a/src/plugins/cpptools/doxygengenerator.cpp b/src/plugins/cpptools/doxygengenerator.cpp index 9883ceb322d..9b2e5aaee3e 100644 --- a/src/plugins/cpptools/doxygengenerator.cpp +++ b/src/plugins/cpptools/doxygengenerator.cpp @@ -10,6 +10,8 @@ #include #include +#include + #include #include #include @@ -220,7 +222,7 @@ QString DoxygenGenerator::commandSpelling(Command command) if (command == ReturnCommand) return QLatin1String("return "); - Q_ASSERT(command == BriefCommand); + QTC_ASSERT(command == BriefCommand, return QString()); return QLatin1String("brief "); } diff --git a/src/plugins/cpptools/insertionpointlocator.cpp b/src/plugins/cpptools/insertionpointlocator.cpp index 64ccb8ed4c6..63b884d47fe 100644 --- a/src/plugins/cpptools/insertionpointlocator.cpp +++ b/src/plugins/cpptools/insertionpointlocator.cpp @@ -44,6 +44,8 @@ #include #include +#include + using namespace CPlusPlus; using namespace CppTools; @@ -173,7 +175,7 @@ protected: bool &needsPrefix, bool &needsSuffix) { - Q_ASSERT(!ranges.isEmpty()); + QTC_ASSERT(!ranges.isEmpty(), return); const int lastIndex = ranges.size() - 1; // try an exact match, and ignore the first (default) access spec: @@ -349,7 +351,7 @@ public: const Value &get() const { - Q_ASSERT(_set); + QTC_ASSERT(_set, return Value()); return _value; } }; diff --git a/src/plugins/cpptools/symbolfinder.cpp b/src/plugins/cpptools/symbolfinder.cpp index 9d84339de62..ffcbb27d9ff 100644 --- a/src/plugins/cpptools/symbolfinder.cpp +++ b/src/plugins/cpptools/symbolfinder.cpp @@ -13,6 +13,8 @@ #include +#include + #include #include @@ -218,7 +220,7 @@ void SymbolFinder::findMatchingDeclaration(const LookupContext &context, Scope *enclosingScope = functionType->enclosingScope(); while (! (enclosingScope->isNamespace() || enclosingScope->isClass())) enclosingScope = enclosingScope->enclosingScope(); - Q_ASSERT(enclosingScope != 0); + QTC_ASSERT(enclosingScope != 0, return); const Name *functionName = functionType->name(); if (! functionName)