From 97b6b2c0914f9c56da9d80d876abe00bcae1e625 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 17 May 2021 11:54:43 +0200 Subject: [PATCH 01/17] Fix compile warning about redefinition of SRCDIR :24:9: warning: 'SRCDIR' macro redefined [-Wmacro-redefined] #define SRCDIR "/Users/Shared/qt/creator/4.15/src/qtcreator/src/plugins/coreplugin/locator" :23:9: note: previous definition is here #define SRCDIR "/Users/Shared/qt/creator/4.15/src/qtcreator/src/plugins/coreplugin" add_qtc_plugin already defines SRCDIR to CMAKE_CURRENT_LIST_DIR, so it already is set to src/plugins/coreplugin. Fix the creation of the TestDataDir instead of redefining the macro. Change-Id: Id2a0359748b22c30a91a6dbe7fa5a3d4d9c2fa5d Reviewed-by: Qt CI Bot Reviewed-by: Christian Stenger --- src/plugins/coreplugin/CMakeLists.txt | 1 - src/plugins/coreplugin/coreplugin.qbs | 2 +- src/plugins/coreplugin/locator/locator.pri | 2 +- src/plugins/coreplugin/locator/locator_test.cpp | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/CMakeLists.txt b/src/plugins/coreplugin/CMakeLists.txt index 6b98b63bf9a..5544d49a8d9 100644 --- a/src/plugins/coreplugin/CMakeLists.txt +++ b/src/plugins/coreplugin/CMakeLists.txt @@ -162,7 +162,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 diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs index f4f583ab49a..3acda9e1a17 100644 --- a/src/plugins/coreplugin/coreplugin.qbs +++ b/src/plugins/coreplugin/coreplugin.qbs @@ -276,7 +276,7 @@ Project { "locator/locator_test.cpp" ] - cpp.defines: outer.concat(['SRCDIR="' + path + "/locator" + '"']) + cpp.defines: outer.concat(['SRCDIR="' + path + '"']) } Group { diff --git a/src/plugins/coreplugin/locator/locator.pri b/src/plugins/coreplugin/locator/locator.pri index 945cf059f6e..1fe7fcfc7c3 100644 --- a/src/plugins/coreplugin/locator/locator.pri +++ b/src/plugins/coreplugin/locator/locator.pri @@ -50,5 +50,5 @@ equals(TEST, 1) { SOURCES += \ $$PWD/locatorfiltertest.cpp \ $$PWD/locator_test.cpp - DEFINES += SRCDIR=\\\"$$PWD\\\" + DEFINES += SRCDIR=\\\"$$PWD/..\\\" } diff --git a/src/plugins/coreplugin/locator/locator_test.cpp b/src/plugins/coreplugin/locator/locator_test.cpp index ac9eaf3421b..afe04a39aeb 100644 --- a/src/plugins/coreplugin/locator/locator_test.cpp +++ b/src/plugins/coreplugin/locator/locator_test.cpp @@ -40,7 +40,7 @@ using namespace Core::Tests; namespace { -QTC_DECLARE_MYTESTDATADIR("../../../../tests/locators/") +QTC_DECLARE_MYTESTDATADIR("../../../tests/locators/") class MyBaseFileFilter : public Core::BaseFileFilter { From b5428d0903309918d88ae13c7c1c0a5b2f45c831 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Wed, 19 May 2021 17:22:29 +0200 Subject: [PATCH 02/17] CMakePM: Do not filter out all UTILITY targets add_custom_target will be set as UTILITY target, which one might want to reference as "cm " or "--target ". Filter out instead the "_autogen" and "_autogen_timestamp_deps". Fixes: QTCREATORBUG-25726 Change-Id: Ia73d6e87e4b230114d068649964792ff3f626378 Reviewed-by: Alessandro Portale Reviewed-by: Eike Ziller --- .../cmakeprojectmanager/cmakebuildsystem.cpp | 15 ++++++++++----- .../cmakeprojectmanager/cmakebuildsystem.h | 2 ++ .../cmakeprojectmanager/cmakelocatorfilter.cpp | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index b558cc0d9db..d32c6e7d5e1 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1016,7 +1016,7 @@ const QList 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)) { @@ -1047,11 +1047,10 @@ const QList 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 &CMakeBuildSystem::buildTargets() const @@ -1073,6 +1072,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(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.h b/src/plugins/cmakeprojectmanager/cmakebuildsystem.h index 00740feaa0a..3b591c15815 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.h @@ -99,6 +99,8 @@ public: static CMakeConfig parseCMakeCacheDotTxt(const Utils::FilePath &cacheFile, QString *errorMessage); + static bool filteredOutTarget(const CMakeBuildTarget &target); + bool isMultiConfig() const; bool usesAllCapsTargets() const; diff --git a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp index abeec70e594..65ee922918b 100644 --- a/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakelocatorfilter.cpp @@ -71,7 +71,7 @@ void CMakeTargetLocatorFilter::prepareSearch(const QString &entry) const QList 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) { From 9156c25c9b1ecf9b5c0202ec3c59158c879ba551 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 19 May 2021 16:18:19 +0200 Subject: [PATCH 03/17] Fix environment selection of external tools The run environment was missing, and instead build environment was duplicated. Amends b55825a42000ee81e37c8e25bcd0784d26d6dc18 which accidentally changed this. Fixes: QTCREATORBUG-25634 Change-Id: I9d01452f603e9592a8e1e46adfd861e260c5eabd Reviewed-by: Christian Kandeler Reviewed-by: Qt CI Bot --- .../projectexplorer/projectexplorer.cpp | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 616894fec3f..6c98f716754 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1839,25 +1839,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()) + return envAspect->environment(); + } + return Utils::Environment::systemEnvironment(); }}); // Global variables for the active project. @@ -1909,9 +1916,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); @@ -1932,7 +1939,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()) + 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()) { @@ -1940,7 +1957,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."), [] { From 1d9f535c8ad58df1179b31ed3183a355b898e09d Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 18 May 2021 07:24:41 +0200 Subject: [PATCH 04/17] Debugger: Make GDBMI parser more robust Task-number: QTCREATORBUG-25745 Change-Id: I1a4f89fc72433548d44461c3c7c02bd53708d12d Reviewed-by: Jarek Kobus --- src/plugins/debugger/debuggerprotocol.cpp | 17 +++++++++++------ src/plugins/debugger/debuggerprotocol.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index c9ffcde22aa..67340c4e1f9 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -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 &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 &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'; } @@ -108,6 +108,9 @@ void GdbMi::parseResultOrValue(DebuggerOutputParser &parser) { parser.skipSpaces(); + if (parser.isAtEnd()) + return; + //qDebug() << "parseResultOrValue: " << parser.buffer(); parseValue(parser); parser.skipSpaces(); @@ -303,9 +306,11 @@ void GdbMi::parseList(DebuggerOutputParser &parser) if (child.isValid()) { m_children.push_back(child); parser.skipCommas(); - } else { - parser.advance(); + continue; } + + QTC_ASSERT(!parser.isAtEnd(), break); + parser.advance(); } } diff --git a/src/plugins/debugger/debuggerprotocol.h b/src/plugins/debugger/debuggerprotocol.h index 3154688c56e..7038097619a 100644 --- a/src/plugins/debugger/debuggerprotocol.h +++ b/src/plugins/debugger/debuggerprotocol.h @@ -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; } From 3dc360f728e9e62e2d89d7723eaf6e52b57300a2 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 20 May 2021 12:15:03 +0200 Subject: [PATCH 05/17] Fix matching closing square bracket Task-number: QTCREATORBUG-25745 Change-Id: I63ceb93d6208fb3fe19b4c11c6963a69bc01f260 Reviewed-by: hjk --- src/plugins/debugger/debuggerprotocol.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index 67340c4e1f9..6dc856324da 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -101,7 +101,7 @@ QChar DebuggerOutputParser::readChar() static bool isNameChar(char c) { - return c != '=' && c != ':' && !isspace(c); + return c != '=' && c != ':' && c != ']' && !isspace(c); } void GdbMi::parseResultOrValue(DebuggerOutputParser &parser) @@ -118,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); @@ -296,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; @@ -306,11 +311,7 @@ void GdbMi::parseList(DebuggerOutputParser &parser) if (child.isValid()) { m_children.push_back(child); parser.skipCommas(); - continue; } - - QTC_ASSERT(!parser.isAtEnd(), break); - parser.advance(); } } From 76d8483d16a6d3eb03d8676f9a2942cbd4853ae9 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 19 May 2021 14:22:11 +0200 Subject: [PATCH 06/17] Add a test for parsing properly [Thread ...] data This test is based on real data processed during debugging. Task-number: QTCREATORBUG-25745 Change-Id: Ia400367e37b799a93f66fc07c5532c6b90b08be6 Reviewed-by: hjk --- tests/auto/debugger/tst_protocol.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/auto/debugger/tst_protocol.cpp b/tests/auto/debugger/tst_protocol.cpp index 31f6423c43c..d3258ff5925 100644 --- a/tests/auto/debugger/tst_protocol.cpp +++ b/tests/auto/debugger/tst_protocol.cpp @@ -39,6 +39,8 @@ public: private slots: void parseCString(); void parseCString_data(); + void gdbmiFromString(); + void gdbmiFromString_data(); }; void tst_protocol::parseCString() @@ -85,6 +87,28 @@ void tst_protocol::parseCString_data() << R"(abcäédefñ)"; } +void tst_protocol::gdbmiFromString() +{ + QFETCH(QString, input); + + Debugger::Internal::GdbMi gdbmi; + gdbmi.fromString(input); +} + +void tst_protocol::gdbmiFromString_data() +{ + QTest::addColumn("input"); + + const QString testData = R"([Thread 0x7fffa2ffd640 (LWP 263820) exited] +[Thread 0x7fffa1ffb640 (LWP 263815) exited] +[Thread 0x7fffa27fc640 (LWP 263802) exited] +[Thread 0x7fff7ffff640 (LWP 263826) exited] +result={token="0",data=[{iname="local.this",name="this",origaddr="0x7fffffffa3c8",address="0x122c660",autoderefcount="1",address="0x122c660",numchild="1",type="Git::Internal::GitClient",value="",},{iname="local.workingDirectory",name="workingDirectory",numchild="1",address="0x7fffffffa598",type="QString &",valueencoded="utf16",value="2F0068006F006D0065002F006A006100720065006B002F006400650076002F00630072006500610074006F0072002D006D0061007300740065007200",},{iname="local.fileName",name="fileName",numchild="1",address="0x7fffffffa590",type="QString &",valueencoded="utf16",value="7300720063002F006C006900620073002F007500740069006C0073002F007300680065006C006C0063006F006D006D0061006E0064002E00630070007000",},{iname="local.enableAnnotationContextMenu",name="enableAnnotationContextMenu",address="0x7fffffffa3b4",numchild="0",type="bool",value="1",},{iname="local.args",name="args",numchild="0",address="0x7fffffffa588",type="QStringList &",valueencoded="itemcount",value="0",},{iname="local.msgArg",name="msgArg",numchild="1",address="0x7fffffffa408",type="QString",valueencoded="utf16",value="7300720063002F006C006900620073002F007500740069006C0073002F007300680065006C006C0063006F006D006D0061006E0064002E00630070007000",},{iname="local.workingDir",name="workingDir",numchild="1",address="0x7fffffffa400",type="QString",valueencoded="utf16",value="2F0068006F006D0065002F006A006100720065006B002F006400650076002F00630072006500610074006F0072002D006D0061007300740065007200",},{iname="local.title",name="title",numchild="1",address="0x7fffffffa3f8",type="QString",valueencoded="utf16",value="47006900740020004C006F006700200022007300720063002F006C006900620073002F007500740069006C0073002F007300680065006C006C0063006F006D006D0061006E0064002E006300700070002200",},{iname="local.editorId",name="editorId",numchild="1",address="0x7fffffffa3f0",type="Utils::Id",valueencoded="latin1",value="476974204C6F6720456469746F72",},{iname="local.sourceFile",name="sourceFile",numchild="1",address="0x7fffffffa3e8",type="QString",valueencoded="utf16",value="2F0068006F006D0065002F006A006100720065006B002F006400650076002F00630072006500610074006F0072002D006D00610073007400650072002F007300720063002F006C006900620073002F007500740069006C0073002F007300680065006C006C0063006F006D006D0061006E0064002E00630070007000",},{iname="local.editor",name="editor",origaddr="0x7fffffffa520",address="0x27ff400",numchild="1",type="Git::Internal::GitEditorWidget*",value="0x27ff400",},{iname="local.argWidget",name="argWidget",address="0x1fe47c0",numchild="1",type="Git::Internal::GitLogArgumentsWidget*",value="0x1fe47c0",},{iname="local.arguments",name="arguments",numchild="11",address="0x7fffffffa3e0",type="QStringList",valueencoded="itemcount",value="11",},{iname="local.logCount",name="logCount",address="0x7fffffffa51c",numchild="0",type="int",value="100",},{iname="local.grepValue",name="grepValue",address="0x7fffffffa3d8",type="QString",valueencoded="utf16",value="",},{iname="local.pickaxeValue",name="pickaxeValue",address="0x7fffffffa3d0",type="QString",valueencoded="utf16",value="",},{iname="watch.0",wname="266D5F6D75746578",numchild="0",type=" ",value="",},{iname="watch.1",wname="266D6F64656C4D616E616765722D3E6D5F6D75746578",numchild="0",type=" ",value="",},{iname="watch.2",wname="62696E64696E672D3E73796D626F6C732829",numchild="0",type=" ",value="",},{iname="watch.3",wname="64",origaddr="0x7fffc5c0e630",address="0xfe5100",numchild="1",type="VcsBase::VcsOutputWindowPrivate*",value="0xfe5100",},{iname="watch.4",wname="642D3E636F6E74656E7473",numchild="0",type=" ",value="",},{iname="watch.5",wname="642D3E64697361626C65436F6465506172736572",numchild="0",type=" ",value="",},{iname="watch.6",wname="642D3E6D5F63757272656E74456469746F72",numchild="0",type=" ",value="",},{iname="watch.7",wname="642D3E6D5F6578747261456469746F72537570706F727473",numchild="0",type=" ",value="",},{iname="watch.8",wname="642D3E6D5F6C6F6164696E6753657373696F6E",numchild="0",type=" ",value="",},{iname="watch.9",wname="64656C61796564496E697469616C697A655175657565",numchild="0",type=" ",value="",},{iname="watch.10",wname="66756E6374696F6E",numchild="0",type=" ",value="",},{iname="watch.11",wname="69636F6E54797065",numchild="0",type=" ",value="",},{iname="watch.12",wname="6974656D416464",numchild="0",type=" ",value="",},{iname="watch.13",wname="6D5F616363657074",numchild="0",type=" ",value="",},{iname="watch.14",wname="6D5F6461746143616C6C6261636B",numchild="0",type=" ",value="",},{iname="watch.15",wname="6D5F67656E65726174656446696C654E616D65",numchild="0",type=" ",value="",},{iname="watch.16",wname="6D5F6E65656473557064617465",numchild="0",type=" ",value="",},{iname="watch.17",wname="6D5F717263436F6E74656E7473",numchild="0",type=" ",value="",},{iname="watch.18",wname="6D6F64656C4D616E61676572",numchild="0",type=" ",value="",},{iname="watch.19",wname="6E616D65",numchild="0",type=" ",value="",},{iname="watch.20",wname="706172736572",numchild="0",type=" ",value="",},{iname="watch.21",wname="7061727365722E746F",numchild="0",type=" ",value="",},{iname="watch.22",wname="7265736F6C7665546172676574",numchild="0",type=" ",value="",},{iname="watch.23",wname="73796D626F6C2D3E656E636C6F73696E6753636F70652829",numchild="0",type=" ",value="",},{iname="watch.24",wname="7461675F6E616D65",numchild="0",type=" ",value="",},{iname="watch.25",wname="74797065",numchild="0",type=" ",value="",},],typeinfo=[],partial="0",counts={},timings=[]} )"; + + QTest::newRow("with_thread_finished") + << testData; +} + QTEST_APPLESS_MAIN(tst_protocol); #include "tst_protocol.moc" From e4db67b523732bd315e4a8e395e3a2a7d86ddd74 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 20 May 2021 09:37:15 +0200 Subject: [PATCH 07/17] GLSL: Fix crash when built with Qt 6 In Qt 6 references (and pointers) to elements in a container are invalidated when the container size changes. Simply move to std::unordered_set which guarantees references to stay valid. Fixes: QTCREATORBUG-25641 Task-number: QTCREATORBUG-24098 Change-Id: I9f1110419bd2940c182b4a24629d9ab718ca2af6 Reviewed-by: David Schulz --- src/libs/glsl/glslengine.cpp | 12 ++++++------ src/libs/glsl/glslengine.h | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/libs/glsl/glslengine.cpp b/src/libs/glsl/glslengine.cpp index 8c03b69d792..9e305f07f2b 100644 --- a/src/libs/glsl/glslengine.cpp +++ b/src/libs/glsl/glslengine.cpp @@ -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 Engine::identifiers() const +std::unordered_set 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 Engine::numbers() const +std::unordered_set Engine::numbers() const { return _numbers; } diff --git a/src/libs/glsl/glslengine.h b/src/libs/glsl/glslengine.h index 0942d5ef575..1444867131d 100644 --- a/src/libs/glsl/glslengine.h +++ b/src/libs/glsl/glslengine.h @@ -29,9 +29,10 @@ #include "glslmemorypool.h" #include "glsltypes.h" #include -#include + #include #include +#include namespace GLSL { @@ -91,11 +92,11 @@ public: const QString *identifier(const QString &s); const QString *identifier(const char *s, int n); - QSet identifiers() const; + std::unordered_set identifiers() const; const QString *number(const QString &s); const QString *number(const char *s, int n); - QSet numbers() const; + std::unordered_set numbers() const; // types const UndefinedType *undefinedType(); @@ -128,8 +129,8 @@ public: void error(int line, const QString &message); private: - QSet _identifiers; - QSet _numbers; + std::unordered_set _identifiers; + std::unordered_set _numbers; TypeTable _vectorTypes; TypeTable _matrixTypes; TypeTable _arrayTypes; From 415be13be23162b152c33bc2acb40ac452843d19 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Thu, 20 May 2021 14:36:23 +0200 Subject: [PATCH 08/17] Add missing includes in order to be able to compile creator with Qt6 on macOS Change-Id: Idea6feafe63ec099a4f4e552bb97df497f9254b1 Reviewed-by: Eike Ziller --- src/tools/iostool/iosdevicemanager.cpp | 2 ++ src/tools/iostool/iostool.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp index cab1d69ed3f..0f24d58868f 100644 --- a/src/tools/iostool/iosdevicemanager.cpp +++ b/src/tools/iostool/iosdevicemanager.cpp @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/src/tools/iostool/iostool.h b/src/tools/iostool/iostool.h index a2fd1f040e4..6aa85216ca0 100644 --- a/src/tools/iostool/iostool.h +++ b/src/tools/iostool/iostool.h @@ -29,6 +29,7 @@ #include #include +#include #include #include From e7f923e9f1031996e14cd5f71fe98d70d5f5ecc2 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Thu, 20 May 2021 14:37:57 +0200 Subject: [PATCH 09/17] Fix InvalidArgumentException for variant properties Attempting to convert a QVariant to type QVariant::QVariant fails with Qt6. This is now solved by constructing the QVariant with the QVariant in question. Fixes: QDS-4391 Change-Id: I20f64a3f2b3360705c73b3c1e1fd9e8987a31f3c Reviewed-by: Thomas Hartmann --- .../qmldesigner/designercore/model/propertyparser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp index b58b3eb2bdb..3c7b498a929 100644 --- a/src/plugins/qmldesigner/designercore/model/propertyparser.cpp +++ b/src/plugins/qmldesigner/designercore/model/propertyparser.cpp @@ -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; From ad167901403dd0ff9c8b4792e0be915f55da2bf3 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 20 May 2021 09:14:05 +0200 Subject: [PATCH 10/17] AutoTest: Do not ignore crashing tests If a test crashes we need to take its output into account to avoid not displaying a result for the respective test and having a wrong visual view of the results. Change-Id: I349153192fa06c5d61bc51f8274d32ceb8cf8731 Reviewed-by: David Schulz --- src/plugins/autotest/ctest/ctestoutputreader.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/ctest/ctestoutputreader.cpp b/src/plugins/autotest/ctest/ctestoutputreader.cpp index 0784a88b4ee..cc8a8a1bbd5 100644 --- a/src/plugins/autotest/ctest/ctestoutputreader.cpp +++ b/src/plugins/autotest/ctest/ctestoutputreader.cpp @@ -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|" + ".*\\*\\*\\*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") + m_result = ResultType::Fail; + else + m_result = ResultType::MessageFatal; } else if (ExactMatch match = summary.match(line)) { if (!m_testName.isEmpty()) sendCompleteInformation(); From 9449bfbf043b88d7acf300930dda0b1af3f179f7 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Thu, 20 May 2021 17:43:17 +0200 Subject: [PATCH 11/17] CMake: Fix build with MSVC 2019 and Qt 6.2 Qt 6.2 requires __cplusplus preprocessor set to at least 201703L According to https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus one needs to add the compiler flag /Zc:__cplusplus CMake doesn't set the flag, there is an issue opened at https://gitlab.kitware.com/cmake/cmake/-/issues/18837 This flag is passed to any target that links to Qt6::Core, unless the flags are not manually copied for some reason. Task-number: QTCREATORBUG-25730 Change-Id: I271e85fe857b5d4ac8980f77c723e5704a8eb743 Reviewed-by: Eike Ziller Reviewed-by: Alessandro Portale --- CMakeLists.txt | 11 ++++++----- cmake/QtCreatorAPIInternal.cmake | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef6f4c04993..db494bc249a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,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() @@ -87,11 +93,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) diff --git a/cmake/QtCreatorAPIInternal.cmake b/cmake/QtCreatorAPIInternal.cmake index 549f05a9448..45aa8246dbe 100644 --- a/cmake/QtCreatorAPIInternal.cmake +++ b/cmake/QtCreatorAPIInternal.cmake @@ -295,10 +295,12 @@ function(add_qtc_depends target_name) endif() foreach(obj_lib IN LISTS object_lib_depends) + target_compile_options(${target_name} PRIVATE $) target_compile_definitions(${target_name} PRIVATE $) target_include_directories(${target_name} PRIVATE $) endforeach() foreach(obj_lib IN LISTS object_public_depends) + target_compile_options(${target_name} PUBLIC $) target_compile_definitions(${target_name} PUBLIC $) target_include_directories(${target_name} PUBLIC $) endforeach() From 627f298ce13ecd8f9669e1b872477da54ba0d761 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 19 May 2021 14:13:31 +0200 Subject: [PATCH 12/17] COIN: Increase number of CPUs There is some fancy logic in COIN that sets different number of CPUs depending on configuration, which lead to our Linux machines crawling, while macOS and Windows at least got 4 CPUs. Fix (and increase) the number of CPUs for all platforms. Change-Id: I3191f1645420805f5899af8966fd1d377a89bf85 Reviewed-by: Cristian Adam --- coin/module_config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 0692ac7cd39..05175f38cd1 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -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: From 20604cedd84fdf04f5b030c60c04cc1043b3cb7d Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Mon, 10 May 2021 12:08:56 +0200 Subject: [PATCH 13/17] Android: Lower the time-out for license checks An issue in SynchronousProcess causes a time-out when the process output is not terminated with a \n or \r. This workaround lowers the timeout from 600 to 4 so that the unterminated output gets consumed nevertheless, and the user needs to wait only 4 seconds for that. Task-number: QTCREATORBUG-25667 Change-Id: I40f3053c7c4948c27003e9ec73d00a9d660024a4 Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidsdkmanager.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index ca66e26576f..c0001e7a39f 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -1014,10 +1014,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); From 4956be9935a6a3b96430a4e071861158230bbfa2 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 21 May 2021 11:45:08 +0200 Subject: [PATCH 14/17] AutoTest: Take failed to run ctests into account as well Otherwise the result will not be displayed and may lead to wrong test results with a contrary correct summary. Change-Id: Id041dbac441eea8a1a1d623acd87e049bca9a281 Reviewed-by: David Schulz --- src/plugins/autotest/ctest/ctestoutputreader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/ctest/ctestoutputreader.cpp b/src/plugins/autotest/ctest/ctestoutputreader.cpp index cc8a8a1bbd5..8722e2d9a6d 100644 --- a/src/plugins/autotest/ctest/ctestoutputreader.cpp +++ b/src/plugins/autotest/ctest/ctestoutputreader.cpp @@ -81,7 +81,7 @@ 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|" + "(Passed|\\*\\*\\*Failed|\\*\\*\\*Not Run|" ".*\\*\\*\\*Exception:.*)\\s+(.*) sec$"); static const QRegularExpression summary("^\\d+% tests passed, (\\d+) tests failed " "out of (\\d+)"); @@ -114,7 +114,7 @@ void CTestOutputReader::processOutputLine(const QByteArray &outputLine) const QString resultType = match.captured(3); if (resultType == "Passed") m_result = ResultType::Pass; - else if (resultType == "***Failed") + else if (resultType == "***Failed" || resultType == "***Not Run") m_result = ResultType::Fail; else m_result = ResultType::MessageFatal; From ef5423d6ce01531b47dd3ba3806c1980b667c21e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 25 May 2021 09:34:01 +0200 Subject: [PATCH 15/17] Fix another unguarded access to a QScreen QGuiApplication::screenAt(pos) can be nullptr. Task-number: QTCREATORBUG-25466 Change-Id: I0dd4b8afbc5e63927f6b910479db8ca68eea9c3e Reviewed-by: Qt CI Bot Reviewed-by: David Schulz --- src/libs/utils/tooltip/tooltip.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/tooltip/tooltip.cpp b/src/libs/utils/tooltip/tooltip.cpp index b665cc39423..94d8a4c1643 100644 --- a/src/libs/utils/tooltip/tooltip.cpp +++ b/src/libs/utils/tooltip/tooltip.cpp @@ -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()) From af4ce2fbe6f1901b2af1c123d8222d44abc8bf5e Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Tue, 25 May 2021 15:26:08 +0200 Subject: [PATCH 16/17] Set QSG_RHI_BACKEND to opengl in order to prevent a crash ancompanying the console output: QQuickWidget is only supported on OpenGL. Use QQuickWindow::setGraphicsApi() to override the default Change-Id: Iab7c0cc486b150723000cc11ba4c6d9cd4be8b03 Reviewed-by: Alessandro Portale --- src/app/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index bc5e61c7840..248fa8efef5 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -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") From 0980ef7e49b141f2c9129cb43ddf533e6956b1fd Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 25 May 2021 15:42:08 +0200 Subject: [PATCH 17/17] Tests: Adapt test after changing diagnostics Blocks are no more considered bad per se. Only if they contain a var statement they are considered as bad and worth a warning. Amends 2447d1d69ca941947c0df5cf32c6798f4cce1306. Change-Id: I93b5e43c01059b66f3fb287772e54f3ae3e157af Reviewed-by: Fabian Kosmale --- .../qml/codemodel/check/useless-blocks.qml | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/auto/qml/codemodel/check/useless-blocks.qml b/tests/auto/qml/codemodel/check/useless-blocks.qml index fc1c1e116b7..9fa0700c6a4 100644 --- a/tests/auto/qml/codemodel/check/useless-blocks.qml +++ b/tests/auto/qml/codemodel/check/useless-blocks.qml @@ -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 + } } }