qtcassert: move actual printing to separate function and enforce style

This also allows simple setting of breakpoints on failed asserts.

Change-Id: I6dd84cbfaf659d57e39f3447386cebc0221b2b84
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
hjk
2012-04-17 08:01:25 +02:00
committed by hjk
parent 37e3853090
commit 5b0bf61640
95 changed files with 347 additions and 297 deletions
@@ -84,12 +84,11 @@ QWizard *WebPageWizard::createWizardDialog(QWidget *parent,
}
Core::GeneratedFiles
WebPageWizard::generateFiles(const QWizard *w,
QString *) const
WebPageWizard::generateFiles(const QWizard *w, QString *) const
{
Core::GeneratedFiles files;
const WebContentWizardDialog *dialog = qobject_cast<const WebContentWizardDialog*>(w);
QTC_ASSERT(dialog, return files; )
QTC_ASSERT(dialog, return files);
const QString fileName = Core::BaseFileWizard::buildFileName(dialog->path(), dialog->fileName(), QLatin1String("html"));
+1
View File
@@ -33,6 +33,7 @@
#include "fileinprojectfinder.h"
#include <utils/qtcassert.h>
#include <QDebug>
#include <QFileInfo>
#include <QUrl>
+4 -4
View File
@@ -36,6 +36,7 @@
#include "qtcassert.h"
#include <QDir>
#include <QDebug>
#include <QFileInfo>
#include <QTemporaryFile>
#include <QDateTime>
@@ -208,19 +209,18 @@ QString FileUtils::resolveSymlinks(const QString &path)
return f.filePath();
}
QByteArray FileReader::fetchQrc(const QString &fileName)
{
QTC_ASSERT(fileName.startsWith(QLatin1Char(':')), return QByteArray())
QTC_ASSERT(fileName.startsWith(QLatin1Char(':')), return QByteArray());
QFile file(fileName);
bool ok = file.open(QIODevice::ReadOnly);
QTC_ASSERT(ok, qWarning() << fileName << "not there!"; return QByteArray())
QTC_ASSERT(ok, qWarning() << fileName << "not there!"; return QByteArray());
return file.readAll();
}
bool FileReader::fetch(const QString &fileName, QIODevice::OpenMode mode)
{
QTC_ASSERT(!(mode & ~(QIODevice::ReadOnly | QIODevice::Text)), return false)
QTC_ASSERT(!(mode & ~(QIODevice::ReadOnly | QIODevice::Text)), return false);
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | mode)) {
+1 -1
View File
@@ -131,7 +131,7 @@ bool BinaryVersionToolTipEventFilter::eventFilter(QObject *o, QEvent *e)
if (e->type() != QEvent::ToolTip)
return false;
QLineEdit *le = qobject_cast<QLineEdit *>(o);
QTC_ASSERT(le, return false; )
QTC_ASSERT(le, return false);
const QString binary = le->text();
if (!binary.isEmpty()) {
+4 -4
View File
@@ -130,7 +130,7 @@ struct ParseValueStackEntry
ParseValueStackEntry::ParseValueStackEntry(const QVariant &aSimpleValue, const QString &k) :
type(aSimpleValue.type()), key(k), simpleValue(aSimpleValue)
{
QTC_ASSERT(simpleValue.isValid(), return ; )
QTC_ASSERT(simpleValue.isValid(), return);
}
QVariant ParseValueStackEntry::value() const
@@ -250,10 +250,10 @@ bool ParseContext::handleEndElement(const QStringRef &name)
{
const Element e = element(name);
if (ParseContext::isValueElement(e)) {
QTC_ASSERT(!m_valueStack.isEmpty(), return true; )
QTC_ASSERT(!m_valueStack.isEmpty(), return true);
const ParseValueStackEntry top = m_valueStack.pop();
if (m_valueStack.isEmpty()) { // Last element? -> Done with that variable.
QTC_ASSERT(!m_currentVariableName.isEmpty(), return true; )
QTC_ASSERT(!m_currentVariableName.isEmpty(), return true);
m_result.insert(m_currentVariableName, top.value());
m_currentVariableName.clear();
return false;
@@ -286,7 +286,7 @@ QVariant ParseContext::readSimpleValue(QXmlStreamReader &r, const QXmlStreamAttr
const QString type = attributes.value(typeAttribute).toString();
const QString text = r.readElementText();
if (type == QLatin1String("QChar")) { // Workaround: QTBUG-12345
QTC_ASSERT(text.size() == 1, return QVariant(); )
QTC_ASSERT(text.size() == 1, return QVariant());
return QVariant(QChar(text.at(0)));
}
QVariant value;
+42
View File
@@ -0,0 +1,42 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "qtcassert.h"
namespace Utils {
void writeAssertLocation(const char *msg)
{
qDebug("SOFT ASSERT: %s", msg);
}
} // namespace Utils
+10 -9
View File
@@ -33,19 +33,20 @@
#ifndef QTC_ASSERT_H
#define QTC_ASSERT_H
#include <QDebug>
#include "utils_global.h"
#define QTC_ASSERT_STRINGIFY_INTERNAL(x) #x
#define QTC_ASSERT_STRINGIFY(x) QTC_ASSERT_STRINGIFY_INTERNAL(x)
namespace Utils { QTCREATOR_UTILS_EXPORT void writeAssertLocation(const char *msg); }
// we do not use the 'do {...} while (0)' idiom here to be able to use
// 'break' and 'continue' as 'actions'.
#define QTC_ASSERT_STRINGIFY_HELPER(x) #x
#define QTC_ASSERT_STRINGIFY(x) QTC_ASSERT_STRINGIFY_HELPER(x)
#define QTC_ASSERT_STRING(cond) ::Utils::writeAssertLocation(\
"\"" cond"\" in file " __FILE__ ", line " QTC_ASSERT_STRINGIFY(__LINE__))
#define QTC_ASSERT(cond, action) \
if(cond){}else{qDebug()<<"SOFT ASSERT: \""#cond"\" in file " __FILE__ ", line " QTC_ASSERT_STRINGIFY(__LINE__);action;}
// The 'do {...} while (0)' idiom is not used for the main block here to be
// able to use 'break' and 'continue' as 'actions'.
#define QTC_CHECK(cond) \
if(cond){}else{qDebug()<<"SOFT ASSERT: \""#cond"\" in file " __FILE__ ", line " QTC_ASSERT_STRINGIFY(__LINE__);}
#define QTC_ASSERT(cond, action) if (cond) {} else { QTC_ASSERT_STRING(#cond); action; } do {} while (0)
#define QTC_CHECK(cond) if (cond) {} else { QTC_ASSERT_STRING(#cond); } do {} while (0)
#endif // QTC_ASSERT_H
+1 -1
View File
@@ -553,7 +553,7 @@ bool SynchronousProcess::readDataFromProcess(QProcess &p, int timeOutMS,
return false;
}
QTC_ASSERT(p.readChannel() == QProcess::StandardOutput, return false)
QTC_ASSERT(p.readChannel() == QProcess::StandardOutput, return false);
// Keep the process running until it has no longer has data
bool finished = false;
+3 -1
View File
@@ -32,9 +32,11 @@
#include "tcpportsgatherer.h"
#include "qtcassert.h"
#include <QDebug>
#include <QFile>
#include <QStringList>
#include <QProcess>
#include <QStringList>
#ifdef Q_OS_WIN
#include <QLibrary>
+2 -2
View File
@@ -150,7 +150,7 @@ bool decodeTextFileContent(const QByteArray &dataBA,
Target *target,
void (Target::*appendFunction)(const QString &))
{
QTC_ASSERT(format.codec, return false; )
QTC_ASSERT(format.codec, return false);
QTextCodec::ConverterState state;
bool hasDecodingError = false;
@@ -283,7 +283,7 @@ TextFileFormat::ReadResult
bool TextFileFormat::writeFile(const QString &fileName, QString plainText, QString *errorString) const
{
QTC_ASSERT(codec, return false;)
QTC_ASSERT(codec, return false);
// Does the user want CRLF? If that is native,
// let QFile do the work, else manually add.
+2 -1
View File
@@ -98,7 +98,8 @@ SOURCES += $$PWD/environment.cpp \
$$PWD/portlist.cpp \
$$PWD/tcpportsgatherer.cpp \
$$PWD/appmainwindow.cpp \
$$PWD/basetreeview.cpp
$$PWD/basetreeview.cpp \
$$PWD/qtcassert.cpp
win32 {
SOURCES += \
+1
View File
@@ -107,6 +107,7 @@ QtcLibrary {
"projectnamevalidatinglineedit.h",
"proxyaction.h",
"qtcassert.h",
"qtcassert.cpp",
"qtcolorbutton.cpp",
"qtcolorbutton.h",
"qtcprocess.h",
+1 -1
View File
@@ -195,7 +195,7 @@ QTCREATOR_UTILS_EXPORT bool winIs64BitSystem()
QTCREATOR_UTILS_EXPORT bool winIs64BitBinary(const QString &binaryIn)
{
QTC_ASSERT(!binaryIn.isEmpty(), return false; )
QTC_ASSERT(!binaryIn.isEmpty(), return false);
#ifdef Q_OS_WIN32
# ifdef __GNUC__ // MinGW lacking some definitions/winbase.h
# define SCS_64BIT_BINARY 6
+1 -1
View File
@@ -99,7 +99,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor()
const CPlusPlus::Snapshot &snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->fileName());
QTC_ASSERT(doc, return 0)
QTC_ASSERT(doc, return 0);
// fetch the expression's code
CPlusPlus::ExpressionUnderCursor expressionUnderCursor;
+2 -2
View File
@@ -1586,7 +1586,7 @@ void BinEditor::asFloat(int offset, float &value, bool old) const
{
value = 0;
const QByteArray data = dataMid(offset, sizeof(float), old);
QTC_ASSERT(data.size() == sizeof(float), return )
QTC_ASSERT(data.size() == sizeof(float), return);
const float *f = reinterpret_cast<const float *>(data.constData());
value = *f;
}
@@ -1595,7 +1595,7 @@ void BinEditor::asDouble(int offset, double &value, bool old) const
{
value = 0;
const QByteArray data = dataMid(offset, sizeof(double), old);
QTC_ASSERT(data.size() == sizeof(double), return )
QTC_ASSERT(data.size() == sizeof(double), return);
const double *f = reinterpret_cast<const double *>(data.constData());
value = *f;
}
@@ -87,7 +87,7 @@ static inline bool isFormWindowEditor(const QObject *o)
static inline QString formWindowEditorContents(const QObject *editor)
{
const QVariant contentV = editor->property("contents");
QTC_ASSERT(contentV.isValid(), return QString(); )
QTC_ASSERT(contentV.isValid(), return QString());
return contentV.toString();
}
@@ -110,7 +110,7 @@ QMap<QString, QKeySequence> CommandsFile::importCommands() const
if (name == ctx.shortCutElement) {
currentId = r.attributes().value(ctx.idAttribute).toString();
} else if (name == ctx.keyElement) {
QTC_ASSERT(!currentId.isEmpty(), return result; )
QTC_ASSERT(!currentId.isEmpty(), return result);
const QXmlStreamAttributes attributes = r.attributes();
if (attributes.hasAttribute(ctx.valueAttribute)) {
const QString keyString = attributes.value(ctx.valueAttribute).toString();
+1 -1
View File
@@ -742,7 +742,7 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(GeneratedFiles *
// Set 'keep' attribute in files
foreach (const QString &keepFile, existingFilesToKeep) {
const int i = indexOfFile(*files, keepFile);
QTC_ASSERT(i != -1, return OverwriteCanceled; )
QTC_ASSERT(i != -1, return OverwriteCanceled);
GeneratedFile &file = (*files)[i];
file.setAttributes(file.attributes() | GeneratedFile::KeepExistingFileAttribute);
}
@@ -208,7 +208,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
if (hi.document.isNull() || documentsDone.contains(hi.document))
continue;
QString title = model->displayNameForDocument(hi.document);
QTC_ASSERT(!title.isEmpty(), continue;)
QTC_ASSERT(!title.isEmpty(), continue);
documentsDone.insert(hi.document.data());
QTreeWidgetItem *item = new QTreeWidgetItem();
if (hi.document->isModified())
+4 -4
View File
@@ -218,7 +218,7 @@ EditorToolBar::~EditorToolBar()
void EditorToolBar::removeToolbarForEditor(IEditor *editor)
{
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
disconnect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
QWidget *toolBar = editor->toolBar();
@@ -259,7 +259,7 @@ void EditorToolBar::closeEditor()
void EditorToolBar::addEditor(IEditor *editor)
{
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
QWidget *toolBar = editor->toolBar();
@@ -271,7 +271,7 @@ void EditorToolBar::addEditor(IEditor *editor)
void EditorToolBar::addCenterToolBar(QWidget *toolBar)
{
QTC_ASSERT(toolBar, return)
QTC_ASSERT(toolBar, return);
toolBar->setVisible(false); // will be made visible in setCurrentEditor
d->m_toolBarPlaceholder->layout()->addWidget(toolBar);
@@ -305,7 +305,7 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
void EditorToolBar::setCurrentEditor(IEditor *editor)
{
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
d->m_editorList->setCurrentIndex(d->m_editorsListModel->indexOf(editor).row());
// If we never added the toolbar from the editor, we will never change
+1 -1
View File
@@ -176,7 +176,7 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon,
if (debug)
qDebug() << "FileIconProvider::registerIconOverlayForSuffix" << suffix;
QTC_ASSERT(!icon.isNull() && !suffix.isEmpty(), return)
QTC_ASSERT(!icon.isNull() && !suffix.isEmpty(), return);
const QPixmap fileIconPixmap = overlayIcon(QStyle::SP_FileIcon, icon, QSize(16, 16));
// replace old icon, if it exists
+2 -2
View File
@@ -1122,7 +1122,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
}
break;
case ParseMagicMatchRule:
QTC_ASSERT(!ruleMatcher.isNull(), return false)
QTC_ASSERT(!ruleMatcher.isNull(), return false);
if (!addMagicMatchRule(atts, ruleMatcher, errorMessage))
return false;
break;
@@ -1142,7 +1142,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
} else {
// Finished a match sequence
if (reader.name() == QLatin1String(magicTagC)) {
QTC_ASSERT(!ruleMatcher.isNull(), return false)
QTC_ASSERT(!ruleMatcher.isNull(), return false);
data.magicMatchers.push_back(ruleMatcher);
ruleMatcher = MagicRuleMatcherPtr();
}
+1 -1
View File
@@ -306,7 +306,7 @@ QString VcsManager::repositoryUrl(const QString &directory)
bool VcsManager::promptToDelete(IVersionControl *vc, const QString &fileName)
{
QTC_ASSERT(vc, return true)
QTC_ASSERT(vc, return true);
if (!vc->supportsOperation(IVersionControl::DeleteOperation))
return true;
const QString title = tr("Version Control");
+3 -3
View File
@@ -99,7 +99,7 @@ bool CodePasterProtocol::checkConfiguration(QString *errorMessage)
void CodePasterProtocol::fetch(const QString &id)
{
QTC_ASSERT(!m_fetchReply, return; )
QTC_ASSERT(!m_fetchReply, return);
QString hostName = m_page->hostName();
const QString httpPrefix = QLatin1String("http://");
@@ -124,7 +124,7 @@ void CodePasterProtocol::fetch(const QString &id)
void CodePasterProtocol::list()
{
QTC_ASSERT(!m_listReply, return; )
QTC_ASSERT(!m_listReply, return);
QString hostName = m_page->hostName();
QString link = QLatin1String("http://");
@@ -140,7 +140,7 @@ void CodePasterProtocol::paste(const QString &text,
const QString &comment,
const QString &description)
{
QTC_ASSERT(!m_pasteReply, return; )
QTC_ASSERT(!m_pasteReply, return);
const QString hostName = m_page->hostName();
QByteArray data = "command=processcreate&submit=submit&highlight_type=0&description=";
+4 -4
View File
@@ -88,19 +88,19 @@ CodePasterService::CodePasterService(QObject *parent) :
void CodePasterService::postText(const QString &text, const QString &mimeType)
{
QTC_ASSERT(CodepasterPlugin::instance(), return; )
QTC_ASSERT(CodepasterPlugin::instance(), return);
CodepasterPlugin::instance()->post(text, mimeType);
}
void CodePasterService::postCurrentEditor()
{
QTC_ASSERT(CodepasterPlugin::instance(), return; )
QTC_ASSERT(CodepasterPlugin::instance(), return);
CodepasterPlugin::instance()->postEditor();
}
void CodePasterService::postClipboard()
{
QTC_ASSERT(CodepasterPlugin::instance(), return; )
QTC_ASSERT(CodepasterPlugin::instance(), return);
CodepasterPlugin::instance()->postClipboard();
}
@@ -366,7 +366,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription,
m_fetchedSnippets.push_back(fileName);
// Open editor with title.
Core::IEditor* editor = EditorManager::instance()->openEditor(fileName, Core::Id(), EditorManager::ModeSwitch);
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
editor->setDisplayName(titleDescription);
}
+2 -2
View File
@@ -108,7 +108,7 @@ void KdePasteProtocol::paste(const QString &text,
{
Q_UNUSED(comment);
Q_UNUSED(description);
QTC_ASSERT(!m_pasteReply, return;)
QTC_ASSERT(!m_pasteReply, return);
// Format body
QByteArray pasteData = "api_submit=true&mode=xml";
@@ -162,7 +162,7 @@ void KdePasteProtocol::pasteFinished()
void KdePasteProtocol::fetch(const QString &id)
{
QTC_ASSERT(!m_fetchReply, return;)
QTC_ASSERT(!m_fetchReply, return);
// Did we get a complete URL or just an id?
m_fetchId = id;
@@ -58,7 +58,7 @@ unsigned PasteBinDotCaProtocol::capabilities() const
void PasteBinDotCaProtocol::fetch(const QString &id)
{
QTC_ASSERT(!m_fetchReply, return)
QTC_ASSERT(!m_fetchReply, return);
const QString url = QLatin1String(urlC);
const QString rawPostFix = QLatin1String("raw/");
// Create link as ""http://pastebin.ca/raw/[id]"
+1 -1
View File
@@ -84,7 +84,7 @@ QSharedPointer<VcsBase::AbstractCheckoutJob> CheckoutWizard::createJob(const QLi
// Collect parameters for the checkout command.
// CVS does not allow for checking out into a different directory.
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>())
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>());
const CvsSettings settings = CvsPlugin::instance()->settings();
const QString binary = settings.cvsCommand;
QStringList args;
+21 -21
View File
@@ -620,7 +620,7 @@ void CvsPlugin::cvsDiff(const CvsDiffParameters &p)
VcsBaseEditorWidget::tagEditor(editor, tag);
setDiffBaseDirectory(editor, p.workingDir);
CvsEditor *diffEditorWidget = qobject_cast<CvsEditor*>(editor->widget());
QTC_ASSERT(diffEditorWidget, return ; )
QTC_ASSERT(diffEditorWidget, return);
// Wire up the parameter widget to trigger a re-run on
// parameter change and 'revert' from inside the diff editor.
@@ -684,14 +684,14 @@ void CvsPlugin::updateActions(VcsBasePlugin::ActionState as)
void CvsPlugin::addCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void CvsPlugin::revertAll()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
const QString title = tr("Revert repository");
if (!messageBoxQuestion(title, tr("Revert all pending changes to the repository?")))
return;
@@ -710,7 +710,7 @@ void CvsPlugin::revertAll()
void CvsPlugin::revertCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
QStringList args;
args << QLatin1String("diff") << state.relativeCurrentFile();
const CvsResponse diffResponse =
@@ -746,28 +746,28 @@ void CvsPlugin::revertCurrentFile()
void CvsPlugin::diffProject()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
cvsDiff(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void CvsPlugin::diffCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
cvsDiff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void CvsPlugin::startCommitCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
startCommit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void CvsPlugin::startCommitAll()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
startCommit(state.topLevel());
}
@@ -843,21 +843,21 @@ bool CvsPlugin::commit(const QString &messageFile,
void CvsPlugin::filelogCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
filelog(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
}
void CvsPlugin::logProject()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
filelog(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void CvsPlugin::logRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
filelog(state.topLevel());
}
@@ -896,7 +896,7 @@ void CvsPlugin::filelog(const QString &workingDir,
void CvsPlugin::updateProject()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
update(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
@@ -917,28 +917,28 @@ bool CvsPlugin::update(const QString &topLevel, const QStringList &files)
void CvsPlugin::editCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
edit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void CvsPlugin::uneditCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
unedit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void CvsPlugin::uneditCurrentRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
unedit(state.topLevel(), QStringList());
}
void CvsPlugin::annotateCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
}
@@ -1050,35 +1050,35 @@ bool CvsPlugin::status(const QString &topLevel, const QStringList &files, const
void CvsPlugin::projectStatus()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
status(state.currentProjectTopLevel(), state.relativeCurrentProject(), tr("Project status"));
}
void CvsPlugin::commitProject()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
startCommit(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void CvsPlugin::diffRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
cvsDiff(state.topLevel(), QStringList());
}
void CvsPlugin::statusRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
status(state.topLevel(), QStringList(), tr("Repository status"));
}
void CvsPlugin::updateRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
update(state.topLevel(), QStringList());
}
+14 -14
View File
@@ -500,7 +500,7 @@ void CdbEngine::init()
QDir::toNativeSeparators(it.value())));
}
}
QTC_ASSERT(m_process.state() != QProcess::Running, Utils::SynchronousProcess::stopProcess(m_process); )
QTC_ASSERT(m_process.state() != QProcess::Running, Utils::SynchronousProcess::stopProcess(m_process));
}
CdbEngine::~CdbEngine()
@@ -521,7 +521,7 @@ void CdbEngine::syncOperateByInstruction(bool operateByInstruction)
qDebug("syncOperateByInstruction current: %d new %d", m_operateByInstruction, operateByInstruction);
if (m_operateByInstruction == operateByInstruction)
return;
QTC_ASSERT(m_accessible, return; )
QTC_ASSERT(m_accessible, return);
m_operateByInstruction = operateByInstruction;
postCommand(m_operateByInstruction ? QByteArray("l-t") : QByteArray("l+t"), 0);
postCommand(m_operateByInstruction ? QByteArray("l-s") : QByteArray("l+s"), 0);
@@ -1225,7 +1225,7 @@ void CdbEngine::executeRunToFunction(const QString &functionName)
void CdbEngine::setRegisterValue(int regnr, const QString &value)
{
const Registers registers = registerHandler()->registers();
QTC_ASSERT(regnr < registers.size(), return)
QTC_ASSERT(regnr < registers.size(), return);
// Value is decimal or 0x-hex-prefixed
QByteArray cmd;
ByteArrayInputStream str(cmd);
@@ -1455,7 +1455,7 @@ void CdbEngine::activateFrame(int index)
if (index < 0)
return;
const StackFrames &frames = stackHandler()->frames();
QTC_ASSERT(index < frames.size(), return; )
QTC_ASSERT(index < frames.size(), return);
const StackFrame frame = frames.at(index);
if (debug || debugLocals)
@@ -1571,7 +1571,7 @@ enum { DisassemblerRange = 512 };
void CdbEngine::fetchDisassembler(DisassemblerAgent *agent)
{
QTC_ASSERT(m_accessible, return;)
QTC_ASSERT(m_accessible, return);
const QVariant cookie = qVariantFromValue<DisassemblerAgent*>(agent);
const Location location = agent->location();
if (debug)
@@ -1753,7 +1753,7 @@ void CdbEngine::handleResolveSymbol(const QList<quint64> &addresses, const QVari
// Parse: "00000000`77606060 cc int 3"
void CdbEngine::handleDisassembler(const CdbBuiltinCommandPtr &command)
{
QTC_ASSERT(qVariantCanConvert<DisassemblerAgent*>(command->cookie), return;)
QTC_ASSERT(qVariantCanConvert<DisassemblerAgent*>(command->cookie), return);
DisassemblerAgent *agent = qvariant_cast<DisassemblerAgent*>(command->cookie);
agent->setContents(parseCdbDisassembler(command->reply));
}
@@ -1781,7 +1781,7 @@ void CdbEngine::postFetchMemory(const MemoryViewCookie &cookie)
void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, const QByteArray &data)
{
QTC_ASSERT(!data.isEmpty(), return; )
QTC_ASSERT(!data.isEmpty(), return);
if (!m_accessible) {
const MemoryChangeCookie cookie(addr, data);
doInterruptInferiorCustomSpecialStop(qVariantFromValue(cookie));
@@ -1792,7 +1792,7 @@ void CdbEngine::changeMemory(Internal::MemoryAgent *, QObject *, quint64 addr, c
void CdbEngine::handleMemory(const CdbExtensionCommandPtr &command)
{
QTC_ASSERT(qVariantCanConvert<MemoryViewCookie>(command->cookie), return;)
QTC_ASSERT(qVariantCanConvert<MemoryViewCookie>(command->cookie), return);
const MemoryViewCookie memViewCookie = qvariant_cast<MemoryViewCookie>(command->cookie);
if (command->success) {
const QByteArray data = QByteArray::fromBase64(command->reply);
@@ -1928,7 +1928,7 @@ void CdbEngine::handleLocals(const CdbExtensionCommandPtr &reply)
QList<WatchData> watchData;
GdbMi root;
root.fromString(reply->reply);
QTC_ASSERT(root.isList(), return ; )
QTC_ASSERT(root.isList(), return);
if (debugLocals) {
qDebug() << root.toString(true, 4);
}
@@ -2474,17 +2474,17 @@ void CdbEngine::parseOutputLine(QByteArray line)
// integer token
const int tokenPos = m_creatorExtPrefix.size() + 2;
const int tokenEndPos = line.indexOf('|', tokenPos);
QTC_ASSERT(tokenEndPos != -1, return)
QTC_ASSERT(tokenEndPos != -1, return);
const int token = line.mid(tokenPos, tokenEndPos - tokenPos).toInt();
// remainingChunks
const int remainingChunksPos = tokenEndPos + 1;
const int remainingChunksEndPos = line.indexOf('|', remainingChunksPos);
QTC_ASSERT(remainingChunksEndPos != -1, return)
QTC_ASSERT(remainingChunksEndPos != -1, return);
const int remainingChunks = line.mid(remainingChunksPos, remainingChunksEndPos - remainingChunksPos).toInt();
// const char 'serviceName'
const int whatPos = remainingChunksEndPos + 1;
const int whatEndPos = line.indexOf('|', whatPos);
QTC_ASSERT(whatEndPos != -1, return)
QTC_ASSERT(whatEndPos != -1, return);
const QByteArray what = line.mid(whatPos, whatEndPos - whatPos);
// Build up buffer, call handler once last chunk was encountered
m_extensionMessageBuffer += line.mid(whatEndPos + 1);
@@ -2962,7 +2962,7 @@ void CdbEngine::postCommandSequence(unsigned mask)
return;
}
if (mask & CommandListRegisters) {
QTC_ASSERT(threadsHandler()->currentThread() >= 0, return; )
QTC_ASSERT(threadsHandler()->currentThread() >= 0, return);
postExtensionCommand("registers", QByteArray(), 0, &CdbEngine::handleRegisters, mask & ~CommandListRegisters);
return;
}
@@ -3062,7 +3062,7 @@ void CdbEngine::handleBreakPoints(const GdbMi &value)
qPrintable(reportedResponse.toString()));
if (reportedResponse.id.isValid() && !reportedResponse.pending) {
const BreakpointModelId mid = handler->findBreakpointByResponseId(reportedResponse.id);
QTC_ASSERT(mid.isValid(), continue; )
QTC_ASSERT(mid.isValid(), continue);
const PendingBreakPointMap::iterator it = m_pendingBreakpointMap.find(mid);
if (it != m_pendingBreakpointMap.end()) {
// Complete the response and set on handler.
+2 -2
View File
@@ -166,7 +166,7 @@ QByteArray cdbAddBreakpointCommand(const BreakpointParameters &bpIn,
case BreakpointAtMain:
case BreakpointOnQmlSignalEmit:
case BreakpointAtJavaScriptThrow:
QTC_ASSERT(false, return QByteArray(); )
QTC_ASSERT(false, return QByteArray());
break;
case BreakpointByAddress:
str << hex << hexPrefixOn << bp.address << hexPrefixOff << dec;
@@ -232,7 +232,7 @@ QVariant cdbIntegerValue(const QByteArray &t)
const QVariant converted = base == 16 ?
fixed.toULongLong(&ok, base) :
fixed.toLongLong(&ok, base);
QTC_ASSERT(ok, return QVariant(); )
QTC_ASSERT(ok, return QVariant());
return converted;
}
+1 -1
View File
@@ -181,7 +181,7 @@ QIcon CommonOptionsPage::categoryIcon() const
void CommonOptionsPage::apply()
{
QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return; )
QTC_ASSERT(!m_widget.isNull() && !m_group.isNull(), return);
QSettings *settings = ICore::settings();
m_group->apply(settings);
+3 -3
View File
@@ -327,7 +327,7 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
ActionManager *am = ICore::actionManager();
Context debugcontext(Constants::C_DEBUGMODE);
m_viewsMenu = am->actionContainer(Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(m_viewsMenu, return)
QTC_ASSERT(m_viewsMenu, return);
QAction *openMemoryEditorAction = new QAction(this);
openMemoryEditorAction->setText(tr("Memory..."));
@@ -492,7 +492,7 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
d, SLOT(updateUiForProject(ProjectExplorer::Project*)));
d->m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(d->m_viewsMenu, return 0)
QTC_ASSERT(d->m_viewsMenu, return 0);
//d->m_mainWindow = new Internal::DebuggerMainWindow(this);
setDocumentMode(true);
@@ -591,7 +591,7 @@ void DebuggerMainWindow::writeSettings() const
void DebuggerMainWindow::raiseDebuggerWindow()
{
Utils::AppMainWindow *appMainWindow = qobject_cast<Utils::AppMainWindow*>(ICore::mainWindow());
QTC_ASSERT(appMainWindow, return)
QTC_ASSERT(appMainWindow, return);
appMainWindow->raiseWindow();
}
+1 -1
View File
@@ -453,7 +453,7 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel)
bool DebuggerRunControl::promptToStop(bool *optionalPrompt) const
{
QTC_ASSERT(isRunning(), return true;)
QTC_ASSERT(isRunning(), return true);
if (optionalPrompt && !*optionalPrompt)
return true;
@@ -181,14 +181,14 @@ void SourcePathMappingModel::addRawMapping(const QString &source, const QString
void SourcePathMappingModel::setSource(int row, const QString &s)
{
QStandardItem *sourceItem = item(row, SourceColumn);
QTC_ASSERT(sourceItem, return; )
QTC_ASSERT(sourceItem, return);
sourceItem->setText(s.isEmpty() ? m_newSourcePlaceHolder : QDir::toNativeSeparators(s));
}
void SourcePathMappingModel::setTarget(int row, const QString &t)
{
QStandardItem *targetItem = item(row, TargetColumn);
QTC_ASSERT(targetItem, return; )
QTC_ASSERT(targetItem, return);
targetItem->setText(t.isEmpty() ? m_newTargetPlaceHolder : QDir::toNativeSeparators(t));
}
@@ -75,7 +75,7 @@ void DebuggerToolChainComboBox::init(bool hostAbiOnly)
void DebuggerToolChainComboBox::setAbi(const ProjectExplorer::Abi &abi)
{
QTC_ASSERT(abi.isValid(), return; )
QTC_ASSERT(abi.isValid(), return);
const int c = count();
for (int i = 0; i < c; i++) {
if (abiAt(i) == abi) {
+3 -3
View File
@@ -726,7 +726,7 @@ void CodaGdbAdapter::handleGdbServerCommand(const QByteArray &cmd)
bool ok = false;
const uint registerNumber = cmd.mid(1).toUInt(&ok, 16);
const int threadIndex = m_snapshot.indexOfThread(m_session.tid);
QTC_ASSERT(threadIndex != -1, return)
QTC_ASSERT(threadIndex != -1, return);
const Symbian::Thread &thread = m_snapshot.threadInfo.at(threadIndex);
if (thread.registerValid) {
sendGdbServerMessage(thread.gdbReportSingleRegister(registerNumber),
@@ -1277,7 +1277,7 @@ void CodaGdbAdapter::handleWriteRegister(const CodaCommandResult &result)
void CodaGdbAdapter::sendRegistersGetMCommand()
{
// Send off a register command, which requires the names to be present.
QTC_ASSERT(!m_codaDevice->registerNames().isEmpty(), return )
QTC_ASSERT(!m_codaDevice->registerNames().isEmpty(), return);
m_codaDevice->sendRegistersGetMRangeCommand(
CodaCallback(this, &CodaGdbAdapter::handleAndReportReadRegisters),
@@ -1359,7 +1359,7 @@ void CodaGdbAdapter::handleReadRegisters(const CodaCommandResult &result)
// TODO: When reading 8-byte floating-point registers is supported, thread
// registers won't be an array of uints.
uint *registers = m_snapshot.registers(m_session.tid);
QTC_ASSERT(registers, return;)
QTC_ASSERT(registers, return);
QByteArray bigEndianRaw = QByteArray::fromBase64(result.values.front().data());
// TODO: When reading 8-byte floating-point registers is supported, will
+13 -13
View File
@@ -956,7 +956,7 @@ void GdbEngine::flushCommand(const GdbCommand &cmd0)
return;
}
QTC_ASSERT(gdbProc()->state() == QProcess::Running, return;)
QTC_ASSERT(gdbProc()->state() == QProcess::Running, return);
const int token = ++currentToken();
@@ -1425,7 +1425,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
gotoLocation(Location(fullName, lineNumber));
if (!m_commandsToRunOnTemporaryBreak.isEmpty()) {
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state())
QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
m_actingOnExpectedStop = true;
notifyInferiorStopOk();
flushQueuedCommands();
@@ -1433,7 +1433,7 @@ void GdbEngine::handleStopResponse(const GdbMi &data)
QTC_CHECK(m_commandsDoneCallback == 0);
m_commandsDoneCallback = &GdbEngine::autoContinueInferior;
} else {
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state())
QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state());
}
return;
}
@@ -1915,8 +1915,8 @@ QString GdbEngine::fullName(const QString &fileName)
{
if (fileName.isEmpty())
return QString();
//QTC_ASSERT(!m_sourcesListOutdated, /* */)
QTC_ASSERT(!m_sourcesListUpdating, /* */)
//QTC_ASSERT(!m_sourcesListOutdated, /* */);
QTC_ASSERT(!m_sourcesListUpdating, /* */);
return m_shortToFullName.value(fileName, QString());
}
@@ -1927,7 +1927,7 @@ QString GdbEngine::cleanupFullName(const QString &fileName)
// Gdb running on windows often delivers "fullnames" which
// (a) have no drive letter and (b) are not normalized.
if (Abi::hostAbi().os() == Abi::WindowsOS) {
QTC_ASSERT(!fileName.isEmpty(), return QString())
QTC_ASSERT(!fileName.isEmpty(), return QString());
QFileInfo fi(fileName);
if (fi.isReadable())
cleanFilePath = QDir::cleanPath(fi.absoluteFilePath());
@@ -2570,7 +2570,7 @@ void GdbEngine::updateResponse(BreakpointResponse &response, const GdbMi &bkpt)
QString GdbEngine::breakLocation(const QString &file) const
{
//QTC_ASSERT(!m_breakListOutdated, /* */)
//QTC_CHECK(!m_breakListOutdated);
QString where = m_fullToShortName.value(file);
if (where.isEmpty())
return QFileInfo(file).fileName();
@@ -2855,7 +2855,7 @@ void GdbEngine::handleBreakList(const GdbMi &table)
void GdbEngine::handleBreakListMultiple(const GdbResponse &response)
{
QTC_CHECK(response.resultClass == GdbResultDone)
QTC_CHECK(response.resultClass == GdbResultDone);
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
const QString str = QString::fromLocal8Bit(response.consoleStreamOutput);
extractDataFromInfoBreak(str, id);
@@ -2863,7 +2863,7 @@ void GdbEngine::handleBreakListMultiple(const GdbResponse &response)
void GdbEngine::handleBreakDisable(const GdbResponse &response)
{
QTC_CHECK(response.resultClass == GdbResultDone)
QTC_CHECK(response.resultClass == GdbResultDone);
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
// This should only be the requested state.
@@ -2876,7 +2876,7 @@ void GdbEngine::handleBreakDisable(const GdbResponse &response)
void GdbEngine::handleBreakEnable(const GdbResponse &response)
{
QTC_CHECK(response.resultClass == GdbResultDone)
QTC_CHECK(response.resultClass == GdbResultDone);
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
// This should only be the requested state.
@@ -2889,7 +2889,7 @@ void GdbEngine::handleBreakEnable(const GdbResponse &response)
void GdbEngine::handleBreakThreadSpec(const GdbResponse &response)
{
QTC_CHECK(response.resultClass == GdbResultDone)
QTC_CHECK(response.resultClass == GdbResultDone);
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
BreakpointResponse br = handler->response(id);
@@ -2901,7 +2901,7 @@ void GdbEngine::handleBreakThreadSpec(const GdbResponse &response)
void GdbEngine::handleBreakLineNumber(const GdbResponse &response)
{
QTC_CHECK(response.resultClass == GdbResultDone)
QTC_CHECK(response.resultClass == GdbResultDone);
const BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
BreakpointResponse br = handler->response(id);
@@ -2923,7 +2923,7 @@ void GdbEngine::handleBreakIgnore(const GdbResponse &response)
// 29^done
//
// gdb 6.3 does not produce any console output
QTC_CHECK(response.resultClass == GdbResultDone)
QTC_CHECK(response.resultClass == GdbResultDone);
//QString msg = _(response.consoleStreamOutput);
BreakpointModelId id = response.cookie.value<BreakpointModelId>();
BreakHandler *handler = breakHandler();
+1
View File
@@ -35,6 +35,7 @@
#include <utils/qtcassert.h>
#include <QByteArray>
#include <QDebug>
#include <QRegExp>
#include <QTextStream>
+5 -5
View File
@@ -191,7 +191,7 @@ bool MemoryAgent::doCreateBinEditor(quint64 addr, unsigned flags,
return true;
}
// Editor: Register tracking not supported.
QTC_ASSERT(!(flags & DebuggerEngine::MemoryTrackRegister), return false; )
QTC_ASSERT(!(flags & DebuggerEngine::MemoryTrackRegister), return false);
EditorManager *editorManager = EditorManager::instance();
if (!title.endsWith(QLatin1Char('$')))
title.append(QLatin1String(" $"));
@@ -237,14 +237,14 @@ void MemoryAgent::addLazyData(QObject *editorToken, quint64 addr,
const QByteArray &ba)
{
QWidget *w = qobject_cast<QWidget *>(editorToken);
QTC_ASSERT(w, return ;)
QTC_ASSERT(w, return);
MemoryView::binEditorAddData(w, addr, ba);
}
void MemoryAgent::provideNewRange(IEditor *, quint64 address)
{
QWidget *w = qobject_cast<QWidget *>(sender());
QTC_ASSERT(w, return ;)
QTC_ASSERT(w, return);
MemoryView::setBinEditorRange(w, address, DataRange, BinBlockSize);
}
@@ -254,14 +254,14 @@ void MemoryAgent::provideNewRange(IEditor *, quint64 address)
void MemoryAgent::handleStartOfFileRequested(IEditor *)
{
QWidget *w = qobject_cast<QWidget *>(sender());
QTC_ASSERT(w, return ;)
QTC_ASSERT(w, return);
MemoryView::binEditorSetCursorPosition(w, 0);
}
void MemoryAgent::handleEndOfFileRequested(IEditor *)
{
QWidget *w = qobject_cast<QWidget *>(sender());
QTC_ASSERT(w, return ;)
QTC_ASSERT(w, return);
MemoryView::binEditorSetCursorPosition(w, DataRange - 1);
}
+1 -1
View File
@@ -653,7 +653,7 @@ void PdbEngine::handleOutput2(const QByteArray &data)
PdbResponse response;
response.data = data;
showMessage(_(data));
QTC_ASSERT(!m_commands.isEmpty(), qDebug() << "RESPONSE: " << data; return)
QTC_ASSERT(!m_commands.isEmpty(), qDebug() << "RESPONSE: " << data; return);
PdbCommand cmd = m_commands.dequeue();
response.cookie = cmd.cookie;
qDebug() << "DEQUE: " << cmd.command << cmd.callbackName;
+2 -2
View File
@@ -443,7 +443,7 @@ void QmlEngine::beginConnection(quint16 port)
if (state() != EngineRunRequested && d->m_retryOnConnectFail)
return;
QTC_ASSERT(state() == EngineRunRequested, return)
QTC_ASSERT(state() == EngineRunRequested, return);
if (port > 0) {
QTC_CHECK(startParameters().communicationChannel
@@ -451,7 +451,7 @@ void QmlEngine::beginConnection(quint16 port)
QTC_ASSERT(startParameters().connParams.port == 0
|| startParameters().connParams.port == port,
qWarning() << "Port " << port << "from application output does not match"
<< startParameters().connParams.port << "from start parameters.")
<< startParameters().connParams.port << "from start parameters.");
d->m_adapter.beginConnectionTcp(startParameters().qmlServerAddress, port);
return;
}
@@ -164,7 +164,7 @@ int IntegerWatchLineEdit::base() const
void IntegerWatchLineEdit::setBase(int b)
{
QTC_ASSERT(b, return; )
QTC_ASSERT(b, return);
m_validator->setBase(b);
}
+1 -1
View File
@@ -454,7 +454,7 @@ static QString translate(const QString &str)
const int len = str.indexOf(QLatin1Char(' ')) - numberPos;
const int size = str.mid(numberPos, len).toInt(&ok);
QTC_ASSERT(ok, qWarning("WatchHandler: Invalid item count '%s'",
qPrintable(str)))
qPrintable(str)));
return moreThan ?
WatchHandler::tr("<more than %n items>", 0, size) :
WatchHandler::tr("<%n items>", 0, size);
+1 -1
View File
@@ -419,7 +419,7 @@ static void addStackLayoutMemoryView(DebuggerEngine *engine, bool separateView,
const QAbstractItemModel *m, const QPoint &p, QWidget *parent)
{
typedef QPair<quint64, QString> RegisterValueNamePair;
QTC_ASSERT(engine && m, return ;)
QTC_ASSERT(engine && m, return);
// Determine suitable address range from locals.
quint64 start = Q_UINT64_C(0xFFFFFFFFFFFFFFFF);
+2 -2
View File
@@ -251,7 +251,7 @@ void FormEditorW::setupViewActions()
// Populate "View" menu of form editor menu
Core::ActionManager *am = Core::ICore::actionManager();
Core::ActionContainer *viewMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(viewMenu, return)
QTC_ASSERT(viewMenu, return);
addDockViewAction(am, viewMenu, WidgetBoxSubWindow, m_contexts,
tr("Widget box"), Core::Id("FormEditor.WidgetBox"));
@@ -787,7 +787,7 @@ void FormEditorW::currentEditorChanged(Core::IEditor *editor)
QTC_ASSERT(xmlEditor, return);
ensureInitStage(FullyInitialized);
SharedTools::WidgetHost *fw = m_editorWidget->formWindowEditorForXmlEditor(xmlEditor);
QTC_ASSERT(fw, return)
QTC_ASSERT(fw, return);
m_editorWidget->setVisibleEditor(xmlEditor);
m_fwm->setActiveFormWindow(fw->formWindow());
}
@@ -533,7 +533,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName,
typedef QMap<int, Document::Ptr> DocumentMap;
const EditorData ed = m_few->activeEditor();
QTC_ASSERT(ed, return false)
QTC_ASSERT(ed, return false);
const QString currentUiFile = ed.formWindowEditor->document()->fileName();
#if 0
return Designer::Internal::navigateToSlot(currentUiFile, objectName, signalSignature, parameterNames, errorMessage);
+1 -1
View File
@@ -135,7 +135,7 @@ void ResourceHandler::updateResources()
ensureInitialized();
const QString fileName = m_form->fileName();
QTC_ASSERT(!fileName.isEmpty(), return)
QTC_ASSERT(!fileName.isEmpty(), return);
if (Designer::Constants::Internal::debug)
qDebug() << "ResourceHandler::updateResources()" << fileName;
+7 -7
View File
@@ -51,49 +51,49 @@ static inline QSettings *coreSettings()
void SettingsManager::beginGroup(const QString &prefix)
{
QSettings *settings = coreSettings();
QTC_ASSERT(settings, return; )
QTC_ASSERT(settings, return);
settings->beginGroup(addPrefix(prefix));
}
void SettingsManager::endGroup()
{
QSettings *settings = coreSettings();
QTC_ASSERT(settings, return; )
QTC_ASSERT(settings, return);
settings->endGroup();
}
bool SettingsManager::contains(const QString &key) const
{
const QSettings *settings = coreSettings();
QTC_ASSERT(settings, return false; )
QTC_ASSERT(settings, return false);
return settings->contains(addPrefix(key));
}
void SettingsManager::setValue(const QString &key, const QVariant &value)
{
QSettings *settings = coreSettings();
QTC_ASSERT(settings, return; )
QTC_ASSERT(settings, return);
settings->setValue(addPrefix(key), value);
}
QVariant SettingsManager::value(const QString &key, const QVariant &defaultValue) const
{
const QSettings *settings = coreSettings();
QTC_ASSERT(settings, return QVariant(); )
QTC_ASSERT(settings, return QVariant());
return settings->value(addPrefix(key), defaultValue);
}
void SettingsManager::remove(const QString &key)
{
QSettings *settings = coreSettings();
QTC_ASSERT(settings, return; )
QTC_ASSERT(settings, return);
settings->remove(addPrefix(key));
}
QString SettingsManager::addPrefix(const QString &name) const
{
const QSettings *settings = coreSettings();
QTC_ASSERT(settings, return name; )
QTC_ASSERT(settings, return name);
QString result = name;
if (settings->group().isEmpty())
result.prepend(QLatin1String("Designer"));
+1 -1
View File
@@ -1757,7 +1757,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
return false;
}
const int separatorPos = sp.stdOut.indexOf(QLatin1Char('@'));
QTC_ASSERT(separatorPos != -1, return false)
QTC_ASSERT(separatorPos != -1, return false);
commitData->amendSHA1= sp.stdOut.left(separatorPos);
*commitTemplate = sp.stdOut.mid(separatorPos + 1);
} else {
@@ -116,7 +116,7 @@ QSharedPointer<VcsBase::AbstractCheckoutJob> GitoriousCloneWizard::createJob(con
QString *checkoutPath)
{
const Git::CloneWizardPage *cwp = qobject_cast<const Git::CloneWizardPage *>(parameterPages.back());
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>())
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>());
return cwp->createCheckoutJob(checkoutPath);
}
+16 -16
View File
@@ -582,35 +582,35 @@ void GitPlugin::submitEditorDiff(const QStringList &unstaged, const QStringList
void GitPlugin::diffCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_gitClient->diff(state.currentFileTopLevel(), QStringList(), state.relativeCurrentFile());
}
void GitPlugin::diffCurrentProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
m_gitClient->diff(state.currentProjectTopLevel(), QStringList(), state.relativeCurrentProject());
}
void GitPlugin::diffRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->diff(state.topLevel(), QStringList(), QStringList());
}
void GitPlugin::logFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_gitClient->log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
}
void GitPlugin::blameFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
const int lineNumber = VcsBase::VcsBaseEditorWidget::lineNumberOfCurrentEditor(state.currentFile());
m_gitClient->blame(state.currentFileTopLevel(), QStringList(), state.relativeCurrentFile(), QString(), lineNumber);
}
@@ -618,14 +618,14 @@ void GitPlugin::blameFile()
void GitPlugin::logProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
m_gitClient->log(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void GitPlugin::undoFileChanges(bool revertStaging)
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
Core::FileChangeBlocker fcb(state.currentFile());
m_gitClient->revert(QStringList(state.currentFile()), revertStaging);
}
@@ -638,7 +638,7 @@ void GitPlugin::undoUnstagedFileChanges()
void GitPlugin::undoRepositoryChanges()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
const QString msg = tr("Undo all pending changes to the repository\n%1?").arg(QDir::toNativeSeparators(state.topLevel()));
const QMessageBox::StandardButton answer
= QMessageBox::question(Core::ICore::mainWindow(),
@@ -653,14 +653,14 @@ void GitPlugin::undoRepositoryChanges()
void GitPlugin::stageFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_gitClient->addFile(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void GitPlugin::unstageFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_gitClient->synchronousReset(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
@@ -684,7 +684,7 @@ void GitPlugin::startCommit(bool amend)
}
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
QString errorMessage, commitTemplate;
CommitData data;
@@ -818,7 +818,7 @@ void GitPlugin::pull()
void GitPlugin::push()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_gitClient->synchronousPush(state.topLevel());
}
@@ -838,7 +838,7 @@ static inline GitClientMemberFunc memberFunctionFromAction(const QObject *o)
void GitPlugin::gitClientMemberFuncRepositoryAction()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
// Retrieve member function and invoke on repository
GitClientMemberFunc func = memberFunctionFromAction(sender());
QTC_ASSERT(func, return);
@@ -848,7 +848,7 @@ void GitPlugin::gitClientMemberFuncRepositoryAction()
void GitPlugin::cleanProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
cleanRepository(state.currentProjectPath());
}
@@ -963,7 +963,7 @@ void GitPlugin::stash()
{
// Simple stash without prompt, reset repo.
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
const QString id = m_gitClient->synchronousStash(state.topLevel(), QString(), 0);
if (!id.isEmpty() && m_stashDialog)
m_stashDialog->refresh(state.topLevel(), true);
@@ -973,7 +973,7 @@ void GitPlugin::stashSnapshot()
{
// Prompt for description, restore immediately and keep on working.
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
const QString id = m_gitClient->synchronousStash(state.topLevel(), QString(), GitClient::StashImmediateRestore|GitClient::StashPromptDescription);
if (!id.isEmpty() && m_stashDialog)
m_stashDialog->refresh(state.topLevel(), true);
+6 -6
View File
@@ -211,7 +211,7 @@ void StashDialog::deleteAll()
void StashDialog::deleteSelection()
{
const QList<int> rows = selectedRows();
QTC_ASSERT(!rows.isEmpty(), return)
QTC_ASSERT(!rows.isEmpty(), return);
const QString title = tr("Delete Stashes");
if (!ask(title, tr("Do you want to delete %n stash(es)?", 0, rows.size())))
return;
@@ -229,7 +229,7 @@ void StashDialog::deleteSelection()
void StashDialog::showCurrent()
{
const int index = currentRow();
QTC_ASSERT(index >= 0, return)
QTC_ASSERT(index >= 0, return);
gitClient()->show(m_repository, m_model->at(index).name);
}
@@ -302,7 +302,7 @@ bool StashDialog::promptForRestore(QString *stash,
if (gitClient()->synchronousStash(m_repository, QString(), GitClient::StashPromptDescription).isEmpty())
return false;
*stash = nextStash(*stash); // Our stash id to be restored changed
QTC_ASSERT(!stash->isEmpty(), return false)
QTC_ASSERT(!stash->isEmpty(), return false);
break;
case ModifiedRepositoryDiscard:
if (!gitClient()->synchronousReset(m_repository))
@@ -336,7 +336,7 @@ static inline QString msgRestoreFailedTitle(const QString &stash)
void StashDialog::restoreCurrent()
{
const int index = currentRow();
QTC_ASSERT(index >= 0, return)
QTC_ASSERT(index >= 0, return);
QString errorMessage;
QString name = m_model->at(index).name;
// Make sure repository is not modified, restore. The command will
@@ -354,8 +354,8 @@ void StashDialog::restoreCurrent()
void StashDialog::restoreCurrentInBranch()
{
const int index = currentRow();
QTC_ASSERT(index >= 0, return)
QString errorMessage;
QTC_ASSERT(index >= 0, return);
QString errorMessage;
QString branch;
QString name = m_model->at(index).name;
const bool success = promptForRestore(&name, &branch, &errorMessage)
+2 -2
View File
@@ -115,9 +115,9 @@ void CommandLocator::accept(Locator::FilterEntry entry) const
{
// Retrieve action via index.
const int index = entry.internalData.toInt();
QTC_ASSERT(index >= 0 && index < d->commands.size(), return)
QTC_ASSERT(index >= 0 && index < d->commands.size(), return);
QAction *action = d->commands.at(index)->action();
QTC_ASSERT(action->isEnabled(), return)
QTC_ASSERT(action->isEnabled(), return);
action->trigger();
}
+18 -19
View File
@@ -281,28 +281,28 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
void MercurialPlugin::addCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_client->synchronousAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void MercurialPlugin::annotateCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_client->annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void MercurialPlugin::diffCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_client->diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void MercurialPlugin::logCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_client->log(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()),
QStringList(), true);
}
@@ -310,7 +310,7 @@ void MercurialPlugin::logCurrentFile()
void MercurialPlugin::revertCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
RevertDialog reverter;
if (reverter.exec() != QDialog::Accepted)
@@ -321,7 +321,7 @@ void MercurialPlugin::revertCurrentFile()
void MercurialPlugin::statusCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
m_client->status(state.currentFileTopLevel(), state.relativeCurrentFile());
}
@@ -359,25 +359,24 @@ void MercurialPlugin::createDirectoryActions(const Core::Context &context)
m_commandLocator->appendCommand(command);
}
void MercurialPlugin::diffRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_client->diff(state.topLevel());
}
void MercurialPlugin::logRepository()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_client->log(state.topLevel());
}
void MercurialPlugin::revertMulti()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
RevertDialog reverter;
if (reverter.exec() != QDialog::Accepted)
@@ -388,7 +387,7 @@ void MercurialPlugin::revertMulti()
void MercurialPlugin::statusMulti()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_client->status(state.topLevel());
}
@@ -454,7 +453,7 @@ void MercurialPlugin::createRepositoryActions(const Core::Context &context)
void MercurialPlugin::pull()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
SrcDestDialog dialog;
dialog.setWindowTitle(tr("Pull Source"));
@@ -466,7 +465,7 @@ void MercurialPlugin::pull()
void MercurialPlugin::push()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
SrcDestDialog dialog;
dialog.setWindowTitle(tr("Push Destination"));
@@ -478,7 +477,7 @@ void MercurialPlugin::push()
void MercurialPlugin::update()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
RevertDialog updateDialog;
updateDialog.setWindowTitle(tr("Update"));
@@ -490,7 +489,7 @@ void MercurialPlugin::update()
void MercurialPlugin::import()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
QFileDialog importDialog;
importDialog.setFileMode(QFileDialog::ExistingFiles);
@@ -506,7 +505,7 @@ void MercurialPlugin::import()
void MercurialPlugin::incoming()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
SrcDestDialog dialog;
dialog.setWindowTitle(tr("Incoming Source"));
@@ -518,7 +517,7 @@ void MercurialPlugin::incoming()
void MercurialPlugin::outgoing()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_client->outgoing(state.topLevel());
}
@@ -548,7 +547,7 @@ void MercurialPlugin::commit()
return;
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
m_submitRepository = state.topLevel();
@@ -591,7 +590,7 @@ void MercurialPlugin::showCommitWidget(const QList<VcsBaseClient::StatusItem> &s
return;
}
QTC_ASSERT(qobject_cast<CommitEditor *>(editor), return)
QTC_ASSERT(qobject_cast<CommitEditor *>(editor), return);
CommitEditor *commitEditor = static_cast<CommitEditor *>(editor);
commitEditor->registerActions(editorUndo, editorRedo, editorCommit, editorDiff);
+18 -18
View File
@@ -120,7 +120,7 @@ static inline QStringList perforceRelativeFileArguments(const QStringList &args)
{
if (args.isEmpty())
return QStringList(QLatin1String("..."));
QTC_ASSERT(args.size() == 1, return QStringList())
QTC_ASSERT(args.size() == 1, return QStringList());
QStringList p4Args = args;
p4Args.front() += QLatin1String("/...");
return p4Args;
@@ -463,21 +463,21 @@ void PerforcePlugin::extensionsInitialized()
void PerforcePlugin::openCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
vcsOpen(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void PerforcePlugin::addCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void PerforcePlugin::revertCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
QTextCodec *codec = VcsBase::VcsBaseEditorWidget::getCodec(state.currentFile());
QStringList args;
@@ -512,14 +512,14 @@ void PerforcePlugin::revertCurrentFile()
void PerforcePlugin::diffCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
p4Diff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void PerforcePlugin::diffCurrentProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
p4Diff(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state));
}
@@ -531,7 +531,7 @@ void PerforcePlugin::diffAllOpened()
void PerforcePlugin::updateCurrentProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
updateCheckout(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state));
}
@@ -543,7 +543,7 @@ void PerforcePlugin::updateAll()
void PerforcePlugin::revertCurrentProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
const QString msg = tr("Do you want to revert all changes to the project \"%1\"?").arg(state.currentProjectName());
if (QMessageBox::warning(0, tr("p4 revert"), msg, QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
@@ -555,7 +555,7 @@ void PerforcePlugin::revertUnchangedCurrentProject()
{
// revert -a.
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), true);
}
@@ -625,7 +625,7 @@ void PerforcePlugin::startSubmitProject()
}
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
// Revert all unchanged files.
if (!revertProject(state.currentProjectTopLevel(), perforceRelativeProjectDirectory(state), true))
@@ -713,7 +713,7 @@ void PerforcePlugin::describeChange()
void PerforcePlugin::annotateCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
annotate(state.currentFileTopLevel(), state.relativeCurrentFile());
}
@@ -765,7 +765,7 @@ void PerforcePlugin::annotate(const QString &workingDir,
void PerforcePlugin::filelogCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
filelog(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
}
@@ -781,14 +781,14 @@ void PerforcePlugin::filelog()
void PerforcePlugin::logProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
filelog(state.currentProjectTopLevel(), perforceRelativeFileArguments(state.relativeCurrentProject()));
}
void PerforcePlugin::logRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
filelog(state.topLevel(), perforceRelativeFileArguments(QStringList()));
}
@@ -1006,7 +1006,7 @@ PerforceResponse PerforcePlugin::synchronousProcess(const QString &workingDir,
const QByteArray &stdInput,
QTextCodec *outputCodec) const
{
QTC_ASSERT(stdInput.isEmpty(), return PerforceResponse()) // Not supported here
QTC_ASSERT(stdInput.isEmpty(), return PerforceResponse()); // Not supported here
VcsBase::VcsBaseOutputWindow *outputWindow = VcsBase::VcsBaseOutputWindow::instance();
// Run, connect stderr to the output window
@@ -1404,7 +1404,7 @@ bool PerforcePlugin::submitEditorAboutToClose(VcsBase::VcsBaseSubmitEditor *subm
QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
{
QTC_ASSERT(m_settings.isValid(), return QString())
QTC_ASSERT(m_settings.isValid(), return QString());
QStringList args;
args << QLatin1String("fstat") << serverFilePath;
@@ -1423,7 +1423,7 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
QString PerforcePlugin::pendingChangesData()
{
QTC_ASSERT(m_settings.isValid(), return QString())
QTC_ASSERT(m_settings.isValid(), return QString());
QStringList args = QStringList(QLatin1String("info"));
const PerforceResponse userResponse = runP4Cmd(m_settings.topLevelSymLinkTarget(), args,
@@ -1432,7 +1432,7 @@ QString PerforcePlugin::pendingChangesData()
return QString();
QRegExp r(QLatin1String("User\\sname:\\s(\\S+)\\s*\n"));
QTC_ASSERT(r.isValid(), return QString())
QTC_ASSERT(r.isValid(), return QString());
r.setMinimal(true);
const QString user = r.indexIn(userResponse.stdOut) != -1 ? r.cap(1).trimmed() : QString();
if (user.isEmpty())
+2 -1
View File
@@ -37,6 +37,7 @@
#include <utils/qtcassert.h>
#include <utils/environment.h>
#include <QDebug>
#include <QSettings>
#include <QStringList>
#include <QCoreApplication>
@@ -238,7 +239,7 @@ void PerforceSettings::clearTopLevel()
QString PerforceSettings::relativeToTopLevel(const QString &dir) const
{
QTC_ASSERT(!m_topLevelDir.isNull(), return QLatin1String("../") + dir)
QTC_ASSERT(!m_topLevelDir.isNull(), return QLatin1String("../") + dir);
return m_topLevelDir->relativeFilePath(dir);
}
@@ -378,7 +378,7 @@ void AppOutputPane::showTabFor(RunControl *rc)
void AppOutputPane::reRunRunControl()
{
const int index = currentIndex();
QTC_ASSERT(index != -1 && !m_runControlTabs.at(index).runControl->isRunning(), return;)
QTC_ASSERT(index != -1 && !m_runControlTabs.at(index).runControl->isRunning(), return);
RunControlTab &tab = m_runControlTabs[index];
@@ -399,7 +399,7 @@ void AppOutputPane::attachToRunControl()
void AppOutputPane::stopRunControl()
{
const int index = currentIndex();
QTC_ASSERT(index != -1 && m_runControlTabs.at(index).runControl->isRunning(), return;)
QTC_ASSERT(index != -1 && m_runControlTabs.at(index).runControl->isRunning(), return);
RunControl *rc = m_runControlTabs.at(index).runControl;
if (rc->isRunning() && optionallyPromptToStop(rc))
@@ -428,7 +428,7 @@ bool AppOutputPane::closeTab(int index)
bool AppOutputPane::closeTab(int tabIndex, CloseTabMode closeTabMode)
{
int index = indexOf(m_tabWidget->widget(tabIndex));
QTC_ASSERT(index != -1, return true;)
QTC_ASSERT(index != -1, return true);
RunControlTab &tab = m_runControlTabs[index];
@@ -566,7 +566,7 @@ void AppOutputPane::slotRunControlFinished2(RunControl *sender)
{
const int senderIndex = indexOf(sender);
QTC_ASSERT(senderIndex != -1, return; )
QTC_ASSERT(senderIndex != -1, return);
// Enable buttons for current
RunControl *current = currentRunControl();
@@ -234,7 +234,7 @@ Core::GeneratedFiles CustomWizard::generateFiles(const QWizard *dialog, QString
{
// Look for the Custom field page to find the path
const Internal::CustomWizardPage *cwp = findWizardPage<Internal::CustomWizardPage>(dialog);
QTC_ASSERT(cwp, return Core::GeneratedFiles())
QTC_ASSERT(cwp, return Core::GeneratedFiles());
CustomWizardContextPtr ctx = context();
ctx->path = ctx->targetPath = cwp->path();
@@ -300,7 +300,7 @@ Core::GeneratedFiles CustomWizard::generateWizardFiles(QString *errorMessage) co
Core::GeneratedFiles rc;
const CustomWizardContextPtr ctx = context();
QTC_ASSERT(!ctx->targetPath.isEmpty(), return rc)
QTC_ASSERT(!ctx->targetPath.isEmpty(), return rc);
if (CustomWizardPrivate::verbose)
qDebug() << "CustomWizard::generateWizardFiles: in "
@@ -565,7 +565,7 @@ void CustomProjectWizard::initProjectWizardDialog(BaseProjectWizardDialog *w,
Core::GeneratedFiles CustomProjectWizard::generateFiles(const QWizard *w, QString *errorMessage) const
{
const BaseProjectWizardDialog *dialog = qobject_cast<const BaseProjectWizardDialog *>(w);
QTC_ASSERT(dialog, return Core::GeneratedFiles())
QTC_ASSERT(dialog, return Core::GeneratedFiles());
// Add project name as macro. Path is here under project directory
CustomWizardContextPtr ctx = context();
ctx->path = dialog->path();
@@ -96,7 +96,7 @@ void TextFieldComboBox::slotCurrentIndexChanged(int i)
void TextFieldComboBox::setItems(const QStringList &displayTexts,
const QStringList &values)
{
QTC_ASSERT(displayTexts.size() == values.size(), return)
QTC_ASSERT(displayTexts.size() == values.size(), return);
clear();
addItems(displayTexts);
const int count = values.count();
@@ -695,7 +695,7 @@ CustomWizardParameters::ParseResult
}
break;
case ParseWithinValidationRuleMessage:
QTC_ASSERT(!rules.isEmpty(), return ParseFailed; )
QTC_ASSERT(!rules.isEmpty(), return ParseFailed);
// This reads away the end tag, set state here.
assignLanguageElementText(reader, language, &(rules.back().message));
state = ParseWithinValidationRule;
@@ -955,7 +955,7 @@ TemporaryFileTransform::TemporaryFileTransform(TemporaryFilePtrList *f) :
QString TemporaryFileTransform::operator()(const QString &value) const
{
TemporaryFilePtr temporaryFile(new QTemporaryFile(m_pattern));
QTC_ASSERT(temporaryFile->open(), return QString(); )
QTC_ASSERT(temporaryFile->open(), return QString());
temporaryFile->write(value.toLocal8Bit());
const QString name = temporaryFile->fileName();
+10 -10
View File
@@ -2582,7 +2582,7 @@ QString ProjectExplorerPlugin::directoryFor(Node *node)
void ProjectExplorerPlugin::addNewFile()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
QString location = directoryFor(d->m_currentNode);
QVariantMap map;
@@ -2595,7 +2595,7 @@ void ProjectExplorerPlugin::addNewFile()
void ProjectExplorerPlugin::addNewSubproject()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
QString location = directoryFor(d->m_currentNode);
if (d->m_currentNode->nodeType() == ProjectNodeType
@@ -2611,7 +2611,7 @@ void ProjectExplorerPlugin::addNewSubproject()
void ProjectExplorerPlugin::addExistingFiles()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
QStringList fileNames = QFileDialog::getOpenFileNames(Core::ICore::mainWindow(),
tr("Add Existing Files"), directoryFor(d->m_currentNode));
@@ -2687,33 +2687,33 @@ void ProjectExplorerPlugin::removeProject()
void ProjectExplorerPlugin::openFile()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
Core::EditorManager *em = Core::EditorManager::instance();
em->openEditor(d->m_currentNode->path(), Core::Id(), Core::EditorManager::ModeSwitch);
}
void ProjectExplorerPlugin::searchOnFileSystem()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
FolderNavigationWidget::findOnFileSystem(pathFor(d->m_currentNode));
}
void ProjectExplorerPlugin::showInGraphicalShell()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
Core::FileUtils::showInGraphicalShell(Core::ICore::mainWindow(),
pathFor(d->m_currentNode));
}
void ProjectExplorerPlugin::openTerminalHere()
{
QTC_ASSERT(d->m_currentNode, return)
QTC_ASSERT(d->m_currentNode, return);
Core::FileUtils::openTerminal(directoryFor(d->m_currentNode));
}
void ProjectExplorerPlugin::removeFile()
{
QTC_ASSERT(d->m_currentNode && d->m_currentNode->nodeType() == FileNodeType, return)
QTC_ASSERT(d->m_currentNode && d->m_currentNode->nodeType() == FileNodeType, return);
FileNode *fileNode = qobject_cast<FileNode*>(d->m_currentNode);
@@ -2752,7 +2752,7 @@ void ProjectExplorerPlugin::removeFile()
void ProjectExplorerPlugin::deleteFile()
{
QTC_ASSERT(d->m_currentNode && d->m_currentNode->nodeType() == FileNodeType, return)
QTC_ASSERT(d->m_currentNode && d->m_currentNode->nodeType() == FileNodeType, return);
FileNode *fileNode = qobject_cast<FileNode*>(d->m_currentNode);
@@ -2766,7 +2766,7 @@ void ProjectExplorerPlugin::deleteFile()
return;
ProjectNode *projectNode = fileNode->projectNode();
Q_ASSERT(projectNode);
QTC_ASSERT(projectNode, return);
projectNode->deleteFiles(fileNode->fileType(), QStringList(filePath));
@@ -647,7 +647,7 @@ void RunControl::setApplicationProcessHandle(const ProcessHandle &handle)
bool RunControl::promptToStop(bool *optionalPrompt) const
{
QTC_ASSERT(isRunning(), return true;)
QTC_ASSERT(isRunning(), return true);
if (optionalPrompt && !*optionalPrompt)
return true;
@@ -669,7 +669,7 @@ bool RunControl::showPromptToStopDialog(const QString &title,
const QString &cancelButtonText,
bool *prompt) const
{
QTC_ASSERT(isRunning(), return true;)
QTC_ASSERT(isRunning(), return true);
// Show a question message box where user can uncheck this
// question for this class.
Utils::CheckableMessageBox messageBox(Core::ICore::mainWindow());
@@ -45,8 +45,9 @@
#include <utils/qtcprocess.h>
#include <utils/persistentsettings.h>
#include <QFile>
#include <QApplication>
#include <QDebug>
#include <QFile>
#include <QMainWindow>
#include <QMessageBox>
+2 -2
View File
@@ -159,7 +159,7 @@ int TaskModel::rowForId(unsigned int id)
void TaskModel::updateTaskFileName(unsigned int id, const QString &fileName)
{
int i = rowForId(id);
QTC_ASSERT(i != -1, return)
QTC_ASSERT(i != -1, return);
if (m_tasks.at(i).taskId == id) {
m_tasks[i].file = Utils::FileName::fromString(fileName);
emit dataChanged(index(i, 0), index(i, 0));
@@ -169,7 +169,7 @@ void TaskModel::updateTaskFileName(unsigned int id, const QString &fileName)
void TaskModel::updateTaskLineNumber(unsigned int id, int line)
{
int i = rowForId(id);
QTC_ASSERT(i != -1, return)
QTC_ASSERT(i != -1, return);
if (m_tasks.at(i).taskId == id) {
m_tasks[i].movedLine = line;
emit dataChanged(index(i, 0), index(i, 0));
@@ -190,19 +190,19 @@ void ToolChainConfigWidget::ensureDebuggerPathChooser(const QStringList &version
void ToolChainConfigWidget::addDebuggerAutoDetection(QObject *receiver, const char *autoDetectSlot)
{
QTC_ASSERT(d->m_debuggerPathChooser, return; )
QTC_ASSERT(d->m_debuggerPathChooser, return);
d->m_debuggerPathChooser->addButton(tr("Autodetect"), receiver, autoDetectSlot);
}
Utils::FileName ToolChainConfigWidget::debuggerCommand() const
{
QTC_ASSERT(d->m_debuggerPathChooser, return Utils::FileName(); )
QTC_ASSERT(d->m_debuggerPathChooser, return Utils::FileName());
return d->m_debuggerPathChooser->fileName();
}
void ToolChainConfigWidget::setDebuggerCommand(const Utils::FileName &debugger)
{
QTC_ASSERT(d->m_debuggerPathChooser, return; )
QTC_ASSERT(d->m_debuggerPathChooser, return);
d->m_debuggerPathChooser->setFileName(debugger);
}
@@ -281,7 +281,7 @@ void ToolChainConfigWidget::addErrorLabel(QGridLayout *lt, int row, int column,
void ToolChainConfigWidget::setErrorMessage(const QString &m)
{
QTC_ASSERT(d->m_errorLabel, return; )
QTC_ASSERT(d->m_errorLabel, return);
if (m.isEmpty()) {
clearErrorMessage();
} else {
@@ -293,7 +293,7 @@ void ToolChainConfigWidget::setErrorMessage(const QString &m)
void ToolChainConfigWidget::clearErrorMessage()
{
QTC_ASSERT(d->m_errorLabel, return; )
QTC_ASSERT(d->m_errorLabel, return);
d->m_errorLabel->clear();
d->m_errorLabel->setStyleSheet(QString());
d->m_errorLabel->setVisible(false);
@@ -257,7 +257,7 @@ void FileFilterBaseItem::updateFileListNow()
const QSet<QString> watchDirs = dirsToBeWatched - oldDirs;
if (!unwatchDirs.isEmpty()) {
QTC_ASSERT(m_dirWatcher, return ; )
QTC_ASSERT(m_dirWatcher, return);
m_dirWatcher->removeDirectories(unwatchDirs.toList());
}
if (!watchDirs.isEmpty())
@@ -219,7 +219,7 @@ void QmlProjectRunConfigurationWidget::setMainScript(int index)
void QmlProjectRunConfigurationWidget::onQtVersionSelectionChanged()
{
QVariant data = m_qtVersionComboBox->itemData(m_qtVersionComboBox->currentIndex());
QTC_ASSERT(data.isValid() && data.canConvert(QVariant::Int), return)
QTC_ASSERT(data.isValid() && data.canConvert(QVariant::Int), return);
m_runConfiguration->setQtVersionId(data.toInt());
m_runConfiguration->updateEnabled();
m_environmentWidget->setBaseEnvironment(m_runConfiguration->baseEnvironment());
@@ -71,7 +71,7 @@ ClassModel::ClassModel(QObject *parent) :
m_validator(QLatin1String("^[a-zA-Z][a-zA-Z0-9_]*$")),
m_newClassPlaceHolder(ClassList::tr("<New class>"))
{
QTC_ASSERT(m_validator.isValid(), return)
QTC_ASSERT(m_validator.isValid(), return);
appendPlaceHolder();
}
@@ -123,7 +123,7 @@ QString ClassList::className(int row) const
void ClassList::classEdited()
{
const QModelIndex index = currentIndex();
QTC_ASSERT(index.isValid(), return)
QTC_ASSERT(index.isValid(), return);
const QString name = className(index.row());
if (index == m_model->placeHolderIndex()) {
@@ -155,7 +155,7 @@ bool S60RunControlBase::promptToStop(bool *optionalPrompt) const
{
Q_UNUSED(optionalPrompt)
// We override the settings prompt
QTC_ASSERT(isRunning(), return true;)
QTC_ASSERT(isRunning(), return true);
const QString question = tr("<html><head/><body><center><i>%1</i> is still running on the device.</center>"
"<center>Terminating it can leave the target in an inconsistent state.</center>"
@@ -100,7 +100,7 @@ static inline bool isFormWindowEditor(const QObject *o)
static inline QString formWindowEditorContents(const QObject *editor)
{
const QVariant contentV = editor->property("contents");
QTC_ASSERT(contentV.isValid(), return QString(); )
QTC_ASSERT(contentV.isValid(), return QString());
return contentV.toString();
}
@@ -154,7 +154,7 @@ Core::GeneratedFiles TestWizard::generateFiles(const QWizard *w, QString *errorM
Q_UNUSED(errorMessage)
const TestWizardDialog *wizardDialog = qobject_cast<const TestWizardDialog *>(w);
QTC_ASSERT(wizardDialog, return Core::GeneratedFiles())
QTC_ASSERT(wizardDialog, return Core::GeneratedFiles());
const QtProjectParameters projectParams = wizardDialog->projectParameters();
const TestWizardParameters testParams = wizardDialog->testParameters();
@@ -129,7 +129,7 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(const BaseQtVersion *version,
DebuggingHelperBuildTask::Tools DebuggingHelperBuildTask::availableTools(const BaseQtVersion *version)
{
QTC_ASSERT(version, return 0; )
QTC_ASSERT(version, return 0);
// Check the build requirements of the tools
DebuggingHelperBuildTask::Tools tools = 0;
// Gdb helpers are needed on Mac/gdb only.
+3 -2
View File
@@ -56,12 +56,13 @@
# include <utils/winutils.h>
#endif
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QMainWindow>
#include <QSettings>
#include <QTextStream>
#include <QDir>
#include <QTimer>
#include <QMainWindow>
#include <algorithm>
+1 -1
View File
@@ -83,7 +83,7 @@ QSharedPointer<VcsBase::AbstractCheckoutJob> CheckoutWizard::createJob(const QLi
{
// Collect parameters for the checkout command.
const CheckoutWizardPage *cwp = qobject_cast<const CheckoutWizardPage *>(parameterPages.front());
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>())
QTC_ASSERT(cwp, return QSharedPointer<VcsBase::AbstractCheckoutJob>());
const SubversionSettings settings = SubversionPlugin::instance()->settings();
const QString binary = settings.svnCommand;
const QString directory = cwp->directory();
+15 -15
View File
@@ -620,7 +620,7 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet
setDiffBaseDirectory(editor, p.workingDir);
VcsBase::VcsBaseEditorWidget::tagEditor(editor, tag);
SubversionEditor *diffEditorWidget = qobject_cast<SubversionEditor *>(editor->widget());
QTC_ASSERT(diffEditorWidget, return ; )
QTC_ASSERT(diffEditorWidget, return);
// Wire up the parameter widget to trigger a re-run on
// parameter change and 'revert' from inside the diff editor.
@@ -685,14 +685,14 @@ void SubversionPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)
void SubversionPlugin::addCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
vcsAdd(state.currentFileTopLevel(), state.relativeCurrentFile());
}
void SubversionPlugin::revertAll()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
const QString title = tr("Revert repository");
if (QMessageBox::warning(0, title, tr("Revert all pending changes to the repository?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
@@ -713,7 +713,7 @@ void SubversionPlugin::revertAll()
void SubversionPlugin::revertCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
QStringList args(QLatin1String("diff"));
args.push_back(state.relativeCurrentFile());
@@ -748,21 +748,21 @@ void SubversionPlugin::revertCurrentFile()
void SubversionPlugin::diffProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
svnDiff(state.currentProjectTopLevel(), state.relativeCurrentProject(), state.currentProjectName());
}
void SubversionPlugin::diffCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
svnDiff(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
void SubversionPlugin::startCommitCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
startCommit(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()));
}
@@ -844,49 +844,49 @@ bool SubversionPlugin::commit(const QString &messageFile,
void SubversionPlugin::filelogCurrentFile()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
filelog(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
QTC_ASSERT(state.hasFile(), return);
filelog(state.currentFileTopLevel(), QStringList(state.relativeCurrentFile()), true);
}
void SubversionPlugin::logProject()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasProject(), return)
QTC_ASSERT(state.hasProject(), return);
filelog(state.currentProjectTopLevel(), state.relativeCurrentProject());
}
void SubversionPlugin::logRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
filelog(state.topLevel());
}
void SubversionPlugin::diffRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
svnDiff(state.topLevel(), QStringList());
}
void SubversionPlugin::statusRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
svnStatus(state.topLevel());
}
void SubversionPlugin::updateRepository()
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
svnUpdate(state.topLevel());
}
void SubversionPlugin::svnStatus(const QString &workingDir, const QStringList &relativePaths)
{
const VcsBase::VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasTopLevel(), return)
QTC_ASSERT(state.hasTopLevel(), return);
QStringList args(QLatin1String("status"));
if (!relativePaths.isEmpty())
args.append(relativePaths);
+1 -1
View File
@@ -196,7 +196,7 @@ ITextMarkable *BaseTextDocument::documentMarker() const
{
BaseTextDocumentLayout *documentLayout =
qobject_cast<BaseTextDocumentLayout *>(d->m_document->documentLayout());
QTC_ASSERT(documentLayout, return 0)
QTC_ASSERT(documentLayout, return 0);
return documentLayout->markableInterface();
}
@@ -124,7 +124,7 @@ void DocumentMarker::removeMarkFromMarksCache(TextEditor::ITextMark *mark)
{
BaseTextDocumentLayout *documentLayout =
qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
QTC_ASSERT(documentLayout, return)
QTC_ASSERT(documentLayout, return);
bool needUpdate = m_marksCache.removeOne(mark);
if (m_marksCache.isEmpty()) {
documentLayout->hasMarks = false;
@@ -141,7 +141,7 @@ void DocumentMarker::removeMark(TextEditor::ITextMark *mark)
{
BaseTextDocumentLayout *documentLayout =
qobject_cast<BaseTextDocumentLayout*>(document->documentLayout());
QTC_ASSERT(documentLayout, return)
QTC_ASSERT(documentLayout, return);
QTextBlock block = document->begin();
while (block.isValid()) {
+4 -3
View File
@@ -36,13 +36,14 @@
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QFileInfo>
#include <QSettings>
#include <QCoreApplication>
#include <QTextCharFormat>
#include <QFont>
#include <QMainWindow>
#include <QSettings>
#include <QTextCharFormat>
static const char fontFamilyKey[] = "FontFamily";
static const char fontSizeKey[] = "FontSize";
+2 -2
View File
@@ -531,10 +531,10 @@ void FontSettingsPage::confirmDeleteColorScheme()
void FontSettingsPage::deleteColorScheme()
{
const int index = d_ptr->m_ui->schemeComboBox->currentIndex();
QTC_ASSERT(index != -1, return)
QTC_ASSERT(index != -1, return);
const ColorSchemeEntry &entry = d_ptr->m_schemeListModel->colorSchemeAt(index);
QTC_ASSERT(!entry.readOnly, return)
QTC_ASSERT(!entry.readOnly, return);
if (QFile::remove(entry.fileName))
d_ptr->m_schemeListModel->removeColorScheme(index);
@@ -182,7 +182,7 @@ bool WidgetContent::equals(const TipContent &tipContent) const
bool WidgetContent::pinToolTip(QWidget *w)
{
QTC_ASSERT(w, return false; )
QTC_ASSERT(w, return false);
// Find the parent WidgetTip, tell it to pin/release the
// widget and close.
for (QWidget *p = w->parentWidget(); p ; p = p->parentWidget()) {
@@ -55,6 +55,6 @@ Internal::QTipLabel *TipFactory::createTip(const TipContent &content, QWidget *w
if (content.typeId() == WidgetContent::WIDGET_CONTENT_ID)
return new WidgetTip(w);
QTC_ASSERT(false, return 0; )
QTC_CHECK(false);
return 0;
}
+3 -3
View File
@@ -236,7 +236,7 @@ void WidgetTip::configure(const QPoint &pos, QWidget *)
const WidgetContent &anyContent = static_cast<const WidgetContent &>(content());
QWidget *widget = anyContent.widget();
QTC_ASSERT(widget && m_layout->count() == 0, return; )
QTC_ASSERT(widget && m_layout->count() == 0, return);
move(pos);
m_layout->addWidget(widget);
@@ -246,13 +246,13 @@ void WidgetTip::configure(const QPoint &pos, QWidget *)
void WidgetTip::pinToolTipWidget()
{
QTC_ASSERT(m_layout->count(), return; )
QTC_ASSERT(m_layout->count(), return);
// Pin the content widget: Rip the widget out of the layout
// and re-show as a tooltip, with delete on close.
const QPoint screenPos = mapToGlobal(QPoint(0, 0));
QWidget *widget = takeWidget(Qt::ToolTip);
QTC_ASSERT(widget, return; )
QTC_ASSERT(widget, return);
widget->move(screenPos);
widget->show();
@@ -94,14 +94,13 @@ QString toOptionString(CallgrindController::Option option)
}
}
void CallgrindController::run(Option option)
{
if (m_process) {
emit statusMessage(tr("Previous command has not yet finished."));
return;
}
QTC_ASSERT(m_valgrindProc, return)
QTC_ASSERT(m_valgrindProc, return);
if (RemoteValgrindProcess *remote = qobject_cast<RemoteValgrindProcess *>(m_valgrindProc))
m_process = new RemoteValgrindProcess(remote->connection(), this);
@@ -150,7 +149,7 @@ void CallgrindController::run(Option option)
void CallgrindController::processError(QProcess::ProcessError)
{
QTC_ASSERT(m_process, return)
QTC_ASSERT(m_process, return);
const QString error = m_process->errorString();
emit statusMessage(QString("An error occurred while trying to run %1: %2").arg(CALLGRIND_CONTROL_BINARY).arg(error));
@@ -146,7 +146,7 @@ void DataModel::setCostEvent(int event)
if (!d->m_data)
return;
QTC_ASSERT(event >= 0 && d->m_data->events().size() > event, return)
QTC_ASSERT(event >= 0 && d->m_data->events().size() > event, return);
beginResetModel();
d->m_event = event;
d->updateFunctions();
@@ -177,7 +177,7 @@ QString ParseData::prettyStringForEvent(const QString &event)
Indirect branches executed (Bi) and indirect branches mispredicted (Bim)
*/
QTC_ASSERT(event.size() >= 2, return event) // should not happen
QTC_ASSERT(event.size() >= 2, return event); // should not happen
const bool isMiss = event.contains(QLatin1Char('m')); // else hit
const bool isRead = event.contains(QLatin1Char('r')); // else write
@@ -268,7 +268,7 @@ void Parser::Private::parse(QIODevice *device)
}
}
#endif
QTC_ASSERT(calledFunction, continue)
QTC_ASSERT(calledFunction, continue);
callData.call->setCallee(calledFunction);
calledFunction->addIncomingCall(callData.call);
@@ -151,9 +151,9 @@ bool DataProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_
// check minimum inclusive costs
DataModel *model = dataModel();
QTC_ASSERT(model, return false) // as always: this should never happen
QTC_ASSERT(model, return false); // as always: this should never happen
const ParseData *data = model->parseData();
QTC_ASSERT(data, return false)
QTC_ASSERT(data, return false);
if (m_minimumInclusiveCostRatio != 0.0) {
const quint64 totalCost = data->totalCost(0);
const quint64 inclusiveCost = func->inclusiveCost(0);
+2 -2
View File
@@ -59,8 +59,8 @@ void CallgrindTextMark::paint(QPainter *painter, const QRect &paintRect) const
bool ok;
qreal costs = m_modelIndex.data(RelativeTotalCostRole).toReal(&ok);
QTC_ASSERT(ok, return)
QTC_ASSERT(costs >= 0.0 && costs <= 100.0, return)
QTC_ASSERT(ok, return);
QTC_ASSERT(costs >= 0.0 && costs <= 100.0, return);
painter->save();
+5 -5
View File
@@ -399,7 +399,7 @@ void CallgrindToolPrivate::updateCostFormat()
void CallgrindToolPrivate::handleFilterProjectCosts()
{
ProjectExplorer::Project *pro = ProjectExplorer::ProjectExplorerPlugin::currentProject();
QTC_ASSERT(pro, return)
QTC_ASSERT(pro, return);
if (m_filterProjectCosts->isChecked()) {
const QString projectDir = pro->projectDirectory();
@@ -472,7 +472,7 @@ void CallgrindToolPrivate::setParseData(ParseData *data)
void CallgrindToolPrivate::updateEventCombo()
{
QTC_ASSERT(m_eventCombo, return)
QTC_ASSERT(m_eventCombo, return);
m_eventCombo->clear();
@@ -920,10 +920,10 @@ void CallgrindToolPrivate::requestContextMenu(TextEditor::ITextEditor *editor, i
void CallgrindToolPrivate::handleShowCostsAction()
{
const QAction *action = qobject_cast<QAction *>(sender());
QTC_ASSERT(action, return)
QTC_ASSERT(action, return);
const Function *func = action->data().value<const Function *>();
QTC_ASSERT(func, return)
QTC_ASSERT(func, return);
selectFunction(func);
}
@@ -972,7 +972,7 @@ void CallgrindToolPrivate::takeParserData(CallgrindEngine *engine)
void CallgrindToolPrivate::createTextMarks()
{
DataModel *model = m_dataModel;
QTC_ASSERT(model, return)
QTC_ASSERT(model, return);
QList<QString> locations;
for (int row = 0; row < model->rowCount(); ++row) {
+1 -1
View File
@@ -72,7 +72,7 @@ static QString suppressionText(const Error &error)
// workaround: https://bugs.kde.org/show_bug.cgi?id=255822
if (sup.frames().size() >= 24)
sup.setFrames(sup.frames().mid(0, 23));
QTC_ASSERT(sup.frames().size() < 24, /**/)
QTC_ASSERT(sup.frames().size() < 24, /**/);
// try to set some useful name automatically, instead of "insert_name_here"
// we take the last stack frame and append the suppression kind, e.g.:
+1 -1
View File
@@ -179,7 +179,7 @@ void ProcessCheckoutJob::slotFinished (int exitCode, QProcess::ExitStatus exitSt
void ProcessCheckoutJob::start()
{
QTC_ASSERT(!d->stepQueue.empty(), return)
QTC_ASSERT(!d->stepQueue.empty(), return);
slotNext();
}
@@ -74,7 +74,7 @@ void CheckoutProgressWizardPage::start(const QSharedPointer<AbstractCheckoutJob>
return;
}
QTC_ASSERT(m_state != Running, return)
QTC_ASSERT(m_state != Running, return);
m_job = job;
connect(job.data(), SIGNAL(output(QString)), ui->logPlainTextEdit, SLOT(appendPlainText(QString)));
connect(job.data(), SIGNAL(failed(QString)), this, SLOT(slotFailed(QString)));
+3 -3
View File
@@ -871,7 +871,7 @@ void VcsBaseEditorWidget::slotDiffCursorPositionChanged()
{
// Adapt diff file browse combo to new position
// if the cursor goes across a file line.
QTC_ASSERT(d->m_parameters->type == DiffOutput, return)
QTC_ASSERT(d->m_parameters->type == DiffOutput, return);
const int newCursorLine = textCursor().blockNumber();
if (newCursorLine == d->m_cursorLine)
return;
@@ -1104,8 +1104,8 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor)
// cut out chunk and determine file name.
DiffChunk VcsBaseEditorWidget::diffChunk(QTextCursor cursor) const
{
QTC_ASSERT(d->m_parameters->type == DiffOutput, return DiffChunk(); )
DiffChunk rc;
QTC_ASSERT(d->m_parameters->type == DiffOutput, return rc);
// Search back for start of chunk.
QTextBlock block = cursor.block();
if (block.isValid() && TextEditor::BaseTextDocumentLayout::foldingIndent(block) <= 1)
@@ -1441,7 +1441,7 @@ bool VcsBaseEditorWidget::applyDiffChunk(const DiffChunk &dc, bool revert) const
void VcsBaseEditorWidget::slotApplyDiffChunk()
{
const QAction *a = qobject_cast<QAction *>(sender());
QTC_ASSERT(a, return ; )
QTC_ASSERT(a, return);
const Internal::DiffChunkAction chunkAction = qvariant_cast<Internal::DiffChunkAction>(a->data());
const QString title = chunkAction.revert ? tr("Revert Chunk") : tr("Apply Chunk");
const QString question = chunkAction.revert ?
+7 -7
View File
@@ -366,7 +366,7 @@ QString VcsBasePluginState::currentFileDirectory() const
QString VcsBasePluginState::relativeCurrentFile() const
{
QTC_ASSERT(hasFile(), return QString())
QTC_ASSERT(hasFile(), return QString());
return QDir(data->m_state.currentFileTopLevel).relativeFilePath(data->m_state.currentFile);
}
@@ -398,7 +398,7 @@ QString VcsBasePluginState::currentProjectTopLevel() const
QStringList VcsBasePluginState::relativeCurrentProject() const
{
QStringList rc;
QTC_ASSERT(hasProject(), return rc)
QTC_ASSERT(hasProject(), return rc);
if (data->m_state.currentProjectTopLevel != data->m_state.currentProjectPath)
rc.append(QDir(data->m_state.currentProjectTopLevel).relativeFilePath(data->m_state.currentProjectPath));
return rc;
@@ -621,7 +621,7 @@ bool VcsBasePlugin::enableMenuAction(ActionState as, QAction *menuAction) const
void VcsBasePlugin::promptToDeleteCurrentFile()
{
const VcsBasePluginState state = currentState();
QTC_ASSERT(state.hasFile(), return)
QTC_ASSERT(state.hasFile(), return);
const bool rc = Core::ICore::vcsManager()->promptToDelete(versionControl(), state.currentFile());
if (!rc)
QMessageBox::warning(0, tr("Version Control"),
@@ -694,7 +694,7 @@ QList<QAction*> VcsBasePlugin::createSnapShotTestActions()
void VcsBasePlugin::slotTestSnapshot()
{
QTC_ASSERT(currentState().hasTopLevel(), return)
QTC_ASSERT(currentState().hasTopLevel(), return);
d->m_testLastSnapshot = versionControl()->vcsCreateSnapshot(currentState().topLevel());
qDebug() << "Snapshot " << d->m_testLastSnapshot;
VcsBaseOutputWindow::instance()->append(QLatin1String("Snapshot: ") + d->m_testLastSnapshot);
@@ -704,7 +704,7 @@ void VcsBasePlugin::slotTestSnapshot()
void VcsBasePlugin::slotTestListSnapshots()
{
QTC_ASSERT(currentState().hasTopLevel(), return)
QTC_ASSERT(currentState().hasTopLevel(), return);
const QStringList snapshots = versionControl()->vcsSnapshots(currentState().topLevel());
qDebug() << "Snapshots " << snapshots;
VcsBaseOutputWindow::instance()->append(QLatin1String("Snapshots: ") + snapshots.join(QLatin1String(", ")));
@@ -712,7 +712,7 @@ void VcsBasePlugin::slotTestListSnapshots()
void VcsBasePlugin::slotTestRestoreSnapshot()
{
QTC_ASSERT(currentState().hasTopLevel() && !d->m_testLastSnapshot.isEmpty(), return)
QTC_ASSERT(currentState().hasTopLevel() && !d->m_testLastSnapshot.isEmpty(), return);
const bool ok = versionControl()->vcsRestoreSnapshot(currentState().topLevel(), d->m_testLastSnapshot);
const QString msg = d->m_testLastSnapshot+ (ok ? QLatin1String(" restored") : QLatin1String(" failed"));
qDebug() << msg;
@@ -721,7 +721,7 @@ void VcsBasePlugin::slotTestRestoreSnapshot()
void VcsBasePlugin::slotTestRemoveSnapshot()
{
QTC_ASSERT(currentState().hasTopLevel() && !d->m_testLastSnapshot.isEmpty(), return)
QTC_ASSERT(currentState().hasTopLevel() && !d->m_testLastSnapshot.isEmpty(), return);
const bool ok = versionControl()->vcsRemoveSnapshot(currentState().topLevel(), d->m_testLastSnapshot);
const QString msg = d->m_testLastSnapshot+ (ok ? QLatin1String(" removed") : QLatin1String(" failed"));
qDebug() << msg;