Merge topic 'clang-tidy'

73128b82 cmDependsFortran: simplify boolean expression
8f324c7c cmSystemTools: simplify boolean expressions
5d3b5bef QCMakeCacheView: simplify boolean expression
ad42eb33 QCMakeCacheView: no else after return
This commit is contained in:
Brad King 2016-09-12 09:31:45 -04:00 committed by CMake Topic Stage
commit 03bae46865
3 changed files with 12 additions and 28 deletions

View File

@ -95,10 +95,7 @@ protected:
// if there are no children // if there are no children
if (!m->hasChildren(idx)) { if (!m->hasChildren(idx)) {
bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool(); bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool();
if (!adv || (adv && this->ShowAdvanced)) { return !adv || this->ShowAdvanced;
return true;
}
return false;
} }
// check children // check children
@ -554,14 +551,16 @@ QWidget* QCMakeCacheModelDelegate::createEditor(
QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this,
SLOT(setFileDialogFlag(bool))); SLOT(setFileDialogFlag(bool)));
return editor; return editor;
} else if (type == QCMakeProperty::FILEPATH) { }
if (type == QCMakeProperty::FILEPATH) {
QCMakeFilePathEditor* editor = QCMakeFilePathEditor* editor =
new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString()); new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString());
QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this,
SLOT(setFileDialogFlag(bool))); SLOT(setFileDialogFlag(bool)));
return editor; return editor;
} else if (type == QCMakeProperty::STRING && }
var.data(QCMakeCacheModel::StringsRole).isValid()) { if (type == QCMakeProperty::STRING &&
var.data(QCMakeCacheModel::StringsRole).isValid()) {
QCMakeComboBox* editor = new QCMakeComboBox( QCMakeComboBox* editor = new QCMakeComboBox(
p, var.data(QCMakeCacheModel::StringsRole).toStringList()); p, var.data(QCMakeCacheModel::StringsRole).toStringList());
editor->setFrame(false); editor->setFrame(false);

View File

@ -712,10 +712,5 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
// Compare the remaining content. If no compiler id matched above, // Compare the remaining content. If no compiler id matched above,
// including the case none was given, this will compare the whole // including the case none was given, this will compare the whole
// content. // content.
if (!cmFortranStreamsDiffer(finModFile, finStampFile)) { return cmFortranStreamsDiffer(finModFile, finStampFile);
return false;
}
// The modules are different.
return true;
} }

View File

@ -1766,9 +1766,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile)
if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) { if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) {
return false; return false;
} }
if (!SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite)) { return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0;
return false;
}
#else #else
struct stat fromStat; struct stat fromStat;
if (stat(fromFile, &fromStat) < 0) { if (stat(fromFile, &fromStat) < 0) {
@ -1778,11 +1776,8 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile)
struct utimbuf buf; struct utimbuf buf;
buf.actime = fromStat.st_atime; buf.actime = fromStat.st_atime;
buf.modtime = fromStat.st_mtime; buf.modtime = fromStat.st_mtime;
if (utime(toFile, &buf) < 0) { return utime(toFile, &buf) >= 0;
return false;
}
#endif #endif
return true;
} }
cmSystemToolsFileTime* cmSystemTools::FileTimeNew() cmSystemToolsFileTime* cmSystemTools::FileTimeNew()
@ -1828,16 +1823,11 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t)
if (!h) { if (!h) {
return false; return false;
} }
if (!SetFileTime(h, &t->timeCreation, &t->timeLastAccess, return SetFileTime(h, &t->timeCreation, &t->timeLastAccess,
&t->timeLastWrite)) { &t->timeLastWrite) != 0;
return false;
}
#else #else
if (utime(fname, &t->timeBuf) < 0) { return utime(fname, &t->timeBuf) >= 0;
return false;
}
#endif #endif
return true;
} }
#ifdef _WIN32 #ifdef _WIN32