Commit 7f626b11 authored by Eike Ziller's avatar Eike Ziller

Merge remote-tracking branch 'origin/4.5'

Change-Id: Iceaa4ca40b5318744bde8a76c6d3ccca08df71bb
parents 81f5c1c8 dd609237
......@@ -14,6 +14,11 @@ function readOutput(executable, args)
return output;
}
function readListOutput(executable, args)
{
return readOutput(executable, args).split(/\s+/);
}
function isSuitableLLVMConfig(llvmConfigCandidate, qtcFunctions)
{
if (File.exists(llvmConfigCandidate)) {
......@@ -75,3 +80,66 @@ function libraries(targetOS)
{
return targetOS.contains("windows") ? ["libclang.lib", "advapi32.lib", "shell32.lib"] : ["clang"]
}
function toolingLibs(llvmConfig, targetOS)
{
var fixedList = [
"clangTooling",
"clangFrontend",
"clangIndex",
"clangParse",
"clangSerialization",
"clangSema",
"clangEdit",
"clangAnalysis",
"clangDriver",
"clangDynamicASTMatchers",
"clangASTMatchers",
"clangToolingCore",
"clangAST",
"clangLex",
"clangBasic",
];
if (targetOS.contains("windows"))
fixedList.push("version");
var dynamicList = readListOutput(llvmConfig, ["--libs"])
.concat(readListOutput(llvmConfig, ["--system-libs"]));
return fixedList.concat(dynamicList.map(function(s) {
return s.startsWith("-l") ? s.slice(2) : s;
}));
}
function toolingParameters(llvmConfig)
{
var params = {
defines: [],
includes: [],
cxxFlags: [],
};
var allCxxFlags = readListOutput(llvmConfig, ["--cxxflags"]);
for (var i = 0; i < allCxxFlags.length; ++i) {
var flag = allCxxFlags[i];
if (flag.startsWith("-D") || flag.startsWith("/D")) {
params.defines.push(flag.slice(2));
continue;
}
if (flag.startsWith("-I") || flag.startsWith("/I")) {
params.includes.push(flag.slice(2));
continue;
}
if (!flag.startsWith("-std") && !flag.startsWith("-O") && !flag.startsWith("/O")
&& !flag.startsWith("-march")
&& !flag.startsWith("/EH") && flag !== "-fno-exceptions"
&& flag !== "/W4" && flag !== "-Werror=date-time"
&& flag !== "-Wcovered-switch-default" && flag !== "-fPIC" && flag !== "-pedantic"
&& flag !== "-Wstring-conversion" && flag !== "-gsplit-dwarf") {
params.cxxFlags.push(flag);
}
}
return params;
}
function buildMode(llvmConfig)
{
return readOutput(llvmConfig, ["--build-mode"]);
}
import qbs
import qbs.Environment
import qbs.File
import qbs.Utilities
import QtcFunctions
import "functions.js" as ClangFunctions
......@@ -12,6 +14,11 @@ Module {
property string llvmIncludeDir
property string llvmLibDir
property stringList llvmLibs
property stringList llvmToolingLibs
property stringList llvmToolingDefines
property stringList llvmToolingIncludes
property stringList llvmToolingCxxFlags
property string llvmBuildMode
configure: {
llvmConfig = ClangFunctions.llvmConfig(qbs, QtcFunctions);
......@@ -19,6 +26,12 @@ Module {
llvmIncludeDir = ClangFunctions.includeDir(llvmConfig);
llvmLibDir = ClangFunctions.libDir(llvmConfig);
llvmLibs = ClangFunctions.libraries(qbs.targetOS);
llvmToolingLibs = ClangFunctions.toolingLibs(llvmConfig, qbs.targetOS);
llvmBuildMode = ClangFunctions.buildMode(llvmConfig);
var toolingParams = ClangFunctions.toolingParameters(llvmConfig);
llvmToolingDefines = toolingParams.defines;
llvmToolingIncludes = toolingParams.includes;
llvmToolingCxxFlags = toolingParams.cxxFlags;
found = llvmConfig && File.exists(llvmIncludeDir.concat("/clang-c/Index.h"));
}
}
......@@ -28,6 +41,17 @@ Module {
property string llvmIncludeDir: clangProbe.llvmIncludeDir
property string llvmLibDir: clangProbe.llvmLibDir
property stringList llvmLibs: clangProbe.llvmLibs
property stringList llvmToolingLibs: clangProbe.llvmToolingLibs
property string llvmBuildMode: clangProbe.llvmBuildMode
property bool llvmBuildModeMatches: qbs.buildVariant === llvmBuildMode.toLowerCase()
property stringList llvmToolingDefines: clangProbe.llvmToolingDefines
property stringList llvmToolingIncludes: clangProbe.llvmToolingIncludes.filter(function(incl) {
return incl != llvmIncludeDir;
})
property stringList llvmToolingCxxFlags: clangProbe.llvmToolingCxxFlags
property bool toolingEnabled: !Environment.getEnv("QTC_NO_CLANG_LIBTOOLING")
&& Utilities.versionCompare(llvmVersion, "3.9") > 0
&& Utilities.versionCompare(llvmVersion, "4") < 0
validate: {
if (!clangProbe.found) {
......
......@@ -157,6 +157,8 @@ osx {
INSTALL_APP_PATH = $$QTC_PREFIX/bin
}
gcc:!clang: QMAKE_CXXFLAGS += -Wno-noexcept-type
RELATIVE_PLUGIN_PATH = $$relative_path($$IDE_PLUGIN_PATH, $$IDE_BIN_PATH)
RELATIVE_LIBEXEC_PATH = $$relative_path($$IDE_LIBEXEC_PATH, $$IDE_BIN_PATH)
RELATIVE_DATA_PATH = $$relative_path($$IDE_DATA_PATH, $$IDE_BIN_PATH)
......
#!/usr/bin/perl -w
############################################################################
#
# Copyright (C) 2017 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and The Qt Company. For licensing terms
# and conditions see https://www.qt.io/terms-conditions. For further
# information use the contact form at https://www.qt.io/contact-us.
#
# GNU General Public License Usage
# Alternatively, this file may be used under the terms of the GNU
# General Public License version 3 as published by the Free Software
# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
# included in the packaging of this file. Please review the following
# information to ensure the GNU General Public License requirements will
# be met: https://www.gnu.org/licenses/gpl-3.0.html.
#
############################################################################
=head1 NAME
clazyweb2tasks.pl - Convert Clazy logs as displayed by the Web frontend into
Qt Creator task files.
Expected format:
Explanation for clazy-strict-iterators
./qtbase/src/tools/moc/preprocessor.cpp
line 995: for (Symbols::const_iterator j = mergeSymbol + 1; j != i; ++j)
=> Mixing iterators with const_iterators
=head1 SYNOPSIS
clazyweb2tasks.pl < logfile > taskfile
=cut
use strict;
my $message = '';
my $fileName = '';
while (my $line = <STDIN> ) {
chomp($line);
if ($line =~ /\s*Explanation for (.*)$/) {
$message = $1;
} elsif (index($line, './') == 0) {
$fileName = substr($line, 2);
} elsif ($line =~ /\s*line (\d+):/) {
my $lineNumber = $1;
print $fileName, "\t", $lineNumber, "\tclazy\t", $message,"\n";
}
}
......@@ -307,7 +307,7 @@ def main():
QT_INSTALL_QML = qt_install_info['QT_INSTALL_QML']
QT_INSTALL_TRANSLATIONS = qt_install_info['QT_INSTALL_TRANSLATIONS']
plugins = ['accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes', 'platforminputcontexts', 'platforms', 'printsupport', 'sqldrivers', 'xcbglintegrations']
plugins = ['accessible', 'codecs', 'designer', 'iconengines', 'imageformats', 'platformthemes', 'platforminputcontexts', 'platforms', 'printsupport', 'sqldrivers', 'styles', 'xcbglintegrations']
imports = ['Qt', 'QtWebKit']
if common.is_windows_platform():
......
......@@ -702,7 +702,7 @@ class Dumper(DumperBase):
self.typesToReport = {}
if self.forceQtNamespace:
self.qtNamepaceToReport = self.qtNamespace()
self.qtNamespaceToReport = self.qtNamespace()
if self.qtNamespaceToReport:
self.output += ',qtnamespace="%s"' % self.qtNamespaceToReport
......@@ -996,8 +996,13 @@ class Dumper(DumperBase):
name = objfile.filename
if self.isWindowsTarget():
isQtCoreObjFile = name.find('Qt5Cored.dll') >= 0 or name.find('Qt5Core.dll') >= 0
if not isQtCoreObjFile:
isQtCoreObjFile = name.find('QtCored.dll') >= 0 or name.find('QtCore.dll') >= 0
else:
isQtCoreObjFile = name.find('/libQt5Core') >= 0
if not isQtCoreObjFile:
isQtCoreObjFile = name.find('/libQtCore') >= 0
if isQtCoreObjFile:
self.handleQtCoreLoaded(objfile)
......@@ -1019,6 +1024,13 @@ class Dumper(DumperBase):
if len(ns):
ns += '::'
break
if line.find('currentThreadData ') >= 0:
# [ 0] b 0x7ffff67d3000 _ZN2UUL17currentThreadDataE
# section .tbss UU::currentThreadData qthread_unix.cpp\\n
ns = re.split('_ZN?(\d*)(\w*)L17currentThreadDataE? ', line)[2]
if len(ns):
ns += '::'
break
os.remove(tmppath)
lenns = len(ns)
......
......@@ -128,7 +128,7 @@
},
{
"name": "UseVirtualKeyboard",
"trDisplayName": "Use Qt Virtual Keyboard.",
"trDisplayName": "Use Qt Virtual Keyboard",
"type": "CheckBox",
"data":
{
......
......@@ -124,7 +124,7 @@
},
{
"name": "UseVirtualKeyboard",
"trDisplayName": "Use Qt Virtual Keyboard.",
"trDisplayName": "Use Qt Virtual Keyboard",
"type": "CheckBox",
"data":
{
......
......@@ -176,7 +176,7 @@
},
{
"name": "UseVirtualKeyboard",
"trDisplayName": "Use Qt Virtual Keyboard.",
"trDisplayName": "Use Qt Virtual Keyboard",
"type": "CheckBox",
"data":
{
......
......@@ -193,7 +193,7 @@
},
{
"name": "UseVirtualKeyboard",
"trDisplayName": "Use Qt Virtual Keyboard.",
"trDisplayName": "Use Qt Virtual Keyboard",
"type": "CheckBox",
"data":
{
......
......@@ -193,7 +193,7 @@
},
{
"name": "UseVirtualKeyboard",
"trDisplayName": "Use Qt Virtual Keyboard.",
"trDisplayName": "Use Qt Virtual Keyboard",
"type": "CheckBox",
"data":
{
......
......@@ -274,10 +274,11 @@ enum { debugLeaks = 0 };
using namespace Utils;
using namespace ExtensionSystem::Internal;
namespace ExtensionSystem {
using namespace Internal;
static Internal::PluginManagerPrivate *d = 0;
static PluginManager *m_instance = 0;
......@@ -442,7 +443,7 @@ QString PluginManager::systemInformation() const
if (response.result == SynchronousProcessResponse::Finished)
result += response.allOutput() + "\n";
result += "Plugin information:\n\n";
auto longestSpec = std::max_element(plugins().cbegin(), plugins().cend(),
auto longestSpec = std::max_element(d->pluginSpecs.cbegin(), d->pluginSpecs.cend(),
[](const PluginSpec *left, const PluginSpec *right) {
return left->name().size() < right->name().size();
});
......
......@@ -421,8 +421,9 @@ void PluginView::updatePlugins()
QList<CollectionItem *> collections;
auto end = PluginManager::pluginCollections().cend();
for (auto it = PluginManager::pluginCollections().cbegin(); it != end; ++it) {
const QHash<QString, QList<PluginSpec *>> pluginCollections = PluginManager::pluginCollections();
const auto end = pluginCollections.cend();
for (auto it = pluginCollections.cbegin(); it != end; ++it) {
const QString name = it.key().isEmpty() ? tr("Utilities") : it.key();
collections.append(new CollectionItem(name, it.value(), this));
}
......
......@@ -136,10 +136,10 @@ QStringList NameController::buildElementsPath(const QString &filePath, bool igno
QList<QString> relativeElements;
QStringList split = filePath.split("/");
QStringList::const_iterator splitEnd = split.end();
QStringList::const_iterator splitEnd = split.constEnd();
if (ignoreLastFilePathPart || split.last().isEmpty())
splitEnd = --splitEnd;
for (auto it = split.cbegin(); it != splitEnd; ++it) {
for (auto it = split.constBegin(); it != splitEnd; ++it) {
QString packageName = qmt::NameController::convertFileNameToElementName(*it);
relativeElements.append(packageName);
}
......
......@@ -40,13 +40,13 @@ int SavingRefMap::countDanglingReferences()
bool SavingRefMap::hasRef(const void *address, const char *typeName)
{
return m_references.find(KeyType(address, typeName)) != m_references.end();
return m_references.constFind(KeyType(address, typeName)) != m_references.constEnd();
}
bool SavingRefMap::hasDefinedRef(const void *address, const char *typeName)
{
MapType::const_iterator it = m_references.find(KeyType(address, typeName));
if (it == m_references.end())
const MapType::const_iterator it = m_references.constFind(KeyType(address, typeName));
if (it == m_references.constEnd())
return false;
return it.value().second;
}
......
......@@ -232,7 +232,8 @@ QString FileInProjectFinder::findFile(const QUrl &fileUrl, bool *success) const
// check if absolute path is found in sysroot
if (!m_sysroot.isEmpty()) {
const QString sysrootPath = m_sysroot + originalPath;
if (QFileInfo(sysrootPath).exists() && QFileInfo(sysrootPath).isFile()) {
QFileInfo sysrootInfo(sysrootPath);
if (sysrootInfo.exists() && sysrootInfo.isFile()) {
if (success)
*success = true;
m_cache.insert(originalPath, sysrootPath);
......
......@@ -258,13 +258,14 @@ void JsonSchema::enterNestedTypeSchema()
QStringList JsonSchema::properties(JsonObjectValue *v) const
{
typedef QHash<QString, JsonValue *>::ConstIterator MemberConstIterator;
using Members = QHash<QString, JsonValue *>;
QStringList all;
if (JsonObjectValue *ov = getObjectValue(kProperties(), v)) {
const MemberConstIterator cend = ov->members().constEnd();
for (MemberConstIterator it = ov->members().constBegin(); it != cend; ++it)
const Members members = ov->members();
const Members::ConstIterator cend = members.constEnd();
for (Members::ConstIterator it = members.constBegin(); it != cend; ++it)
if (hasPropertySchema(it.key()))
all.append(it.key());
}
......
......@@ -33,6 +33,8 @@ namespace Utils {
class QTCREATOR_UTILS_EXPORT SaveFile : public QTemporaryFile
{
Q_OBJECT
public:
explicit SaveFile(const QString &filename);
virtual ~SaveFile();
......
......@@ -67,7 +67,10 @@ const char BuildTargetSdkKey[] = "BuildTargetSdk";
const char VerboseOutputKey[] = "VerboseOutput";
const char UseMinistroKey[] = "UseMinistro";
class PasswordInputDialog : public QDialog {
class PasswordInputDialog : public QDialog
{
Q_OBJECT
public:
enum Context{
KeystorePassword = 1,
......@@ -433,3 +436,5 @@ QString PasswordInputDialog::getPassword(Context context, std::function<bool (co
}
} // namespace Android
#include "androidbuildapkstep.moc"
......@@ -107,6 +107,7 @@ IDevice::Ptr AndroidDevice::clone() const
QUrl AndroidDevice::toolControlChannel(const ControlChannelHint &) const
{
QUrl url;
url.setScheme(urlTcpScheme());
url.setHost("localhost");
return url;
}
......
......@@ -180,8 +180,8 @@ static void sdkManagerCommand(const AndroidConfig &config, const QStringList &ar
output.success = false;
output.stdOutput = response.stdOut();
output.stdError = QCoreApplication::translate("Android::Internal::AndroidSdkManager",
"Operation requires user interaction."
"Please use \"sdkmanager\" commandline tool");
"The operation requires user interaction. "
"Use the \"sdkmanager\" command-line tool.");
} else {
output.success = response.result == SynchronousProcessResponse::Finished;
}
......
......@@ -52,21 +52,6 @@ namespace Internal {
using namespace std::placeholders;
class OptionsDialog : public QDialog
{
public:
OptionsDialog(AndroidSdkManager *sdkManager, const QStringList &args,
QWidget *parent = nullptr);
~OptionsDialog();
QStringList sdkManagerArguments() const;
private:
QPlainTextEdit *argumentDetailsEdit;
QLineEdit *argumentsEdit;
QFuture<QString> m_optionsFuture;
};
class PackageFilterModel : public QSortFilterProxyModel
{
public:
......@@ -269,7 +254,7 @@ void AndroidSdkManagerWidget::onNativeSdkManager()
QProcess::startDetached(m_androidConfig.androidToolPath().toString());
} else {
QMessageBox::warning(this, tr("Native SDK Manager Not Available"),
tr("SDK manager UI tool is not available in the installed SDK tools"
tr("SDK manager UI tool is not available in the installed SDK tools "
"(version %1). Use the command line tool \"sdkmanager\" for "
"advanced SDK management.")
.arg(m_androidConfig.sdkToolsVersion().toString()));
......
......@@ -27,8 +27,14 @@
#include "androidconfigurations.h"
#include "androidsdkmanager.h"
#include <QWidget>
#include <QDialog>
#include <QFutureWatcher>
#include <QWidget>
QT_BEGIN_NAMESPACE
class QLineEdit;
class QPlainTextEdit;
QT_END_NAMESPACE
namespace Utils { class OutputFormatter; }
......@@ -42,6 +48,23 @@ namespace Ui {
class AndroidSdkModel;
class OptionsDialog : public QDialog
{
Q_OBJECT
public:
OptionsDialog(AndroidSdkManager *sdkManager, const QStringList &args,
QWidget *parent = nullptr);
~OptionsDialog();
QStringList sdkManagerArguments() const;
private:
QPlainTextEdit *argumentDetailsEdit;
QLineEdit *argumentsEdit;
QFuture<QString> m_optionsFuture;
};
class AndroidSdkManagerWidget : public QWidget
{
Q_OBJECT
......
......@@ -34,9 +34,9 @@
<item>
<widget class="QCheckBox" name="useXMLOutputCB">
<property name="toolTip">
<string>XML output recommended as it avoids parsing issues, while plain text is more human readable.
<string>XML output is recommended, because it avoids parsing issues, while plain text is more human readable.
Warning: Plain text output is missing some information (e.g. duration)</string>
Warning: Plain text misses some information, such as duration.</string>
</property>
<property name="text">
<string>Use XML output</string>
......
......@@ -33,6 +33,7 @@
#include <QAbstractItemView>
#include <QPainter>
#include <QTextLayout>
#include <QWindow>
namespace Autotest {
namespace Internal {
......@@ -57,20 +58,20 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
painter->save();
QFontMetrics fm(opt.font);
QBrush background;
QColor foreground;
const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(opt.widget);
const bool selected = opt.state & QStyle::State_Selected;
if (selected) {
painter->setBrush(opt.palette.highlight().color());
background = opt.palette.highlight().color();
foreground = opt.palette.highlightedText().color();
} else {
painter->setBrush(opt.palette.window().color());
background = opt.palette.window().color();
foreground = opt.palette.text().color();
}
painter->setPen(Qt::NoPen);
painter->drawRect(opt.rect);
painter->fillRect(opt.rect, background);
painter->setPen(foreground);
TestResultFilterModel *resultFilterModel = static_cast<TestResultFilterModel *>(view->model());
......@@ -78,10 +79,13 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
const TestResult *testResult = resultFilterModel->testResult(index);
QTC_ASSERT(testResult, painter->restore();return);
const QWidget *widget = dynamic_cast<const QWidget*>(painter->device());
QWindow *window = widget ? widget->window()->windowHandle() : nullptr;
QIcon icon = index.data(Qt::DecorationRole).value<QIcon>();
if (!icon.isNull())
painter->drawPixmap(positions.left(), positions.top(),
icon.pixmap(positions.iconSize(), positions.iconSize()));
icon.pixmap(window, QSize(positions.iconSize(), positions.iconSize())));
QString typeStr = TestResult::resultToString(testResult->result());
if (selected) {
......@@ -130,9 +134,10 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
painter->drawText(positions.lineAreaLeft(), positions.top() + fm.ascent(), line);
}
painter->setClipRect(opt.rect);
painter->setClipping(false);
painter->setPen(opt.palette.mid().color());
painter->drawLine(0, opt.rect.bottom(), opt.rect.right(), opt.rect.bottom());
const QRectF adjustedRect(QRectF(opt.rect).adjusted(0.5, 0.5, -0.5, -0.5));
painter->drawLine(adjustedRect.bottomLeft(), adjustedRect.bottomRight());
painter->restore();
}
......
......@@ -278,8 +278,12 @@ void TestTreeModel::handleParseResult(const TestParseResult *result, TestTreeIte
void TestTreeModel::removeAllTestItems()
{
for (Utils::TreeItem *item : *rootItem())
for (Utils::TreeItem *item : *rootItem()) {
item->removeChildren();
TestTreeItem *testTreeItem = static_cast<TestTreeItem *>(item);
if (testTreeItem->checked() == Qt::PartiallyChecked)
testTreeItem->setChecked(Qt::Checked);
}
emit testTreeModelChanged();
}
......
import qbs
import qbs.FileInfo
QtcPlugin {
name: "ClangPchManager"
Depends { name: "libclang"; required: false }
condition: libclang.present && libclang.toolingEnabled
Depends { name: "ClangSupport" }
Depends { name: "Utils" }
Depends { name: "Core" }
Depends { name: "CppTools" }
Depends { name: "ProjectExplorer" }
cpp.defines: {
var defines = base;
defines.push("CLANGPCHMANAGER_LIB");
// The following defines are used to determine the clang include path for intrinsics.
defines.push('CLANG_VERSION="' + libclang.llvmVersion + '"');
var resourceDir = FileInfo.joinPaths(libclang.llvmLibDir, "clang", libclang.llvmVersion,
"include");
defines.push('CLANG_RESOURCE_DIR="' + resourceDir + '"');
return defines;
}
cpp.includePaths: ["."]
files: [
"clangpchmanagerplugin.cpp",
"clangpchmanagerplugin.h",
"clangpchmanager_global.h",
"pchmanagerclient.cpp",
"pchmanagerclient.h",
"pchmanagernotifierinterface.cpp",
"pchmanagernotifierinterface.h",
"pchmanagerconnectionclient.cpp",
"pchmanagerconnectionclient.h",
"pchmanagerprojectupdater.cpp",
"pchmanagerprojectupdater.h",
"projectupdater.cpp",
"projectupdater.h",
"qtcreatorprojectupdater.cpp",
"qtcreatorprojectupdater.h",
]
}
......@@ -50,6 +50,8 @@ class SearchInterface;
class ClangQueryProjectsFindFilter : public Core::IFindFilter
{
Q_OBJECT
public:
ClangQueryProjectsFindFilter(ClangBackEnd::RefactoringServerInterface &server,
SearchInterface &searchInterface,
......
import qbs
import qbs.FileInfo
QtcPlugin {