Commit fdfae53a authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Don't use QTC_ASSERT in the C++ front-end library. The engine does not

recover from invalid asserts, so it will crash anyway, but not in
a controlled environment.
parent 0722e956
......@@ -33,8 +33,6 @@
#include "CppDocument.h"
#include <utils/qtcassert.h>
#include <Control.h>
#include <TranslationUnit.h>
#include <DiagnosticClient.h>
......@@ -273,7 +271,7 @@ bool Document::parse(ParseMode mode)
void Document::check()
{
QTC_ASSERT(!_globalNamespace, return);
Q_ASSERT(!_globalNamespace);
Semantic semantic(_control);
......
......@@ -34,8 +34,6 @@
#include "OverviewModel.h"
#include "Overview.h"
#include <utils/qtcassert.h>
#include <Scope.h>
#include <Semantic.h>
#include <Literals.h>
......@@ -83,13 +81,13 @@ QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent)
return createIndex(row, column, symbol);
} else {
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
QTC_ASSERT(parentSymbol, return QModelIndex());
Q_ASSERT(parentSymbol);
ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol();
QTC_ASSERT(scopedSymbol, return QModelIndex());
Q_ASSERT(scopedSymbol);
Scope *scope = scopedSymbol->members();
QTC_ASSERT(scope, return QModelIndex());
Q_ASSERT(scope);
return createIndex(row, 0, scope->symbolAt(row));
}
......@@ -126,12 +124,12 @@ int OverviewModel::rowCount(const QModelIndex &parent) const
if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item
return 0;
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
QTC_ASSERT(parentSymbol, return 0);
Q_ASSERT(parentSymbol);
if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) {
if (!scopedSymbol->isFunction()) {
Scope *parentScope = scopedSymbol->members();
QTC_ASSERT(parentScope, return 0);
Q_ASSERT(parentScope);
return parentScope->symbolCount();
}
......
......@@ -45,8 +45,6 @@
#include <TypeVisitor.h>
#include <NameVisitor.h>
#include <utils/qtcassert.h>
#include <QtCore/QList>
#include <QtCore/QtDebug>
......@@ -100,7 +98,7 @@ protected:
// types
virtual void visit(PointerToMemberType * /*ty*/)
{
QTC_ASSERT(false, /**/);
Q_ASSERT(false);
}
virtual void visit(PointerType *ty)
......@@ -152,32 +150,32 @@ protected:
{ /* nothing to do*/ }
virtual void visit(Namespace *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(Class *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(Enum *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
// names
virtual void visit(NameId *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(TemplateNameId *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(DestructorNameId *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(OperatorNameId *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(ConversionNameId *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
virtual void visit(QualifiedNameId *)
{ QTC_ASSERT(false, /**/); }
{ Q_ASSERT(false); }
};
} // end of anonymous namespace
......
......@@ -53,8 +53,6 @@
#include "pp-environment.h"
#include "pp.h"
#include <utils/qtcassert.h>
#include <cstring>
using namespace CPlusPlus;
......@@ -93,7 +91,7 @@ Macro *Environment::macroAt(unsigned index) const
Macro *Environment::bind(const Macro &__macro)
{
QTC_ASSERT(! __macro.name.isEmpty(), return 0);
Q_ASSERT(! __macro.name.isEmpty());
Macro *m = new Macro (__macro);
m->hashcode = hash_code(m->name);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment