Merge remote-tracking branch 'origin/4.15'

Change-Id: I3d3dfa04124eed14952294c2847b9851dcb1a5fd
This commit is contained in:
Eike Ziller
2021-05-25 16:26:54 +02:00
24 changed files with 159 additions and 58 deletions

View File

@@ -53,6 +53,12 @@ find_package(Qt5
if (Qt5_VERSION VERSION_LESS 6.0.0)
install(TARGETS Qt6Core5Compat EXPORT QtCreator)
set(BUILD_WITH_PCH_DEFAULT ON)
# Specify standards conformance mode to MSVC 2017 and later
# Qt6 has the values as part of the Qt6::Platform target interface
if (MSVC AND MSVC_VERSION GREATER_EQUAL 1910)
add_compile_options(/permissive- /Zc:__cplusplus)
endif()
else()
set(BUILD_WITH_PCH_DEFAULT OFF)
endif()
@@ -88,11 +94,6 @@ endfunction()
set_if_target(_has_svg_target Qt5::Svg)
option(ENABLE_SVG_SUPPORT "Enable SVG support" "${_has_svg_target}")
# specify standards conformance mode to MSVC 2017 and later
if (MSVC AND MSVC_VERSION GREATER_EQUAL 1910)
add_compile_options(/permissive-)
endif()
add_library(OptionalSvg INTERFACE)
if (TARGET Qt5::Svg AND ENABLE_SVG_SUPPORT)
target_link_libraries(OptionalSvg INTERFACE Qt5::Svg)

View File

@@ -298,10 +298,12 @@ function(add_qtc_depends target_name)
endif()
foreach(obj_lib IN LISTS object_lib_depends)
target_compile_options(${target_name} PRIVATE $<TARGET_PROPERTY:${obj_lib},INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(${target_name} PRIVATE $<TARGET_PROPERTY:${obj_lib},INTERFACE_COMPILE_DEFINITIONS>)
target_include_directories(${target_name} PRIVATE $<TARGET_PROPERTY:${obj_lib},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()
foreach(obj_lib IN LISTS object_public_depends)
target_compile_options(${target_name} PUBLIC $<TARGET_PROPERTY:${obj_lib},INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(${target_name} PUBLIC $<TARGET_PROPERTY:${obj_lib},INTERFACE_COMPILE_DEFINITIONS>)
target_include_directories(${target_name} PUBLIC $<TARGET_PROPERTY:${obj_lib},INTERFACE_INCLUDE_DIRECTORIES>)
endforeach()

View File

@@ -27,6 +27,12 @@ accept_configuration:
property: host.os
equals_value: MacOS
machine_type:
Build:
cores: 8
Test:
cores: 8
run_license_check: &run_license_check
type: Group
enable_if:

View File

@@ -541,7 +541,7 @@ int main(int argc, char **argv)
if (!qEnvironmentVariableIsSet("QT_OPENGL"))
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#else
qputenv("QT_QUICK_BACKEND", "opengl");
qputenv("QSG_RHI_BACKEND", "opengl");
#endif
if (qEnvironmentVariableIsSet("QTCREATOR_DISABLE_NATIVE_MENUBAR")

View File

@@ -87,30 +87,30 @@ Engine::~Engine()
const QString *Engine::identifier(const QString &s)
{
return &(*_identifiers.insert(s));
return &(*_identifiers.insert(s).first);
}
const QString *Engine::identifier(const char *s, int n)
{
return &(*_identifiers.insert(QString::fromLatin1(s, n)));
return &(*_identifiers.insert(QString::fromLatin1(s, n)).first);
}
QSet<QString> Engine::identifiers() const
std::unordered_set<QString> Engine::identifiers() const
{
return _identifiers;
}
const QString *Engine::number(const QString &s)
{
return &(*_numbers.insert(s));
return &(*_numbers.insert(s).first);
}
const QString *Engine::number(const char *s, int n)
{
return &(*_numbers.insert(QString::fromLatin1(s, n)));
return &(*_numbers.insert(QString::fromLatin1(s, n)).first);
}
QSet<QString> Engine::numbers() const
std::unordered_set<QString> Engine::numbers() const
{
return _numbers;
}

View File

@@ -29,9 +29,10 @@
#include "glslmemorypool.h"
#include "glsltypes.h"
#include <qstring.h>
#include <qset.h>
#include <functional>
#include <set>
#include <unordered_set>
namespace GLSL {
@@ -91,11 +92,11 @@ public:
const QString *identifier(const QString &s);
const QString *identifier(const char *s, int n);
QSet<QString> identifiers() const;
std::unordered_set<QString> identifiers() const;
const QString *number(const QString &s);
const QString *number(const char *s, int n);
QSet<QString> numbers() const;
std::unordered_set<QString> numbers() const;
// types
const UndefinedType *undefinedType();
@@ -128,8 +129,8 @@ public:
void error(int line, const QString &message);
private:
QSet<QString> _identifiers;
QSet<QString> _numbers;
std::unordered_set<QString> _identifiers;
std::unordered_set<QString> _numbers;
TypeTable<VectorType> _vectorTypes;
TypeTable<MatrixType> _matrixTypes;
TypeTable<ArrayType> _arrayTypes;

View File

@@ -342,7 +342,10 @@ void ToolTip::showInternal(const QPoint &pos, const QVariant &content,
void ToolTip::placeTip(const QPoint &pos)
{
QRect screen = QGuiApplication::screenAt(pos)->availableGeometry();
QScreen *qscreen = QGuiApplication::screenAt(pos);
if (!qscreen)
qscreen = QGuiApplication::primaryScreen();
const QRect screen = qscreen->availableGeometry();
QPoint p = pos;
p += offsetFromPosition();
if (p.x() + m_tip->width() > screen.x() + screen.width())

View File

@@ -1019,10 +1019,12 @@ void AndroidSdkManagerPrivate::checkPendingLicense(SdkCmdFutureInterface &fi)
AndroidSdkManager::OperationOutput result;
result.type = AndroidSdkManager::LicenseCheck;
const QStringList args = {"--licenses", sdkRootArg(m_config)};
if (!fi.isCanceled())
sdkManagerCommand(m_config, args, m_sdkManager, fi, result, 100.0);
else
if (!fi.isCanceled()) {
const int timeOutS = 4; // Short timeout as workaround for QTCREATORBUG-25667
sdkManagerCommand(m_config, args, m_sdkManager, fi, result, 100.0, true, timeOutS);
} else {
qCDebug(sdkManagerLog) << "Update: Operation cancelled before start";
}
fi.reportResult(result);
fi.setProgressValue(100);

View File

@@ -81,7 +81,8 @@ void CTestOutputReader::processOutputLine(const QByteArray &outputLine)
static const QRegularExpression testProject("^Test project (.*)$");
static const QRegularExpression testCase("^(test \\d+)|( Start\\s+\\d+: .*)$");
static const QRegularExpression testResult("^\\s*\\d+/\\d+ Test\\s+#\\d+: (.*) (\\.+)\\s*"
"(Passed|\\*\\*\\*Failed)\\s+(.*) sec$");
"(Passed|\\*\\*\\*Failed|\\*\\*\\*Not Run|"
".*\\*\\*\\*Exception:.*)\\s+(.*) sec$");
static const QRegularExpression summary("^\\d+% tests passed, (\\d+) tests failed "
"out of (\\d+)");
static const QRegularExpression summaryTime("^Total Test time .* =\\s+(.*) sec$");
@@ -110,7 +111,13 @@ void CTestOutputReader::processOutputLine(const QByteArray &outputLine)
} else if (ExactMatch match = testResult.match(line)) {
m_description = match.captured();
m_testName = match.captured(1);
m_result = (match.captured(3) == "Passed") ? ResultType::Pass : ResultType::Fail;
const QString resultType = match.captured(3);
if (resultType == "Passed")
m_result = ResultType::Pass;
else if (resultType == "***Failed" || resultType == "***Not Run")
m_result = ResultType::Fail;
else
m_result = ResultType::MessageFatal;
} else if (ExactMatch match = summary.match(line)) {
if (!m_testName.isEmpty())
sendCompleteInformation();

View File

@@ -1034,7 +1034,7 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
const bool forAndroid = DeviceTypeKitAspect::deviceTypeId(kit())
== Android::Constants::ANDROID_DEVICE_TYPE;
for (const CMakeBuildTarget &ct : m_buildTargets) {
if (ct.targetType == UtilityType)
if (CMakeBuildSystem::filteredOutTarget(ct))
continue;
if (ct.targetType == ExecutableType || (forAndroid && ct.targetType == DynamicLibraryType)) {
@@ -1065,11 +1065,10 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
QStringList CMakeBuildSystem::buildTargetTitles() const
{
auto nonUtilityTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
return target.targetType != UtilityType ||
CMakeBuildStep::specialTargets(usesAllCapsTargets()).contains(target.title);
auto nonAutogenTargets = filtered(m_buildTargets, [this](const CMakeBuildTarget &target){
return !CMakeBuildSystem::filteredOutTarget(target);
});
return transform(nonUtilityTargets, &CMakeBuildTarget::title);
return transform(nonAutogenTargets, &CMakeBuildTarget::title);
}
const QList<CMakeBuildTarget> &CMakeBuildSystem::buildTargets() const
@@ -1091,6 +1090,12 @@ CMakeConfig CMakeBuildSystem::parseCMakeCacheDotTxt(const Utils::FilePath &cache
return result;
}
bool CMakeBuildSystem::filteredOutTarget(const CMakeBuildTarget &target)
{
return target.title.endsWith("_autogen") ||
target.title.endsWith("_autogen_timestamp_deps");
}
bool CMakeBuildSystem::isMultiConfig() const
{
return m_reader.isMultiConfig();

View File

@@ -98,6 +98,8 @@ public:
static CMakeConfig parseCMakeCacheDotTxt(const Utils::FilePath &cacheFile,
QString *errorMessage);
static bool filteredOutTarget(const CMakeBuildTarget &target);
bool isMultiConfig() const;
bool usesAllCapsTargets() const;

View File

@@ -71,7 +71,7 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry)
const QList<CMakeBuildTarget> buildTargets = bs->buildTargets();
for (const CMakeBuildTarget &target : buildTargets) {
if (target.targetType == UtilityType && !CMakeBuildStep::specialTargets(bs->usesAllCapsTargets()).contains(target.title))
if (CMakeBuildSystem::filteredOutTarget(target))
continue;
const int index = target.title.indexOf(entry);
if (index >= 0) {

View File

@@ -160,7 +160,6 @@ extend_qtc_plugin(Core
extend_qtc_plugin(Core
CONDITION WITH_TESTS
DEFINES SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/locator"
SOURCES
locator/locator_test.cpp
locator/locatorfiltertest.cpp locator/locatorfiltertest.h

View File

@@ -276,7 +276,7 @@ Project {
"locator/locator_test.cpp"
]
cpp.defines: outer.concat(['SRCDIR="' + path + "/locator" + '"'])
cpp.defines: outer.concat(['SRCDIR="' + path + '"'])
}
Group {

View File

@@ -50,5 +50,5 @@ equals(TEST, 1) {
SOURCES += \
$$PWD/locatorfiltertest.cpp \
$$PWD/locator_test.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
DEFINES += SRCDIR=\\\"$$PWD/..\\\"
}

View File

@@ -40,7 +40,7 @@ using namespace Core::Tests;
namespace {
QTC_DECLARE_MYTESTDATADIR("../../../../tests/locators/")
QTC_DECLARE_MYTESTDATADIR("../../../tests/locators/")
class MyBaseFileFilter : public Core::BaseFileFilter
{

View File

@@ -66,20 +66,20 @@ DebuggerOutputParser::DebuggerOutputParser(const QString &output)
void DebuggerOutputParser::skipCommas()
{
while (from != to && *from == ',')
while (from < to && *from == ',')
++from;
}
void DebuggerOutputParser::skipSpaces()
{
while (from != to && isspace(from->unicode()))
while (from < to && isspace(from->unicode()))
++from;
}
QString DebuggerOutputParser::readString(const std::function<bool(char)> &isValidChar)
{
QString res;
while (from != to && isValidChar(from->unicode()))
while (from < to && isValidChar(from->unicode()))
res += *from++;
return res;
}
@@ -87,7 +87,7 @@ QString DebuggerOutputParser::readString(const std::function<bool(char)> &isVali
int DebuggerOutputParser::readInt()
{
int res = 0;
while (from != to && *from >= '0' && *from <= '9') {
while (from < to && *from >= '0' && *from <= '9') {
res *= 10;
res += (*from++).unicode() - '0';
}
@@ -101,13 +101,16 @@ QChar DebuggerOutputParser::readChar()
static bool isNameChar(char c)
{
return c != '=' && c != ':' && !isspace(c);
return c != '=' && c != ':' && c != ']' && !isspace(c);
}
void GdbMi::parseResultOrValue(DebuggerOutputParser &parser)
{
parser.skipSpaces();
if (parser.isAtEnd())
return;
//qDebug() << "parseResultOrValue: " << parser.buffer();
parseValue(parser);
parser.skipSpaces();
@@ -115,8 +118,12 @@ void GdbMi::parseResultOrValue(DebuggerOutputParser &parser)
//qDebug() << "no valid result in " << parser.buffer();
return;
}
if (parser.isAtEnd() || parser.isCurrent('('))
if (parser.isAtEnd())
return;
if (parser.isCurrent('(')) {
parser.advance();
return;
}
m_name = parser.readString(isNameChar);
@@ -293,7 +300,8 @@ void GdbMi::parseList(DebuggerOutputParser &parser)
parser.advance();
m_type = List;
parser.skipCommas();
while (!parser.isAtEnd()) {
while (true) {
QTC_ASSERT(!parser.isAtEnd(), break);
if (parser.isCurrent(']')) {
parser.advance();
break;
@@ -303,8 +311,6 @@ void GdbMi::parseList(DebuggerOutputParser &parser)
if (child.isValid()) {
m_children.push_back(child);
parser.skipCommas();
} else {
parser.advance();
}
}
}

View File

@@ -131,7 +131,7 @@ public:
QChar current() const { return *from; }
bool isCurrent(QChar c) const { return *from == c; }
bool isAtEnd() const { return from == to; }
bool isAtEnd() const { return from >= to; }
void advance() { ++from; }
void advance(int n) { from += n; }

View File

@@ -1814,25 +1814,32 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
return bc->environment().expandedValueForKey(var);
return QString();
}, false);
expander->registerPrefix("CurrentDocument:Project:BuildConfig:Env",
BuildConfiguration::tr("Variables in the active build environment "
"of the project containing the currently open document."),
const char currentBuildEnvVar[] = "CurrentDocument:Project:BuildConfig:Env";
expander->registerPrefix(currentBuildEnvVar,
BuildConfiguration::tr(
"Variables in the active build environment "
"of the project containing the currently open document."),
[](const QString &var) {
if (BuildConfiguration *bc = currentBuildConfiguration())
return bc->environment().expandedValueForKey(var);
return QString();
});
Utils::EnvironmentProvider::addProvider(
{Constants::VAR_CURRENTBUILD_ENV, tr("Current Build Environment"), []() {
{currentBuildEnvVar, tr("Current Build Environment"), []() {
if (BuildConfiguration *bc = currentBuildConfiguration())
return bc->environment();
return Utils::Environment::systemEnvironment();
}});
Utils::EnvironmentProvider::addProvider(
{"CurrentDocument:Project:BuildConfig:Env", tr("Current Build Environment"), []() {
if (BuildConfiguration *bc = currentBuildConfiguration())
return bc->environment();
return Utils::Environment::systemEnvironment();
{"CurrentDocument:Project:RunConfig:Env", tr("Current Run Environment"), []() {
const Project *const project = ProjectTree::currentProject();
const Target *const target = project ? project->activeTarget() : nullptr;
const RunConfiguration *const rc = target ? target->activeRunConfiguration() : nullptr;
if (rc) {
if (auto envAspect = rc->aspect<EnvironmentAspect>())
return envAspect->environment();
}
return Utils::Environment::systemEnvironment();
}});
// Global variables for the active project.
@@ -1884,9 +1891,9 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
return bc->environment();
return Utils::Environment::systemEnvironment();
}});
expander->registerPrefix("ActiveProject:BuildConfig:Env",
expander->registerPrefix(activeBuildEnvVar,
BuildConfiguration::tr("Variables in the active build environment "
"of the active project."),
"of the active project."),
[](const QString &var) {
if (BuildConfiguration * const bc = activeBuildConfiguration())
return bc->environment().expandedValueForKey(var);
@@ -1907,7 +1914,17 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
return rc->commandLine().executable().toString();
return QString();
});
expander->registerPrefix("ActiveProject:RunConfig:Env",
const char activeRunEnvVar[] = "ActiveProject:RunConfig:Env";
Utils::EnvironmentProvider::addProvider(
{activeRunEnvVar, tr("Active run environment of the active project."), [] {
if (const RunConfiguration *const rc = activeRunConfiguration()) {
if (auto envAspect = rc->aspect<EnvironmentAspect>())
return envAspect->environment();
}
return Utils::Environment::systemEnvironment();
}});
expander->registerPrefix(
activeRunEnvVar,
tr("Variables in the environment of the active project's active run configuration."),
[](const QString &var) {
if (const RunConfiguration * const rc = activeRunConfiguration()) {
@@ -1915,7 +1932,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
return envAspect->environment().expandedValueForKey(var);
}
return QString();
});
});
expander->registerVariable("ActiveProject:RunConfig:WorkingDir",
tr("The working directory of the active project's active run configuration."),
[] {

View File

@@ -241,6 +241,12 @@ QVariant read(int variantType, const QString &str)
bool conversionOk = true;
switch (variantType) {
case QMetaType::QVariant: {
auto tmp = QVariant(str);
value = QVariant(tmp);
conversionOk = tmp.isValid();
break;
}
case QMetaType::QPoint:
value = pointFFromString(str, &conversionOk).toPoint();
break;

View File

@@ -33,6 +33,8 @@
#include <QHash>
#include <QLibrary>
#include <QMultiHash>
#include <QMutex>
#include <QMutexLocker>
#include <QProcess>
#include <QRegularExpression>
#include <QRegularExpression>

View File

@@ -29,6 +29,7 @@
#include <QFile>
#include <QObject>
#include <QRecursiveMutex>
#include <QString>
#include <QXmlStreamWriter>

File diff suppressed because one or more lines are too long

View File

@@ -2,16 +2,33 @@ import QtQuick 2.0
Rectangle {
function foo() {
{} // 115 9 9
{ // 115 9 9
var x = 10
}
{
let x = 10
}
if (a) {}
}
onXChanged: {
{} // 115 9 9
{ // 115 9 9
var y = 11
}
{
let y = 11
}
while (A) {}
}
property int d: {
{} // 115 9 9
{ // 115 9 9
var z = 12
}
{
let y = 12
}
}
}