From d9e38b15232a5a3d9a2e69abbd130b9c264fec68 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 4 Apr 2022 11:16:19 +0200 Subject: [PATCH 01/15] Update qbs submodule ... to HEAD of the 1.22 branch. Change-Id: Id46f13a95023780b30137a2501133ee2d4b55e3c Reviewed-by: Christian Stenger Reviewed-by: Qt CI Bot --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 58b882945d6..66c67898456 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 58b882945d6faaf928b0f9bd7fcd146935fe758c +Subproject commit 66c67898456c4f599e48d5466022d49b044f679d From 0c35d79e394b23bbc789a1c0d6cf49036eadeeb9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 4 Apr 2022 10:58:41 +0200 Subject: [PATCH 02/15] GitHub/COIN: Use LLVM 14.0.0 final Change-Id: I03c25423a32cfe5084342f6a6293dfd159e93783 Reviewed-by: Cristian Adam Reviewed-by: Qt CI Bot --- .github/workflows/build_cmake.yml | 2 +- coin/instructions/common_environment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index f388524f114..794ce6b3d72 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -8,7 +8,7 @@ on: env: QT_VERSION: 6.2.3 - CLANG_VERSION: 140 + CLANG_VERSION: 14.0.0 ELFUTILS_VERSION: 0.175 CMAKE_VERSION: 3.21.1 NINJA_VERSION: 1.10.2 diff --git a/coin/instructions/common_environment.yaml b/coin/instructions/common_environment.yaml index d179b44b4a3..a2f189f473b 100644 --- a/coin/instructions/common_environment.yaml +++ b/coin/instructions/common_environment.yaml @@ -7,7 +7,7 @@ instructions: variableValue: "RelWithDebInfo" - type: EnvironmentVariable variableName: LLVM_BASE_URL - variableValue: http://master.qt.io/development_releases/prebuilt/libclang/libclang-release_140-based + variableValue: http://master.qt.io/development_releases/prebuilt/libclang/libclang-release_14.0.0-based - type: Group instructions: From 25144c0afe39f9079812ebc660ed332a4f267e47 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 4 Apr 2022 12:01:39 +0200 Subject: [PATCH 03/15] ClangCodeModel: Fix erroneous highlighting as output argument ... for objects with non-const member calls. Amends 8247f4f3dd. Fixes: QTCREATORBUG-27306 Change-Id: I13fdf1ff9daf9ac084beda6c1d8ada5801adca4c Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: Christian Stenger --- src/plugins/clangcodemodel/clangdclient.cpp | 10 +++++++-- .../clangcodemodel/test/clangdtests.cpp | 6 ++++++ .../test/data/highlighting/highlighting.cpp | 21 +++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index ab08f9cc96f..0e4ff1bc3e8 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -2707,9 +2707,15 @@ static void semanticHighlighter(QFutureInterface &future, if (path.rbegin()->hasConstType()) return false; for (auto it = path.rbegin() + 1; it != path.rend(); ++it) { - if (it->kind() == "Call" || it->kind() == "CXXConstruct" - || it->kind() == "MemberInitializer") { + if (it->kind() == "CXXConstruct" || it->kind() == "MemberInitializer") return true; + + if (it->kind() == "Call") { + // In class templates, member calls can result in "Call" nodes rather than + // "CXXMemberCall". We try to detect this by checking for a certain kind of + // child node. + const QList children = it->children().value_or(QList()); + return children.isEmpty() || children.first().kind() != "CXXDependentScopeMember"; } // The token should get marked for e.g. lambdas, but not for assignment operators, diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp index 0381bd25772..67339c77293 100644 --- a/src/plugins/clangcodemodel/test/clangdtests.cpp +++ b/src/plugins/clangcodemodel/test/clangdtests.cpp @@ -1315,6 +1315,12 @@ void ClangdTestHighlighting::test_data() QTest::newRow("deref operator (object)") << 960 << 10 << 960 << 11 << QList{C_LOCAL} << 0; QTest::newRow("deref operator (member)") << 960 << 12 << 960 << 13 << QList{C_FIELD} << 0; QTest::newRow("nested call") << 979 << 20 << 979 << 21 << QList{C_LOCAL} << 0; + QTest::newRow("member call on dependent (1)") << 996 << 19 << 996 << 22 + << QList{C_FIELD} << 0; + QTest::newRow("member call on dependent (2)") << 996 << 38 << 996 << 41 + << QList{C_FIELD} << 0; + QTest::newRow("member call on dependent (3)") << 999 << 9 << 999 << 12 + << QList{C_LOCAL} << 0; } void ClangdTestHighlighting::test() diff --git a/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp b/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp index 7275ddd3307..1d4bcce7f8e 100644 --- a/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp +++ b/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp @@ -978,3 +978,24 @@ void nestedCall() my_struct* s = get_my_struct(); new my_struct2(s->method(0)); } + +template +class my_class +{ +private: + struct my_int + { + int n; + }; + + std::vector vec; + +public: + void foo() + { + auto it = vec.begin(), end = vec.end(); + + T* ptr = nullptr; + ptr->bar(); + } +}; From 06703e17d4a68381a69577aac1289d7efff3d9ea Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 4 Apr 2022 14:13:40 +0200 Subject: [PATCH 04/15] CMake: Add paths from target_link_directories to ((DY)LD_LIBRARY_)PATH So far we only looked at a target and added all paths of actually linked libraries to the ((DY)LD_LIBRARY_)PATH, if the "Add build library search path" option is on (the default). That often is fine, but - if the library to link to is only given as a library name, not a path and not a CMake target, then CMake file-api doesn't give us a path to the library either - on Windows, where the .lib is needed for compiletime linking, but the .dll is needed for runtime linking this only helps if the .dll was in the same directory as the .lib We already have a hack on Windows, if the directory ends in /lib, that we also add /lib/../bin, but that again only helps for that specific layout. Instead actually add the "build library search path", by adding the directories from target_link_directories, even if no libraries are linked from there. This fixes the "linked only by name" issue, and allows users to add a build library search path to the .dll too, and have that used by Qt Creator for running the application. Fixes: QTCREATORBUG-27201 Change-Id: I7b9210b791b4dae3a6d1747ff36e4b82235db2f9 Reviewed-by: Cristian Adam --- .../cmakeprojectmanager/fileapidataextractor.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp index d5836605f48..8a21729fafb 100644 --- a/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp +++ b/src/plugins/cmakeprojectmanager/fileapidataextractor.cpp @@ -268,7 +268,18 @@ QList generateBuildTargets(const PreprocessedData &input, // CMake sometimes mixes several shell-escaped pieces into one fragment. Disentangle that again: const QStringList parts = ProcessArgs::splitArgs(f.fragment); - for (const QString &part : parts) { + for (QString part : parts) { + // Library search paths that are added with target_link_directories are added as + // -LIBPATH:... (Windows/MSVC), or + // -L... (Unix/GCC) + // with role "libraryPath" + if (f.role == "libraryPath") { + if (part.startsWith("-LIBPATH:")) + part = part.mid(9); + else if (part.startsWith("-L")) + part = part.mid(2); + } + // Some projects abuse linking to libraries to pass random flags to the linker, so ignore // flags mixed into a fragment if (part.startsWith("-")) From 0ee4322dfdc5e03eb4c50c0b826ad6aa58786b28 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 4 Apr 2022 15:10:34 +0300 Subject: [PATCH 05/15] QmlDesigner: Auto close 3D import dialog on success Fixes: QDS-6573 Change-Id: I790a88a683e1cf4ca846148a4cde01b07b2a1844 Reviewed-by: Reviewed-by: Samuel Ghinet Reviewed-by: Mahmoud Badri --- .../itemlibrary/itemlibraryassetimportdialog.cpp | 8 +++++++- .../components/itemlibrary/itemlibraryassetimportdialog.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp index 1f974419c79..6c5005546e8 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.cpp @@ -724,11 +724,13 @@ void ItemLibraryAssetImportDialog::setCloseButtonState(bool importing) void ItemLibraryAssetImportDialog::addError(const QString &error, const QString &srcPath) { + m_closeOnFinish = false; addFormattedMessage(m_outputFormatter, error, srcPath, Utils::StdErrFormat); } void ItemLibraryAssetImportDialog::addWarning(const QString &warning, const QString &srcPath) { + m_closeOnFinish = false; addFormattedMessage(m_outputFormatter, warning, srcPath, Utils::StdOutFormat); } @@ -777,6 +779,10 @@ void ItemLibraryAssetImportDialog::onImportFinished() QString doneStr = tr("Import done."); addInfo(doneStr); setImportProgress(100, doneStr); + if (m_closeOnFinish) { + // Add small delay to allow user to visually confirm import finishing + QTimer::singleShot(1000, this, &ItemLibraryAssetImportDialog::onClose); + } } } @@ -785,7 +791,7 @@ void ItemLibraryAssetImportDialog::onClose() if (m_importer.isImporting()) { addInfo(tr("Canceling import.")); m_importer.cancelImport(); - } else { + } else if (isVisible()) { if (ui->progressBar->value() == 100) // import done successfully accept(); else diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.h b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.h index ded5d75703a..1b2c4c4ebda 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.h +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibraryassetimportdialog.h @@ -91,5 +91,6 @@ private: int m_optionsHeight = 0; int m_optionsRows = 0; QSet m_preselectedFilesForOverwrite; + bool m_closeOnFinish = true; }; } From cb86ca547ae9ddc020ac446b5947376da48ff211 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 4 Apr 2022 18:05:31 +0200 Subject: [PATCH 06/15] CppEditor: Fix "move function definition" ... for member functions with exception specification and/or reference qualifiers. The FunctionDeclaratorAST::cv_qualifier_list member can contain both the proper qualifiers "const" and "volatile" as well as the pseudo-qualifiers "override" and "final". The problem is that the former appear before exception specification and reference qualifiers, whereas the latter come afterwards. Therefore, when calculating the declarator's first and last tokens, we can't just mechanically check the different declarator members in order. Instead, we need to compare the token values to see which comes first. Task-number: QTCREATORBUG-27132 Change-Id: I924f9afe49453fa51b4a2fe010d1cc00c9defad1 Reviewed-by: Qt CI Bot Reviewed-by: Reviewed-by: Christian Stenger --- src/libs/3rdparty/cplusplus/AST.cpp | 51 +++++++++++++--------- src/plugins/cppeditor/cppquickfix_test.cpp | 35 +++++++++++++++ src/plugins/cppeditor/cppquickfix_test.h | 1 + 3 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/libs/3rdparty/cplusplus/AST.cpp b/src/libs/3rdparty/cplusplus/AST.cpp index a48067ab755..360918d2af2 100644 --- a/src/libs/3rdparty/cplusplus/AST.cpp +++ b/src/libs/3rdparty/cplusplus/AST.cpp @@ -1393,7 +1393,6 @@ int ForeachStatementAST::lastToken() const return 1; } -/** \generated */ int FunctionDeclaratorAST::firstToken() const { if (lparen_token) @@ -1403,40 +1402,50 @@ int FunctionDeclaratorAST::firstToken() const return candidate; if (rparen_token) return rparen_token; - if (cv_qualifier_list) - if (int candidate = cv_qualifier_list->firstToken()) - return candidate; - if (ref_qualifier_token) + const int firstQualListToken = cv_qualifier_list ? cv_qualifier_list->firstToken() : 0; + const auto isBeforeFirstQualListToken = [firstQualListToken](int token) { + return token && (!firstQualListToken || token < firstQualListToken); + }; + if (isBeforeFirstQualListToken(ref_qualifier_token)) return ref_qualifier_token; - if (exception_specification) - if (int candidate = exception_specification->firstToken()) + if (exception_specification) { + const int candidate = exception_specification->firstToken(); + if (isBeforeFirstQualListToken(candidate)) return candidate; - if (trailing_return_type) - if (int candidate = trailing_return_type->firstToken()) + } + if (trailing_return_type) { + const int candidate = trailing_return_type->firstToken(); + if (isBeforeFirstQualListToken(candidate)) return candidate; + } + if (firstQualListToken) + return firstQualListToken; if (as_cpp_initializer) if (int candidate = as_cpp_initializer->firstToken()) return candidate; return 0; } -/** \generated */ int FunctionDeclaratorAST::lastToken() const { if (as_cpp_initializer) if (int candidate = as_cpp_initializer->lastToken()) return candidate; - if (trailing_return_type) - if (int candidate = trailing_return_type->lastToken()) - return candidate; - if (exception_specification) - if (int candidate = exception_specification->lastToken()) - return candidate; - if (ref_qualifier_token) - return ref_qualifier_token + 1; - if (cv_qualifier_list) - if (int candidate = cv_qualifier_list->lastToken()) - return candidate; + const int lastQualListToken = cv_qualifier_list ? cv_qualifier_list->lastToken() : 0; + const auto tokenOrLastQualListToken = [lastQualListToken](int token) { + return std::max(token ? token + 1 : 0, lastQualListToken); + }; + const auto tokenFromAstOrLastQualListToken = [lastQualListToken](const AST *ast) { + return std::max(ast ? ast->lastToken() : 0, lastQualListToken); + }; + if (int candidate = tokenFromAstOrLastQualListToken(trailing_return_type)) + return candidate; + if (int candidate = tokenFromAstOrLastQualListToken(exception_specification)) + return candidate; + if (int candidate = tokenOrLastQualListToken(ref_qualifier_token)) + return candidate; + if (lastQualListToken) + return lastQualListToken; if (rparen_token) return rparen_token + 1; if (parameter_declaration_clause) diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index dd85e95470e..93845b51c80 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -6110,6 +6110,41 @@ void QuickfixTest::testMoveFuncDefOutsideMemberFuncToCppWithInlinePartOfName() QuickFixOperationTest(testDocuments, &factory); } +void QuickfixTest::testMoveFuncDefOutsideMixedQualifiers() +{ + QList testDocuments; + QByteArray original; + QByteArray expected; + + // Header File + original = R"( +struct Base { + virtual auto func() const && noexcept -> void = 0; +}; +struct Derived : public Base { + auto @func() const && noexcept -> void override {} +};)"; + expected = R"( +struct Base { + virtual auto func() const && noexcept -> void = 0; +}; +struct Derived : public Base { + auto func() const && noexcept -> void override; +};)"; + testDocuments << CppTestDocument::create("file.h", original, expected); + + // Source File + original = "#include \"file.h\"\n"; + expected = R"DELIM(#include "file.h" + +void Derived::func() const &&noexcept {} +)DELIM"; + testDocuments << CppTestDocument::create("file.cpp", original, expected); + + MoveFuncDefOutside factory; + QuickFixOperationTest(testDocuments, &factory); +} + void QuickfixTest::testMoveFuncDefOutsideMemberFuncToCppInsideNS() { QList testDocuments; diff --git a/src/plugins/cppeditor/cppquickfix_test.h b/src/plugins/cppeditor/cppquickfix_test.h index 0201c5b3bb9..3995234374b 100644 --- a/src/plugins/cppeditor/cppquickfix_test.h +++ b/src/plugins/cppeditor/cppquickfix_test.h @@ -192,6 +192,7 @@ private slots: void testMoveFuncDefOutsideUnnamedTemplate(); void testMoveFuncDefOutsideMemberFuncToCppStatic(); void testMoveFuncDefOutsideMemberFuncToCppWithInlinePartOfName(); + void testMoveFuncDefOutsideMixedQualifiers(); void testMoveAllFuncDefOutsideMemberFuncToCpp(); void testMoveAllFuncDefOutsideMemberFuncOutside(); From 00df4c66754db2082d92ccf5c594a7b072fa46e6 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 5 Apr 2022 14:21:34 +0200 Subject: [PATCH 07/15] Valgrind: Remove expect to fail of a test This seems to be fixed meanwhile. Change-Id: Ia2868fb6d8f1fd1bd3510965c57407e1cd62067a Reviewed-by: hjk --- src/plugins/valgrind/valgrindmemcheckparsertest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp index 51380183028..4ca3d768126 100644 --- a/src/plugins/valgrind/valgrindmemcheckparsertest.cpp +++ b/src/plugins/valgrind/valgrindmemcheckparsertest.cpp @@ -549,7 +549,6 @@ void ValgrindMemcheckParserTest::testValgrindStartError() RunnerDumper dumper(&runner); runner.start(); runner.waitForFinished(); - QEXPECT_FAIL("", "Error codes of valgrind startup are currently unprocessed", Continue); //FIXME QVERIFY(dumper.m_errorReceived); // just finish without deadlock and we are fine } From b8144e0c51259994ea88bd1302776fced19a4755 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 5 Apr 2022 12:57:17 +0200 Subject: [PATCH 08/15] CppEditor: Use trailing return type when moving function definition ... if the original definition also used a trailing return type. Task-number: QTCREATORBUG-27132 Change-Id: Iaeeeac08601f1d931aabe12be9f89ca0240d97a2 Reviewed-by: Christian Stenger Reviewed-by: Qt CI Bot Reviewed-by: --- src/libs/cplusplus/Overview.cpp | 1 + src/libs/cplusplus/Overview.h | 1 + src/libs/cplusplus/TypePrettyPrinter.cpp | 22 +++++++++++++++++----- src/plugins/cppeditor/cppquickfix_test.cpp | 2 +- src/plugins/cppeditor/cppquickfixes.cpp | 7 +++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/libs/cplusplus/Overview.cpp b/src/libs/cplusplus/Overview.cpp index 7303791b06d..02288d94cde 100644 --- a/src/libs/cplusplus/Overview.cpp +++ b/src/libs/cplusplus/Overview.cpp @@ -86,6 +86,7 @@ Overview::Overview() showTemplateParameters(false), showEnclosingTemplate(false), includeWhiteSpaceInOperatorName(true), + trailingReturnType(false), markedArgument(0), markedArgumentBegin(0), markedArgumentEnd(0) diff --git a/src/libs/cplusplus/Overview.h b/src/libs/cplusplus/Overview.h index 243390cd8ad..d12daa581fa 100644 --- a/src/libs/cplusplus/Overview.h +++ b/src/libs/cplusplus/Overview.h @@ -69,6 +69,7 @@ public: bool showTemplateParameters: 1; bool showEnclosingTemplate: 1; bool includeWhiteSpaceInOperatorName: 1; /// "operator =()" vs "operator=()" + bool trailingReturnType: 1; int markedArgument; int markedArgumentBegin; diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index d766a3f03b9..b184e2a1e1a 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -435,11 +435,17 @@ void TypePrettyPrinter::visit(Function *type) retAndArgOverview.showTemplateParameters = true; if (_overview->showReturnTypes) { - const QString returnType = retAndArgOverview.prettyType(type->returnType()); - if (!returnType.isEmpty()) { - if (!endsWithPtrOrRef(returnType) || !(_overview->starBindFlags & Overview::BindToIdentifier)) - _text.prepend(QLatin1Char(' ')); - _text.prepend(returnType); + if (_overview->trailingReturnType) { + _text.prepend("auto "); + } else { + const QString returnType = retAndArgOverview.prettyType(type->returnType()); + if (!returnType.isEmpty()) { + if (!endsWithPtrOrRef(returnType) + || !(_overview->starBindFlags & Overview::BindToIdentifier)) { + _text.prepend(QLatin1Char(' ')); + } + _text.prepend(returnType); + } } } @@ -529,6 +535,12 @@ void TypePrettyPrinter::visit(Function *type) _text += QLatin1String(spec->chars()); } } + + if (_overview->showReturnTypes && _overview->trailingReturnType) { + const QString returnType = retAndArgOverview.prettyType(type->returnType()); + if (!returnType.isEmpty()) + _text.append(" -> ").append(returnType); + } } void TypePrettyPrinter::appendSpace() diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 93845b51c80..c0ee38d6e27 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -6137,7 +6137,7 @@ struct Derived : public Base { original = "#include \"file.h\"\n"; expected = R"DELIM(#include "file.h" -void Derived::func() const &&noexcept {} +auto Derived::func() const &&noexcept -> void {} )DELIM"; testDocuments << CppTestDocument::create("file.cpp", original, expected); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 7afc867297e..6ed9736f3e1 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -6234,6 +6234,13 @@ QString definitionSignature(const CppQuickFixInterface *assist, oo.showArgumentNames = true; oo.showEnclosingTemplate = true; oo.showTemplateParameters = true; + oo.trailingReturnType = functionDefinitionAST->declarator + && functionDefinitionAST->declarator->postfix_declarator_list + && functionDefinitionAST->declarator->postfix_declarator_list->value + && functionDefinitionAST->declarator->postfix_declarator_list + ->value->asFunctionDeclarator() + && functionDefinitionAST->declarator->postfix_declarator_list + ->value->asFunctionDeclarator()->trailing_return_type; const Name *name = func->name(); if (name && nameIncludesOperatorName(name)) { CoreDeclaratorAST *coreDeclarator = functionDefinitionAST->declarator->core_declarator; From b404852cb1478b76fc7435844298643dfc746373 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 5 Apr 2022 13:44:22 +0200 Subject: [PATCH 09/15] qbs build: Do not build the translations by default Fixes: QTCREATORBUG-27324 Change-Id: Iba2e6b3b211ba7cb6de5e18e67f36d1f4165e23f Reviewed-by: Alessandro Portale Reviewed-by: --- share/qtcreator/translations/translations.qbs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/qtcreator/translations/translations.qbs b/share/qtcreator/translations/translations.qbs index 33e6a0f8724..4e4faddcc89 100644 --- a/share/qtcreator/translations/translations.qbs +++ b/share/qtcreator/translations/translations.qbs @@ -3,6 +3,8 @@ import qbs 1.0 Product { name: "Translations" type: "qm" + builtByDefault: false + Depends { name: "Qt.core" } Depends { name: "qtc" } From c2c8b137c04de8dfd92d376a0fd2493a6336c0e6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 5 Apr 2022 13:37:09 +0200 Subject: [PATCH 10/15] CppEditor: Ensure a space between ref qualifier and exception spec Task-number: QTCREATORBUG-27132 Change-Id: Iedb983f58ece345d5997607d2e557e36c951750f Reviewed-by: Christian Stenger Reviewed-by: --- src/libs/cplusplus/TypePrettyPrinter.cpp | 5 ++++- src/plugins/cppeditor/cppquickfix_test.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp index b184e2a1e1a..d6a2ce84fac 100644 --- a/src/libs/cplusplus/TypePrettyPrinter.cpp +++ b/src/libs/cplusplus/TypePrettyPrinter.cpp @@ -531,7 +531,10 @@ void TypePrettyPrinter::visit(Function *type) // add exception specifier if (const StringLiteral *spec = type->exceptionSpecification()) { - appendSpace(); + if (type->refQualifier() != Function::NoRefQualifier) + _text.append(' '); + else + appendSpace(); _text += QLatin1String(spec->chars()); } } diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index c0ee38d6e27..a2ed383c12f 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -6137,7 +6137,7 @@ struct Derived : public Base { original = "#include \"file.h\"\n"; expected = R"DELIM(#include "file.h" -auto Derived::func() const &&noexcept -> void {} +auto Derived::func() const && noexcept -> void {} )DELIM"; testDocuments << CppTestDocument::create("file.cpp", original, expected); From 73a78a70dad941546b2d2b4ab56cc6451c6ed15e Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 5 Apr 2022 12:07:33 +0200 Subject: [PATCH 11/15] Examples: Make sure to select some example set if available In the case of the bug report, there is no previously selected index, and no valid Qt version, so setting the index to the highest Qt version doesn't result in anything. Make sure to select something in the dropdown, if we have any item there at all, even if our heuristics don't come up with an optimal selection. Fixes: QTCREATORBUG-26791 Change-Id: I2327594f0fd36e312aa71d1990e8ccab4a488367 Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: Christian Stenger --- src/plugins/qtsupport/exampleslistmodel.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 7f030d524f5..ebe547176e2 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -555,6 +555,9 @@ void ExampleSetModel::updateQtVersionList() newQtVersion = findHighestQtVersion(versions); currentIndex = indexForQtVersion(newQtVersion); } // nothing to do for extra example sets + // Make sure to select something even if the above failed + if (currentIndex < 0 && rowCount() > 0) + currentIndex = 0; // simply select first selectExampleSet(currentIndex); emit selectedExampleSetChanged(currentIndex); } From 4e59ca2bb582cba9804bc3e4fdb3470fb028f1b6 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 6 Apr 2022 08:50:53 +0200 Subject: [PATCH 12/15] Examples: Match tags case insensitively Fixes: QTCREATORBUG-27339 Change-Id: I33a5726f9e1d66dafa876ec279f3c1ca939d964c Reviewed-by: Alessandro Portale Reviewed-by: Reviewed-by: Kai Koehne --- src/plugins/coreplugin/welcomepagehelper.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index ffdfc4bcde0..0bbd3fa2520 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -204,7 +204,7 @@ bool ListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP if (!m_filterTags.isEmpty()) { return Utils::allOf(m_filterTags, [&item](const QString &filterTag) { - return item->tags.contains(filterTag); + return item->tags.contains(filterTag, Qt::CaseInsensitive); }); } @@ -214,7 +214,9 @@ bool ListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceP wordMatch |= bool(item->name.contains(subString, Qt::CaseInsensitive)); if (wordMatch) continue; - const auto subMatch = [&subString](const QString &elem) { return elem.contains(subString); }; + const auto subMatch = [&subString](const QString &elem) { + return elem.contains(subString, Qt::CaseInsensitive); + }; wordMatch |= Utils::contains(item->tags, subMatch); if (wordMatch) continue; From be1437c797d82c1f69301e3f048032d51aee1d4b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 6 Apr 2022 10:42:54 +0200 Subject: [PATCH 13/15] Fix opening terminal with macOS 12.3 macOS removed support for Python2, so switch to Python3 (and fix that we now need to specify text mode for a temporary file if we want to write text there, not binary data). Fixes: QTCREATORBUG-27337 Change-Id: I4884480c32e017aa710f90ab0b5afe493a2adb9e Reviewed-by: Reviewed-by: Christian Stenger --- share/qtcreator/scripts/openTerminal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/scripts/openTerminal.py b/share/qtcreator/scripts/openTerminal.py index a0347c08674..8bab290d43e 100755 --- a/share/qtcreator/scripts/openTerminal.py +++ b/share/qtcreator/scripts/openTerminal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################ # @@ -102,7 +102,7 @@ def bash_setup(shell): def main(): # create temporary file to be sourced into bash that deletes itself - with NamedTemporaryFile(delete=False) as shell_script: + with NamedTemporaryFile(mode='wt', delete=False) as shell_script: shell = os.environ.get('SHELL') shell, system_login_script, login_script, non_interactive_shell, interactive_shell = ( zsh_setup(shell) if shell is not None and shell.endswith('/zsh') From 3da441f4d18fbb333e8dc5d2b3a3f07c7a256cd1 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 6 Apr 2022 16:58:20 +0200 Subject: [PATCH 14/15] QmlDesigner: Fix compound alias properties Change-Id: I5d58b6b740af71ef10010548429e1d12f97c620c Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index d966d4fda1b..5e34593cc34 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -98,7 +98,6 @@ static TypeName resolveTypeName(const ASTPropertyReference *ref, const ContextPt type = componentObjectValue->className().toUtf8(); dotProperties = getObjectTypes(componentObjectValue, context); } else if (const ObjectValue * objectValue = value->asObjectValue()) { - type = objectValue->className().toUtf8(); dotProperties = getObjectTypes(objectValue, context); } From 221b52d01a87a5bcbf52c5e51dba297c5666e504 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 6 Apr 2022 12:47:25 +0200 Subject: [PATCH 15/15] Core: fix OptionsPopup positioning Do not limit the popups coordinates to positive y coordinates, since Monitors above the main monitor have a negative y coordinate. Use the the available geometry of the parent widgets screen to check for sensible coordinates instead. Fixes: QTCREATORBUG-27341 Change-Id: I6e1572f7b2d3c83feafcf71392e265e14e6b457d Reviewed-by: Qt CI Bot Reviewed-by: Eike Ziller --- src/plugins/coreplugin/find/optionspopup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/find/optionspopup.cpp b/src/plugins/coreplugin/find/optionspopup.cpp index 532bd22390d..ab383b6e7b8 100644 --- a/src/plugins/coreplugin/find/optionspopup.cpp +++ b/src/plugins/coreplugin/find/optionspopup.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include using namespace Utils; @@ -64,7 +65,8 @@ OptionsPopup::OptionsPopup(QWidget *parent, const QVector &commands) layout->addWidget(checkBox); } const QPoint globalPos = parent->mapToGlobal(QPoint(0, -sizeHint().height())); - move(globalPos.x(), std::max(globalPos.y(), 0)); + const QRect screenGeometry = parent->screen()->availableGeometry(); + move(globalPos.x(), std::max(globalPos.y(), screenGeometry.y())); } bool OptionsPopup::event(QEvent *ev)