forked from qt-creator/qt-creator
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -335,9 +335,8 @@ bool PluginManager::hasError()
|
||||
{
|
||||
foreach (PluginSpec *spec, plugins()) {
|
||||
// only show errors on startup if plugin is enabled.
|
||||
if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly()) {
|
||||
if (spec->hasError() && spec->isEnabled() && !spec->isDisabledIndirectly())
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -505,11 +504,10 @@ QString PluginManager::serializedArguments()
|
||||
foreach (const QString &argument, m_instance->d->arguments) {
|
||||
rc += separator;
|
||||
const QFileInfo fi(argument);
|
||||
if (fi.exists() && fi.isRelative()) {
|
||||
if (fi.exists() && fi.isRelative())
|
||||
rc += fi.absoluteFilePath();
|
||||
} else {
|
||||
else
|
||||
rc += argument;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
@@ -857,9 +855,8 @@ void PluginManagerPrivate::writeSettings()
|
||||
*/
|
||||
void PluginManagerPrivate::readSettings()
|
||||
{
|
||||
if (globalSettings) {
|
||||
if (globalSettings)
|
||||
defaultDisabledPlugins = globalSettings->value(QLatin1String(C_IGNORED_PLUGINS)).toStringList();
|
||||
}
|
||||
if (settings) {
|
||||
disabledPlugins = settings->value(QLatin1String(C_IGNORED_PLUGINS)).toStringList();
|
||||
forceEnabledPlugins = settings->value(QLatin1String(C_FORCEENABLED_PLUGINS)).toStringList();
|
||||
@@ -996,9 +993,8 @@ void PluginManagerPrivate::shutdown()
|
||||
shutdownEventLoop->exec();
|
||||
}
|
||||
deleteAll();
|
||||
if (!allObjects.isEmpty()) {
|
||||
if (!allObjects.isEmpty())
|
||||
qDebug() << "There are" << allObjects.size() << "objects left in the plugin manager pool: " << allObjects;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -1270,11 +1266,10 @@ void PluginManagerPrivate::profilingReport(const char *what, const PluginSpec *s
|
||||
const int absoluteElapsedMS = m_profileTimer->elapsed();
|
||||
const int elapsedMS = absoluteElapsedMS - m_profileElapsedMS;
|
||||
m_profileElapsedMS = absoluteElapsedMS;
|
||||
if (spec) {
|
||||
if (spec)
|
||||
qDebug("%-22s %-22s %8dms (%8dms)", what, qPrintable(spec->name()), absoluteElapsedMS, elapsedMS);
|
||||
} else {
|
||||
else
|
||||
qDebug("%-45s %8dms (%8dms)", what, absoluteElapsedMS, elapsedMS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user