From a23560582e11bce673819d6cfb24318bbbf24f5c Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 16 Nov 2018 08:24:59 +0200 Subject: [PATCH 01/47] Themes: Unify Message and NormalMessage colors in dark themes They're (rightfully) identical in the light themes. Will remove Normal in master. Change-Id: I18c0d196ae98846ac46616c1b00545206ba935c5 Reviewed-by: Tobias Hunger Reviewed-by: Alessandro Portale --- share/qtcreator/themes/dark.creatortheme | 2 +- share/qtcreator/themes/design.creatortheme | 2 +- share/qtcreator/themes/flat-dark.creatortheme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/themes/dark.creatortheme b/share/qtcreator/themes/dark.creatortheme index ff7ec91561e..ef19fc9fa63 100644 --- a/share/qtcreator/themes/dark.creatortheme +++ b/share/qtcreator/themes/dark.creatortheme @@ -130,7 +130,7 @@ TreeViewArrowColorSelected=text OutputPanes_DebugTextColor=text OutputPanes_ErrorMessageTextColor=ffff6c6c OutputPanes_MessageOutput=ff008787 -OutputPanes_NormalMessageTextColor=text +OutputPanes_NormalMessageTextColor=ff008787 OutputPanes_StdErrTextColor=ffff6666 OutputPanes_StdOutTextColor=text OutputPanes_WarningMessageTextColor=fff3c300 diff --git a/share/qtcreator/themes/design.creatortheme b/share/qtcreator/themes/design.creatortheme index 60f074f328a..8db109f313f 100644 --- a/share/qtcreator/themes/design.creatortheme +++ b/share/qtcreator/themes/design.creatortheme @@ -190,7 +190,7 @@ TreeViewArrowColorSelected=text OutputPanes_DebugTextColor=text OutputPanes_ErrorMessageTextColor=ffff6c6c OutputPanes_MessageOutput=ff008787 -OutputPanes_NormalMessageTextColor=text +OutputPanes_NormalMessageTextColor=ff008787 OutputPanes_StdErrTextColor=ffff6666 OutputPanes_StdOutTextColor=text OutputPanes_WarningMessageTextColor=fff3c300 diff --git a/share/qtcreator/themes/flat-dark.creatortheme b/share/qtcreator/themes/flat-dark.creatortheme index 5a533b2d678..0c01aa17071 100644 --- a/share/qtcreator/themes/flat-dark.creatortheme +++ b/share/qtcreator/themes/flat-dark.creatortheme @@ -134,7 +134,7 @@ TreeViewArrowColorSelected=text OutputPanes_DebugTextColor=text OutputPanes_ErrorMessageTextColor=ffff6c6c OutputPanes_MessageOutput=ff008787 -OutputPanes_NormalMessageTextColor=text +OutputPanes_NormalMessageTextColor=ff008787 OutputPanes_StdErrTextColor=ffff6666 OutputPanes_StdOutTextColor=text OutputPanes_WarningMessageTextColor=fff3c300 From 8d78378e5c46f43f3e7dd67b83ef0a08c8f5950e Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Wed, 21 Nov 2018 09:47:55 +0100 Subject: [PATCH 02/47] ProjectExplorer: White list -target and -gcc-toolchain Clang from Android NDK does not recognize -fPIC option unless "-target" is specified. They are also required to properly get include paths. Change-Id: I0fc4b70f43669142b7f57f3372cbdca0eea68a40 Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/gcctoolchain.cpp | 42 ++++++++++---------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index f0469b9c472..3a1c39b8d7f 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -396,27 +396,28 @@ ToolChain::MacroInspectionRunner GccToolChain::createMacroInspectionRunner() con } else if (a == "-arch") { if (++iArg < allFlags.length() && !arguments.contains(a)) arguments << a << allFlags.at(iArg); - } else if (a == "--sysroot" || a == "-isysroot" || a == "-D" ||a == "-U") { + } else if (a == "--sysroot" || a == "-isysroot" || a == "-D" || a == "-U" + || a == "-gcc-toolchain" || a == "-target") { if (++iArg < allFlags.length()) arguments << a << allFlags.at(iArg); - } else if (a == "-m128bit-long-double" || a == "-m32" || a == "-m3dnow" || a == "-m3dnowa" - || a == "-m64" || a == "-m96bit-long-double" || a == "-mabm" || a == "-maes" - || a.startsWith("-march=") || a == "-mavx" || a.startsWith("-masm=") - || a.startsWith("-mfloat-abi") - || a == "-mcx16" || a == "-mfma" || a == "-mfma4" || a == "-mlwp" - || a == "-mpclmul" || a == "-mpopcnt" || a == "-msse" || a == "-msse2" - || a == "-msse2avx" || a == "-msse3" || a == "-msse4" || a == "-msse4.1" - || a == "-msse4.2" || a == "-msse4a" || a == "-mssse3" - || a.startsWith("-mtune=") || a == "-mxop" - || a == "-Os" || a == "-O0" || a == "-O1" || a == "-O2" || a == "-O3" - || a == "-ffinite-math-only" || a == "-fshort-double" || a == "-fshort-wchar" - || a == "-fsignaling-nans" || a == "-fno-inline" || a == "-fno-exceptions" - || a == "-fstack-protector" || a == "-fstack-protector-all" - || a == "-fsanitize=address" || a == "-fno-rtti" - || a.startsWith("-std=") || a.startsWith("-stdlib=") || a.startsWith("-specs=") - || a == "-ansi" || a == "-undef" || a.startsWith("-D") || a.startsWith("-U") - || a == "-fopenmp" || a == "-Wno-deprecated" || a == "-fPIC" || a == "-fpic" - || a == "-fPIE" || a == "-fpie") + } else if (a == "-m128bit-long-double" || a == "-m32" || a == "-m3dnow" + || a == "-m3dnowa" || a == "-m64" || a == "-m96bit-long-double" + || a == "-mabm" || a == "-maes" || a.startsWith("-march=") || a == "-mavx" + || a.startsWith("-masm=") || a.startsWith("-mfloat-abi") || a == "-mcx16" + || a == "-mfma" || a == "-mfma4" || a == "-mlwp" || a == "-mpclmul" + || a == "-mpopcnt" || a == "-msse" || a == "-msse2" || a == "-msse2avx" + || a == "-msse3" || a == "-msse4" || a == "-msse4.1" || a == "-msse4.2" + || a == "-msse4a" || a == "-mssse3" || a.startsWith("-mtune=") + || a == "-mxop" || a == "-Os" || a == "-O0" || a == "-O1" || a == "-O2" + || a == "-O3" || a == "-ffinite-math-only" || a == "-fshort-double" + || a == "-fshort-wchar" || a == "-fsignaling-nans" || a == "-fno-inline" + || a == "-fno-exceptions" || a == "-fstack-protector" + || a == "-fstack-protector-all" || a == "-fsanitize=address" + || a == "-fno-rtti" || a.startsWith("-std=") || a.startsWith("-stdlib=") + || a.startsWith("-specs=") || a == "-ansi" || a == "-undef" + || a.startsWith("-D") || a.startsWith("-U") || a == "-fopenmp" + || a == "-Wno-deprecated" || a == "-fPIC" || a == "-fpic" || a == "-fPIE" + || a == "-fpie") arguments << a; } @@ -551,7 +552,8 @@ QStringList GccToolChain::gccPrepareArguments(const QStringList &flags, // pass build system's sysroot to compiler, if we didn't pass one from kit if (flag.startsWith("--sysroot=")) { arguments << flag; - } else if ((flag.startsWith("-isysroot") || flag.startsWith("--sysroot")) + } else if ((flag.startsWith("-isysroot") || flag.startsWith("--sysroot") + || flag == "-target" || flag == "-gcc-toolchain") && i < flags.size() - 1) { arguments << flag << allFlags.at(i + 1); ++i; From 647566c135bc2693bc486e7b23567870cc194e4b Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Wed, 21 Nov 2018 10:25:31 +0100 Subject: [PATCH 03/47] ProjectExplorer: Fix Android built-in header paths We get some Android header paths from qmake. Let's use them as built-in headers. Change-Id: I3b48d6dbef7127fdef3b4d8b2115c7844a0cd9cd Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/gcctoolchain.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 3a1c39b8d7f..10102a794f1 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -546,14 +546,14 @@ QStringList GccToolChain::gccPrepareArguments(const QStringList &flags, for (int i = 0; i < allFlags.size(); ++i) { const QString &flag = allFlags.at(i); if (flag.startsWith("-stdlib=") || flag.startsWith("--gcctoolchain=") - || flag.startsWith("-B")) { + || flag.startsWith("-B") || (flag.startsWith("-isystem") && flag.length() > 8)) { arguments << flag; } else if (!hasKitSysroot) { // pass build system's sysroot to compiler, if we didn't pass one from kit if (flag.startsWith("--sysroot=")) { arguments << flag; } else if ((flag.startsWith("-isysroot") || flag.startsWith("--sysroot") - || flag == "-target" || flag == "-gcc-toolchain") + || flag == "-target" || flag == "-gcc-toolchain" || flag == "-isystem") && i < flags.size() - 1) { arguments << flag << allFlags.at(i + 1); ++i; From 053b2090b46ad59f3614c2c9877df3f0f0c906a4 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 12 Nov 2018 13:18:27 +0100 Subject: [PATCH 04/47] Clang: Fix C++ paths search in compiler options builder Take into account paths from MinGW and NDK Clang. Fixes: QTCREATORBUG-21540 Change-Id: I00906c75dc4ddeb92fe5942a0222285d8ce2eb9d Reviewed-by: Marco Bubke --- .../cpptools/compileroptionsbuilder.cpp | 11 +-- .../unittest/compileroptionsbuilder-test.cpp | 78 +++++++++++++++++++ 2 files changed, 84 insertions(+), 5 deletions(-) diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index e3f2be6c83a..1529cb445fa 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -235,14 +235,15 @@ static int lastIncludeIndex(const QStringList &options, const QRegularExpression static int includeIndexForResourceDirectory(const QStringList &options, bool isMacOs = false) { - // include/c++/{version}, include/c++/v1 and include/g++ - static const QRegularExpression includeRegExp( - R"(\A.*[\/\\]include[\/\\].*(g\+\+.*\z|c\+\+[\/\\](v1\z|\d+.*\z)))"); + // include/c++, include/g++, libc++\include and libc++abi\include + static const QString cppIncludes = R"((.*[\/\\]include[\/\\].*(g\+\+|c\+\+).*))" + R"(|(.*libc\+\+[\/\\]include))" + R"(|(.*libc\+\+abi[\/\\]include))"; + static const QRegularExpression includeRegExp("\\A(" + cppIncludes + ")\\z"); // The same as includeRegExp but also matches /usr/local/include static const QRegularExpression includeRegExpMac( - R"(\A(.*[\/\\]include[\/\\].*(g\+\+.*\z|c\+\+[\/\\](v1\z|\d+.*\z))))" - R"(|([\/\\]usr[\/\\]local[\/\\]include\z))"); + "\\A(" + cppIncludes + R"(|([\/\\]usr[\/\\]local[\/\\]include))" + ")\\z"); const int cppIncludeIndex = lastIncludeIndex(options, isMacOs ? includeRegExpMac diff --git a/tests/unit/unittest/compileroptionsbuilder-test.cpp b/tests/unit/unittest/compileroptionsbuilder-test.cpp index 662ff7787f8..6b2d1af11e3 100644 --- a/tests/unit/unittest/compileroptionsbuilder-test.cpp +++ b/tests/unit/unittest/compileroptionsbuilder-test.cpp @@ -230,6 +230,84 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux) "-isystem", QDir::toNativeSeparators("/usr/include"))); } +TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) +{ + projectPart.headerPaths = {HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include", HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++", HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32", HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward", HeaderPathType::BuiltIn} + }; + projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu"; + CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, + CppTools::UseSystemHeader::No, + CppTools::SkipBuiltIn::No, + CppTools::SkipLanguageDefines::Yes, + "7.0.0", + ""); + + compilerOptionsBuilder.addHeaderPathOptions(); + + ASSERT_THAT(compilerOptionsBuilder.options(), + ElementsAre("-nostdinc", + "-nostdlibinc", + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include"), + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++"), + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32"), + "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward"), + "-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""))); +} + +TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) +{ + projectPart.headerPaths = { + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include", + HeaderPathType::BuiltIn}, + HeaderPath{ + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include", + HeaderPathType::BuiltIn}, + HeaderPath{"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include", + HeaderPathType::BuiltIn}}; + projectPart.toolChainTargetTriple = "i686-linux-android"; + CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, + CppTools::UseSystemHeader::No, + CppTools::SkipBuiltIn::No, + CppTools::SkipLanguageDefines::Yes, + "7.0.0", + ""); + + compilerOptionsBuilder.addHeaderPathOptions(); + + ASSERT_THAT( + compilerOptionsBuilder.options(), + ElementsAre( + "-nostdinc", + "-nostdlibinc", + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android"), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include"), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include"), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include"), + "-isystem", + QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), + "-isystem", + QDir::toNativeSeparators( + "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include"))); +} + TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader) { compilerOptionsBuilder.addPrecompiledHeaderOptions(CppTools::CompilerOptionsBuilder::PchUsage::None); From c76411a55eeffd620182473d3e2421e6870937f2 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 20 Nov 2018 08:15:11 +0100 Subject: [PATCH 05/47] AutoTest: Remove old declaration Missed while transition to QC 4.0. Change-Id: Ib62b52b607d8f7e929c482622f48804c01a25a24 Reviewed-by: David Schulz --- src/plugins/autotest/autotestplugin.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/autotest/autotestplugin.h b/src/plugins/autotest/autotestplugin.h index 97dbcc38d5f..dcbdb5ddde1 100644 --- a/src/plugins/autotest/autotestplugin.h +++ b/src/plugins/autotest/autotestplugin.h @@ -73,7 +73,6 @@ public: static void clearChoiceCache(); private: - bool checkLicense(); void initializeMenuEntries(); void onRunAllTriggered(); void onRunSelectedTriggered(); From 04b20a1a46818b84efbfb11d8cb3c6a8613f608f Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 20 Nov 2018 15:19:32 +0100 Subject: [PATCH 06/47] Android: Fix uploading file on Windows Quoting of arguments on Windows behaves differently depending on the used start() overload of QProcess. Setting the program and arguments before calling start() with only the QIODevice::OpenMode parameter allows to preserve the wanted quoting. Task-number: QTCREATORBUG-21547 Done-with: Oliver Wolff Change-Id: I644ea0737d51d6114facb19a0ad70f10aeb79f2c Reviewed-by: Orgad Shaneh Reviewed-by: Eike Ziller --- src/libs/utils/synchronousprocess.cpp | 8 +++++++- src/plugins/android/androidrunnerworker.cpp | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index f9ab96eb478..a153e6ac91f 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -455,7 +455,11 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary, // executable cannot be found in the path. Do not start the // event loop in that case. d->m_binary = binary; - d->m_process.start(binary, args, writeData.isEmpty() ? QIODevice::ReadOnly : QIODevice::ReadWrite); + // using QProcess::start() and passing program, args and OpenMode results in a different + // quoting of arguments than using QProcess::setArguments() beforehand and calling start() + // only with the OpenMode + d->m_process.setProgram(binary); + d->m_process.setArguments(args); connect(&d->m_process, &QProcess::started, this, [this, writeData] { if (!writeData.isEmpty()) { int pos = 0; @@ -469,6 +473,8 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary, } d->m_process.closeWriteChannel(); }); + d->m_process.start(writeData.isEmpty() ? QIODevice::ReadOnly : QIODevice::ReadWrite); + if (!d->m_startFailure) { d->m_timer.start(); if (isGuiThread()) diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index 78cc6ffcff7..17004b10351 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -278,7 +278,7 @@ bool AndroidRunnerWorker::uploadFile(const QString &from, const QString &to, con if (!f.open(QIODevice::ReadOnly)) return false; runAdb({"shell", "run-as", m_packageName, "rm", to}); - auto res = runAdb({"shell", "run-as", m_packageName, "sh", "-c", QString("'cat > %1'").arg(to)}, 60, f.readAll()); + auto res = runAdb({"shell", "run-as", m_packageName, QString("sh -c 'cat > %1'").arg(to)}, 60, f.readAll()); if (!res) return false; return runAdb({"shell", "run-as", m_packageName, "chmod", flags, to}); From 10f15f5d1a299a3a9c3931a1549db566a85718a7 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 21 Nov 2018 08:07:07 +0100 Subject: [PATCH 07/47] Android: List extra packages as well These packages should get listed as well as they contain (at least on Windows) essential packages. Change-Id: Ia8fb8fc641ac6d9a7fba8f65a31ef65eae560a99 Reviewed-by: Eike Ziller --- src/plugins/android/androidsdkmanager.cpp | 25 ++++++++++++++++++++++- src/plugins/android/androidsdkpackage.cpp | 15 ++++++++++++++ src/plugins/android/androidsdkpackage.h | 13 +++++++++++- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/plugins/android/androidsdkmanager.cpp b/src/plugins/android/androidsdkmanager.cpp index 00f866d47e9..54d9837e2a6 100644 --- a/src/plugins/android/androidsdkmanager.cpp +++ b/src/plugins/android/androidsdkmanager.cpp @@ -261,6 +261,7 @@ public: SdkToolsMarker = 0x100, PlatformToolsMarker = 0x200, EmulatorToolsMarker = 0x400, + ExtrasMarker = 0x800, SectionMarkers = InstalledPackagesMarker | AvailablePackagesMarkers | AvailableUpdatesMarker }; @@ -280,6 +281,7 @@ private: SdkTools *parseSdkToolsPackage(const QStringList &data) const; PlatformTools *parsePlatformToolsPackage(const QStringList &data) const; EmulatorTools *parseEmulatorToolsPackage(const QStringList &data) const; + ExtraTools *parseExtraToolsPackage(const QStringList &data) const; MarkerTag parseMarkers(const QString &line); MarkerTag m_currentSection = MarkerTag::None; @@ -295,7 +297,8 @@ const std::map markerTags { {SdkManagerOutputParser::MarkerTag::BuildToolsMarker, "build-tools"}, {SdkManagerOutputParser::MarkerTag::SdkToolsMarker, "tools"}, {SdkManagerOutputParser::MarkerTag::PlatformToolsMarker, "platform-tools"}, - {SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"} + {SdkManagerOutputParser::MarkerTag::EmulatorToolsMarker, "emulator"}, + {SdkManagerOutputParser::MarkerTag::ExtrasMarker, "extras"} }; AndroidSdkManager::AndroidSdkManager(const AndroidConfig &config, QObject *parent): @@ -562,6 +565,10 @@ void SdkManagerOutputParser::parsePackageData(MarkerTag packageMarker, const QSt } break; + case MarkerTag::ExtrasMarker: + createPackage(&SdkManagerOutputParser::parseExtraToolsPackage); + break; + default: qCDebug(sdkManagerLog) << "Unhandled package: " << markerTags.at(packageMarker); break; @@ -726,6 +733,22 @@ EmulatorTools *SdkManagerOutputParser::parseEmulatorToolsPackage(const QStringLi return emulatorTools; } +ExtraTools *SdkManagerOutputParser::parseExtraToolsPackage(const QStringList &data) const +{ + ExtraTools *extraTools = nullptr; + GenericPackageData packageData; + if (parseAbstractData(packageData, data, 1, "Extras")) { + extraTools = new ExtraTools(packageData.revision, data.at(0)); + extraTools->setDescriptionText(packageData.description); + extraTools->setDisplayText(packageData.description); + extraTools->setInstalledLocation(packageData.installedLocation); + } else { + qCDebug(sdkManagerLog) << "Extra-tools: Parsing failed. Minimum required data " + "unavailable:" << data; + } + return extraTools; +} + SdkManagerOutputParser::MarkerTag SdkManagerOutputParser::parseMarkers(const QString &line) { if (line.isEmpty()) diff --git a/src/plugins/android/androidsdkpackage.cpp b/src/plugins/android/androidsdkpackage.cpp index 7451fef7f00..64de3dcfce5 100644 --- a/src/plugins/android/androidsdkpackage.cpp +++ b/src/plugins/android/androidsdkpackage.cpp @@ -269,4 +269,19 @@ AndroidSdkPackage::PackageType EmulatorTools::type() const return AndroidSdkPackage::EmulatorToolsPackage; } +ExtraTools::ExtraTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent) : + AndroidSdkPackage(revision, sdkStylePathStr, parent) +{ +} + +bool ExtraTools::isValid() const +{ + return installedLocation().exists(); +} + +AndroidSdkPackage::PackageType ExtraTools::type() const +{ + return AndroidSdkPackage::ExtraToolsPackage; +} + } // namespace Android diff --git a/src/plugins/android/androidsdkpackage.h b/src/plugins/android/androidsdkpackage.h index 0a209c38bf6..09415bd19a6 100644 --- a/src/plugins/android/androidsdkpackage.h +++ b/src/plugins/android/androidsdkpackage.h @@ -53,8 +53,9 @@ public: SdkPlatformPackage = 1 << 4, SystemImagePackage = 1 << 5, EmulatorToolsPackage = 1 << 6, + ExtraToolsPackage = 1 << 7, AnyValidType = SdkToolsPackage | BuildToolsPackage | PlatformToolsPackage | - SdkPlatformPackage | SystemImagePackage | EmulatorToolsPackage + SdkPlatformPackage | SystemImagePackage | EmulatorToolsPackage | ExtraToolsPackage }; enum PackageState { @@ -191,6 +192,16 @@ public: bool isValid() const override; PackageType type() const override; }; + +class ExtraTools : public AndroidSdkPackage +{ +public: + ExtraTools(QVersionNumber revision, QString sdkStylePathStr, QObject *parent = nullptr); + +// AndroidSdkPackage Overrides + bool isValid() const override; + PackageType type() const override; +}; } // namespace Android From e43aa08ebedae93168c5d7027124abda05445951 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 20 Nov 2018 16:20:41 +0100 Subject: [PATCH 08/47] ClangPchManager: Store collected build dependencies Task-number: QTCREATORBUG-21289 Task-number: QTCREATORBUG-21377 Change-Id: Idba57ac09bc5a1f1ccef87f5e33f1ceeaccea372 Reviewed-by: Ivan Donchevskii --- .../source/builddependenciesprovider.cpp | 40 ++++++- .../source/builddependenciesprovider.h | 25 +++-- .../builddependenciesproviderinterface.h | 2 +- .../source/builddependenciesstorage.h | 104 +++++++++--------- ...lectbuilddependencypreprocessorcallbacks.h | 5 +- .../builddependenciesprovider-test.cpp | 66 +++++++++-- .../builddependenciesstorage-test.cpp | 30 ++--- .../unittest/mockbuilddependenciesprovider.h | 5 +- 8 files changed, 180 insertions(+), 97 deletions(-) diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp index c3146408f85..7f97599facb 100644 --- a/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.cpp @@ -29,6 +29,8 @@ #include "modifiedtimecheckerinterface.h" #include "builddependencygeneratorinterface.h" +#include + #include namespace ClangBackEnd { @@ -51,19 +53,25 @@ OutputContainer setUnion(InputContainer1 &&input1, return results; } -BuildDependency BuildDependenciesProvider::create(const V2::ProjectPartContainer &projectPart) const +BuildDependency BuildDependenciesProvider::create(const V2::ProjectPartContainer &projectPart) { SourceEntries includes = createSourceEntriesFromStorage(projectPart.sourcePathIds, projectPart.projectPartId); - if (!m_modifiedTimeChecker.isUpToDate(includes)) - return m_buildDependenciesGenerator.create(projectPart); + if (!m_modifiedTimeChecker.isUpToDate(includes)) { + BuildDependency buildDependency = m_generator.create(projectPart); + + storeBuildDependency(buildDependency); + + return buildDependency; + } return createBuildDependencyFromStorage(std::move(includes)); } -BuildDependency BuildDependenciesProvider::createBuildDependencyFromStorage(SourceEntries &&includes) const +BuildDependency BuildDependenciesProvider::createBuildDependencyFromStorage( + SourceEntries &&includes) const { BuildDependency buildDependency; @@ -78,14 +86,18 @@ UsedMacros BuildDependenciesProvider::createUsedMacrosFromStorage(const SourceEn UsedMacros usedMacros; usedMacros.reserve(1024); + Sqlite::DeferredTransaction transaction(m_transactionBackend); + for (const SourceEntry &entry : includes) { - UsedMacros macros = m_buildDependenciesStorage.fetchUsedMacros(entry.sourceId); + UsedMacros macros = m_storage.fetchUsedMacros(entry.sourceId); std::sort(macros.begin(), macros.end()); usedMacros.insert(usedMacros.end(), std::make_move_iterator(macros.begin()), std::make_move_iterator(macros.end())); } + transaction.commit(); + return usedMacros; } @@ -94,15 +106,31 @@ SourceEntries BuildDependenciesProvider::createSourceEntriesFromStorage( { SourceEntries includes; + Sqlite::DeferredTransaction transaction(m_transactionBackend); + for (FilePathId sourcePathId : sourcePathIds) { - SourceEntries entries = m_buildDependenciesStorage.fetchDependSources(sourcePathId, + SourceEntries entries = m_storage.fetchDependSources(sourcePathId, projectPartId); SourceEntries mergedEntries = setUnion(includes, entries); includes = std::move(mergedEntries); } + transaction.commit(); + return includes; } +void BuildDependenciesProvider::storeBuildDependency(const BuildDependency &buildDependency) +{ + Sqlite::ImmediateTransaction transaction(m_transactionBackend); + + m_storage.updateSources(buildDependency.includes); + m_storage.insertFileStatuses(buildDependency.fileStatuses); + m_storage.insertOrUpdateSourceDependencies(buildDependency.sourceDependencies); + m_storage.insertOrUpdateUsedMacros(buildDependency.usedMacros); + + transaction.commit(); +} + } // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h index 8c22077e816..386eca587ed 100644 --- a/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesprovider.h @@ -27,6 +27,10 @@ #include "builddependenciesproviderinterface.h" +namespace Sqlite { +class TransactionInterface; +} + namespace ClangBackEnd { class BuildDependenciesStorageInterface; @@ -38,25 +42,28 @@ class BuildDependenciesProvider : public BuildDependenciesProviderInterface public: BuildDependenciesProvider(BuildDependenciesStorageInterface &buildDependenciesStorage, ModifiedTimeCheckerInterface &modifiedTimeChecker, - BuildDependencyGeneratorInterface &buildDependenciesGenerator) - : m_buildDependenciesStorage(buildDependenciesStorage), - m_modifiedTimeChecker(modifiedTimeChecker), - m_buildDependenciesGenerator(buildDependenciesGenerator) - { - } + BuildDependencyGeneratorInterface &buildDependenciesGenerator, + Sqlite::TransactionInterface &transactionBackend) + : m_storage(buildDependenciesStorage) + , m_modifiedTimeChecker(modifiedTimeChecker) + , m_generator(buildDependenciesGenerator) + , m_transactionBackend(transactionBackend) + {} - BuildDependency create(const V2::ProjectPartContainer &projectPart) const override; + BuildDependency create(const V2::ProjectPartContainer &projectPart) override; private: BuildDependency createBuildDependencyFromStorage(SourceEntries &&includes) const; UsedMacros createUsedMacrosFromStorage(const SourceEntries &includes) const; SourceEntries createSourceEntriesFromStorage(const FilePathIds &sourcePathIds, Utils::SmallStringView projectPartId) const; + void storeBuildDependency(const BuildDependency &buildDependency); private: - BuildDependenciesStorageInterface &m_buildDependenciesStorage; + BuildDependenciesStorageInterface &m_storage; ModifiedTimeCheckerInterface &m_modifiedTimeChecker; - BuildDependencyGeneratorInterface &m_buildDependenciesGenerator; + BuildDependencyGeneratorInterface &m_generator; + Sqlite::TransactionInterface &m_transactionBackend; }; } // namespace ClangBackEnd diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h index f596b83da9b..0bfaeed06cd 100644 --- a/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesproviderinterface.h @@ -34,7 +34,7 @@ namespace ClangBackEnd { class BuildDependenciesProviderInterface { public: - virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) const = 0; + virtual BuildDependency create(const V2::ProjectPartContainer &projectPart) = 0; protected: ~BuildDependenciesProviderInterface() = default; diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h index ecb2d7cc7dc..f894ed8ecd0 100644 --- a/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h +++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h @@ -47,25 +47,25 @@ class BuildDependenciesStorage final : public BuildDependenciesStorageInterface using WriteStatement = typename Database::WriteStatement; public: BuildDependenciesStorage(Database &database) - : m_transaction(database), - m_database(database) + : transaction(database), + database(database) { - m_transaction.commit(); + transaction.commit(); } void updateSources(const SourceEntries &sourceEntries) override { for (const SourceEntry &entry : sourceEntries) { - m_updateBuildDependencyTimeStampStatement.write(static_cast(entry.lastModified), + updateBuildDependencyTimeStampStatement.write(static_cast(entry.lastModified), entry.sourceId.filePathId); - m_updateSourceTypeStatement.write(static_cast(entry.sourceType), + updateSourceTypeStatement.write(static_cast(entry.sourceType), entry.sourceId.filePathId); } } void insertFileStatuses(const FileStatuses &fileStatuses) override { - WriteStatement &statement = m_insertFileStatusesStatement; + WriteStatement &statement = insertFileStatusesStatement; for (const FileStatus &fileStatus : fileStatuses) statement.write(fileStatus.filePathId.filePathId, @@ -76,41 +76,41 @@ public: long long fetchLowestLastModifiedTime(FilePathId sourceId) const override { - ReadStatement &statement = m_getLowestLastModifiedTimeOfDependencies; + ReadStatement &statement = getLowestLastModifiedTimeOfDependencies; return statement.template value(sourceId.filePathId).value_or(0); } void insertOrUpdateUsedMacros(const UsedMacros &usedMacros) override { - WriteStatement &insertStatement = m_insertIntoNewUsedMacrosStatement; + WriteStatement &insertStatement = insertIntoNewUsedMacrosStatement; for (const UsedMacro &usedMacro : usedMacros) insertStatement.write(usedMacro.filePathId.filePathId, usedMacro.macroName); - m_syncNewUsedMacrosStatement.execute(); - m_deleteOutdatedUsedMacrosStatement.execute(); - m_deleteNewUsedMacrosTableStatement.execute(); + syncNewUsedMacrosStatement.execute(); + deleteOutdatedUsedMacrosStatement.execute(); + deleteNewUsedMacrosTableStatement.execute(); } void insertOrUpdateSourceDependencies(const SourceDependencies &sourceDependencies) override { - WriteStatement &insertStatement = m_insertIntoNewSourceDependenciesStatement; + WriteStatement &insertStatement = insertIntoNewSourceDependenciesStatement; for (SourceDependency sourceDependency : sourceDependencies) insertStatement.write(sourceDependency.filePathId.filePathId, sourceDependency.dependencyFilePathId.filePathId); - m_syncNewSourceDependenciesStatement.execute(); - m_deleteOutdatedSourceDependenciesStatement.execute(); - m_deleteNewSourceDependenciesStatement.execute(); + syncNewSourceDependenciesStatement.execute(); + deleteOutdatedSourceDependenciesStatement.execute(); + deleteNewSourceDependenciesStatement.execute(); } SourceEntries fetchDependSources(FilePathId sourceId, Utils::SmallStringView projectPartName) const override { - auto projectPartId = m_fetchProjectPartIdStatement.template value(projectPartName); + auto projectPartId = fetchProjectPartIdStatement.template value(projectPartName); if (projectPartId) { - return m_fetchSourceDependenciesStatement.template values( + return fetchSourceDependenciesStatement.template values( 300, sourceId.filePathId, projectPartId.value()); @@ -120,7 +120,7 @@ public: UsedMacros fetchUsedMacros(FilePathId sourceId) const override { - return m_fetchUsedMacrosStatement.template values(128, sourceId.filePathId); + return fetchUsedMacrosStatement.template values(128, sourceId.filePathId); } static Utils::SmallString toJson(const Utils::SmallStringVector &strings) @@ -159,7 +159,7 @@ public: const Sqlite::Column ¯oNameColumn = table.addColumn("macroName", Sqlite::ColumnType::Text); table.addIndex({sourceIdColumn, macroNameColumn}); - table.initialize(m_database); + table.initialize(database); return table; } @@ -173,75 +173,75 @@ public: const Sqlite::Column &dependencySourceIdColumn = table.addColumn("dependencySourceId", Sqlite::ColumnType::Text); table.addIndex({sourceIdColumn, dependencySourceIdColumn}); - table.initialize(m_database); + table.initialize(database); return table; } public: - Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction; - Database &m_database; + Sqlite::ImmediateNonThrowingDestructorTransaction transaction; + Database &database; Sqlite::Table newUsedMacroTable{createNewUsedMacrosTable()}; Sqlite::Table newNewSourceDependenciesTable{createNewSourceDependenciesTable()}; - WriteStatement m_insertIntoNewUsedMacrosStatement{ + WriteStatement insertIntoNewUsedMacrosStatement{ "INSERT INTO newUsedMacros(sourceId, macroName) VALUES (?,?)", - m_database + database }; - WriteStatement m_syncNewUsedMacrosStatement{ + WriteStatement syncNewUsedMacrosStatement{ "INSERT INTO usedMacros(sourceId, macroName) SELECT sourceId, macroName FROM newUsedMacros WHERE NOT EXISTS (SELECT sourceId FROM usedMacros WHERE usedMacros.sourceId == newUsedMacros.sourceId AND usedMacros.macroName == newUsedMacros.macroName)", - m_database + database }; - WriteStatement m_deleteOutdatedUsedMacrosStatement{ + WriteStatement deleteOutdatedUsedMacrosStatement{ "DELETE FROM usedMacros WHERE sourceId IN (SELECT sourceId FROM newUsedMacros) AND NOT EXISTS (SELECT sourceId FROM newUsedMacros WHERE newUsedMacros.sourceId == usedMacros.sourceId AND newUsedMacros.macroName == usedMacros.macroName)", - m_database + database }; - WriteStatement m_deleteNewUsedMacrosTableStatement{ + WriteStatement deleteNewUsedMacrosTableStatement{ "DELETE FROM newUsedMacros", - m_database + database }; - mutable ReadStatement m_getLowestLastModifiedTimeOfDependencies{ + mutable ReadStatement getLowestLastModifiedTimeOfDependencies{ "WITH RECURSIVE sourceIds(sourceId) AS (VALUES(?) UNION SELECT dependencySourceId FROM sourceDependencies, sourceIds WHERE sourceDependencies.sourceId = sourceIds.sourceId) SELECT min(lastModified) FROM fileStatuses, sourceIds WHERE fileStatuses.sourceId = sourceIds.sourceId", - m_database + database }; - WriteStatement m_insertIntoNewSourceDependenciesStatement{ + WriteStatement insertIntoNewSourceDependenciesStatement{ "INSERT INTO newSourceDependencies(sourceId, dependencySourceId) VALUES (?,?)", - m_database + database }; - WriteStatement m_insertFileStatusesStatement{ + WriteStatement insertFileStatusesStatement{ "INSERT OR REPLACE INTO fileStatuses(sourceId, size, lastModified, isInPrecompiledHeader) VALUES (?,?,?,?)", - m_database + database }; - WriteStatement m_syncNewSourceDependenciesStatement{ + WriteStatement syncNewSourceDependenciesStatement{ "INSERT INTO sourceDependencies(sourceId, dependencySourceId) SELECT sourceId, dependencySourceId FROM newSourceDependencies WHERE NOT EXISTS (SELECT sourceId FROM sourceDependencies WHERE sourceDependencies.sourceId == newSourceDependencies.sourceId AND sourceDependencies.dependencySourceId == newSourceDependencies.dependencySourceId)", - m_database + database }; - WriteStatement m_deleteOutdatedSourceDependenciesStatement{ + WriteStatement deleteOutdatedSourceDependenciesStatement{ "DELETE FROM sourceDependencies WHERE sourceId IN (SELECT sourceId FROM newSourceDependencies) AND NOT EXISTS (SELECT sourceId FROM newSourceDependencies WHERE newSourceDependencies.sourceId == sourceDependencies.sourceId AND newSourceDependencies.dependencySourceId == sourceDependencies.dependencySourceId)", - m_database + database }; - WriteStatement m_deleteNewSourceDependenciesStatement{ + WriteStatement deleteNewSourceDependenciesStatement{ "DELETE FROM newSourceDependencies", - m_database + database }; - WriteStatement m_updateBuildDependencyTimeStampStatement{ + WriteStatement updateBuildDependencyTimeStampStatement{ "UPDATE fileStatuses SET buildDependencyTimeStamp = ? WHERE sourceId == ?", - m_database + database }; - WriteStatement m_updateSourceTypeStatement{ + WriteStatement updateSourceTypeStatement{ "UPDATE projectPartsSources SET sourceType = ? WHERE sourceId == ?", - m_database + database }; - mutable ReadStatement m_fetchSourceDependenciesStatement{ + mutable ReadStatement fetchSourceDependenciesStatement{ "WITH RECURSIVE collectedDependencies(sourceId) AS (VALUES(?) UNION SELECT dependencySourceId FROM sourceDependencies, collectedDependencies WHERE sourceDependencies.sourceId == collectedDependencies.sourceId) SELECT sourceId, buildDependencyTimeStamp, sourceType FROM collectedDependencies NATURAL JOIN projectPartsSources NATURAL JOIN fileStatuses WHERE projectPartId = ?", - m_database + database }; - mutable ReadStatement m_fetchProjectPartIdStatement{ + mutable ReadStatement fetchProjectPartIdStatement{ "SELECT projectPartId FROM projectParts WHERE projectPartName = ?", - m_database + database }; - mutable ReadStatement m_fetchUsedMacrosStatement{ + mutable ReadStatement fetchUsedMacrosStatement{ "SELECT macroName, sourceId FROM usedMacros WHERE sourceId = ?", - m_database + database }; }; } diff --git a/src/tools/clangpchmanagerbackend/source/collectbuilddependencypreprocessorcallbacks.h b/src/tools/clangpchmanagerbackend/source/collectbuilddependencypreprocessorcallbacks.h index 07c163c92ba..0962129cb61 100644 --- a/src/tools/clangpchmanagerbackend/source/collectbuilddependencypreprocessorcallbacks.h +++ b/src/tools/clangpchmanagerbackend/source/collectbuilddependencypreprocessorcallbacks.h @@ -44,8 +44,9 @@ namespace ClangBackEnd { -class CollectBuildDependencyPreprocessorCallbacks final : public clang::PPCallbacks, - public CollectUsedMacrosAndSourcesPreprocessorCallbacksBase +class CollectBuildDependencyPreprocessorCallbacks final + : public clang::PPCallbacks, + public CollectUsedMacrosAndSourcesPreprocessorCallbacksBase { public: CollectBuildDependencyPreprocessorCallbacks(BuildDependency &buildDependency, diff --git a/tests/unit/unittest/builddependenciesprovider-test.cpp b/tests/unit/unittest/builddependenciesprovider-test.cpp index e829b52d60e..64a92478282 100644 --- a/tests/unit/unittest/builddependenciesprovider-test.cpp +++ b/tests/unit/unittest/builddependenciesprovider-test.cpp @@ -28,6 +28,7 @@ #include "mockbuilddependenciesstorage.h" #include "mockmodifiedtimechecker.h" #include "mockbuilddependencygenerator.h" +#include "mocksqlitetransactionbackend.h" #include @@ -54,38 +55,67 @@ MATCHER_P(HasSourceId, sourceId, std::string(negation ? "hasn't" : "has") class BuildDependenciesProvider : public testing::Test { protected: + NiceMock mockSqliteTransactionBackend; NiceMock mockBuildDependenciesStorage; NiceMock mockModifiedTimeChecker; NiceMock mockBuildDependenciesGenerator; - ClangBackEnd::BuildDependenciesProvider provider{mockBuildDependenciesStorage, mockModifiedTimeChecker, mockBuildDependenciesGenerator}; + ClangBackEnd::BuildDependenciesProvider provider{mockBuildDependenciesStorage, + mockModifiedTimeChecker, + mockBuildDependenciesGenerator, + mockSqliteTransactionBackend}; ClangBackEnd::V2::ProjectPartContainer projectPart1{"ProjectPart1", {"--yi"}, - {{"YI","1"}}, + {{"YI", "1"}}, {"/yi"}, {1}, {2}}; ClangBackEnd::V2::ProjectPartContainer projectPart2{"ProjectPart2", {"--er"}, - {{"ER","2"}}, + {{"ER", "2"}}, {"/er"}, {1}, {2, 3, 4}}; - SourceEntries firstSources{{1, SourceType::UserInclude, 1}, {2, SourceType::UserInclude, 1}, {10, SourceType::UserInclude, 1}}; - SourceEntries secondSources{{1, SourceType::UserInclude, 1}, {3, SourceType::UserInclude, 1}, {8, SourceType::UserInclude, 1}}; - SourceEntries thirdSources{{4, SourceType::UserInclude, 1}, {8, SourceType::UserInclude, 1}, {10, SourceType::UserInclude, 1}}; + SourceEntries firstSources{{1, SourceType::UserInclude, 1}, + {2, SourceType::UserInclude, 1}, + {10, SourceType::UserInclude, 1}}; + SourceEntries secondSources{{1, SourceType::UserInclude, 1}, + {3, SourceType::UserInclude, 1}, + {8, SourceType::UserInclude, 1}}; + SourceEntries thirdSources{{4, SourceType::UserInclude, 1}, + {8, SourceType::UserInclude, 1}, + {10, SourceType::UserInclude, 1}}; UsedMacros firstUsedMacros{{"YI", 1}}; UsedMacros secondUsedMacros{{"LIANG", 2}, {"ER", 2}}; UsedMacros thirdUsedMacros{{"SAN", 10}}; - BuildDependency buildDependency{secondSources, {}}; + FilePathIds sourceFiles{1, 3, 8}; + ClangBackEnd::SourceDependencies sourceDependencies{{1, 3}, {1, 8}}; + ClangBackEnd::FileStatuses fileStatuses{{1, 21, 12, false}, + {3, 21, 12, false}, + {8, 21, 12, false}}; + BuildDependency buildDependency{ + secondSources, + secondUsedMacros, + sourceFiles, + sourceDependencies, + fileStatuses + }; }; TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromStorageIfTimeStampsAreUpToDate) { InSequence s; - EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); + EXPECT_CALL(mockBuildDependenciesStorage, + fetchDependSources({2}, TypedEq("ProjectPart1"))) + .WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true)); EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)).Times(0); + EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()).Times(0); + EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); provider.create(projectPart1); } @@ -95,6 +125,7 @@ TEST_F(BuildDependenciesProvider, FetchDependSourcesFromStorage) ON_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart2"))).WillByDefault(Return(firstSources)); ON_CALL(mockBuildDependenciesStorage, fetchDependSources({3}, TypedEq("ProjectPart2"))).WillByDefault(Return(secondSources)); ON_CALL(mockBuildDependenciesStorage, fetchDependSources({4}, TypedEq("ProjectPart2"))).WillByDefault(Return(thirdSources)); + ON_CALL(mockModifiedTimeChecker, isUpToDate(_)).WillByDefault(Return(true)); auto buildDependency = provider.create(projectPart2); @@ -106,9 +137,20 @@ TEST_F(BuildDependenciesProvider, CreateCallsFetchDependSourcesFromGeneratorIfTi { InSequence s; - EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); + EXPECT_CALL(mockBuildDependenciesStorage, + fetchDependSources({2}, TypedEq("ProjectPart1"))) + .WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(false)); - EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)); + EXPECT_CALL(mockBuildDependenciesGenerator, create(projectPart1)) + .WillOnce(Return(buildDependency)); + EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()); + EXPECT_CALL(mockBuildDependenciesStorage, updateSources(Eq(secondSources))); + EXPECT_CALL(mockBuildDependenciesStorage, insertFileStatuses(Eq(fileStatuses))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateSourceDependencies(Eq(sourceDependencies))); + EXPECT_CALL(mockBuildDependenciesStorage, insertOrUpdateUsedMacros(Eq(secondUsedMacros))); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); provider.create(projectPart1); } @@ -128,11 +170,15 @@ TEST_F(BuildDependenciesProvider, CreateCallsFetchUsedMacrosFromStorageIfTimeSta { InSequence s; + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockBuildDependenciesStorage, fetchDependSources({2}, TypedEq("ProjectPart1"))).WillRepeatedly(Return(firstSources)); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockModifiedTimeChecker, isUpToDate(firstSources)).WillRepeatedly(Return(true)); + EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({1})); EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({2})); EXPECT_CALL(mockBuildDependenciesStorage, fetchUsedMacros({10})); + EXPECT_CALL(mockSqliteTransactionBackend, commit()); provider.create(projectPart1); } diff --git a/tests/unit/unittest/builddependenciesstorage-test.cpp b/tests/unit/unittest/builddependenciesstorage-test.cpp index 1100f1a634f..77feb21bd7f 100644 --- a/tests/unit/unittest/builddependenciesstorage-test.cpp +++ b/tests/unit/unittest/builddependenciesstorage-test.cpp @@ -51,21 +51,21 @@ class BuildDependenciesStorage : public testing::Test protected: NiceMock mockDatabase; Storage storage{mockDatabase}; - MockSqliteWriteStatement &insertIntoNewUsedMacrosStatement = storage.m_insertIntoNewUsedMacrosStatement; - MockSqliteWriteStatement &syncNewUsedMacrosStatement =storage.m_syncNewUsedMacrosStatement; - MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = storage.m_deleteOutdatedUsedMacrosStatement; - MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = storage.m_deleteNewUsedMacrosTableStatement; - MockSqliteWriteStatement &insertFileStatuses = storage.m_insertFileStatusesStatement; - MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = storage.m_insertIntoNewSourceDependenciesStatement; - MockSqliteWriteStatement &syncNewSourceDependenciesStatement = storage.m_syncNewSourceDependenciesStatement; - MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = storage.m_deleteOutdatedSourceDependenciesStatement; - MockSqliteWriteStatement &deleteNewSourceDependenciesStatement = storage.m_deleteNewSourceDependenciesStatement; - MockSqliteReadStatement &getLowestLastModifiedTimeOfDependencies = storage.m_getLowestLastModifiedTimeOfDependencies; - MockSqliteWriteStatement &updateBuildDependencyTimeStampStatement = storage.m_updateBuildDependencyTimeStampStatement; - MockSqliteWriteStatement &updateSourceTypeStatement = storage.m_updateSourceTypeStatement; - MockSqliteReadStatement &fetchSourceDependenciesStatement = storage.m_fetchSourceDependenciesStatement; - MockSqliteReadStatement &fetchProjectPartIdStatement = storage.m_fetchProjectPartIdStatement; - MockSqliteReadStatement &fetchUsedMacrosStatement = storage.m_fetchUsedMacrosStatement; + MockSqliteWriteStatement &insertIntoNewUsedMacrosStatement = storage.insertIntoNewUsedMacrosStatement; + MockSqliteWriteStatement &syncNewUsedMacrosStatement =storage.syncNewUsedMacrosStatement; + MockSqliteWriteStatement &deleteOutdatedUsedMacrosStatement = storage.deleteOutdatedUsedMacrosStatement; + MockSqliteWriteStatement &deleteNewUsedMacrosTableStatement = storage.deleteNewUsedMacrosTableStatement; + MockSqliteWriteStatement &insertFileStatuses = storage.insertFileStatusesStatement; + MockSqliteWriteStatement &insertIntoNewSourceDependenciesStatement = storage.insertIntoNewSourceDependenciesStatement; + MockSqliteWriteStatement &syncNewSourceDependenciesStatement = storage.syncNewSourceDependenciesStatement; + MockSqliteWriteStatement &deleteOutdatedSourceDependenciesStatement = storage.deleteOutdatedSourceDependenciesStatement; + MockSqliteWriteStatement &deleteNewSourceDependenciesStatement = storage.deleteNewSourceDependenciesStatement; + MockSqliteReadStatement &getLowestLastModifiedTimeOfDependencies = storage.getLowestLastModifiedTimeOfDependencies; + MockSqliteWriteStatement &updateBuildDependencyTimeStampStatement = storage.updateBuildDependencyTimeStampStatement; + MockSqliteWriteStatement &updateSourceTypeStatement = storage.updateSourceTypeStatement; + MockSqliteReadStatement &fetchSourceDependenciesStatement = storage.fetchSourceDependenciesStatement; + MockSqliteReadStatement &fetchProjectPartIdStatement = storage.fetchProjectPartIdStatement; + MockSqliteReadStatement &fetchUsedMacrosStatement = storage.fetchUsedMacrosStatement; }; TEST_F(BuildDependenciesStorage, ConvertStringsToJson) diff --git a/tests/unit/unittest/mockbuilddependenciesprovider.h b/tests/unit/unittest/mockbuilddependenciesprovider.h index 8bb048bd248..2a1fd8f93f1 100644 --- a/tests/unit/unittest/mockbuilddependenciesprovider.h +++ b/tests/unit/unittest/mockbuilddependenciesprovider.h @@ -32,6 +32,7 @@ class MockBuildDependenciesProvider : public ClangBackEnd::BuildDependenciesProviderInterface { public: - MOCK_CONST_METHOD1(create, - ClangBackEnd::BuildDependency (const ClangBackEnd::V2::ProjectPartContainer &projectPart)); + MOCK_METHOD1( + create, + ClangBackEnd::BuildDependency(const ClangBackEnd::V2::ProjectPartContainer &projectPart)); }; From ca7c534e58161f2aa89b0e04571894ea1419e958 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Wed, 21 Nov 2018 16:06:06 +0100 Subject: [PATCH 09/47] QmlDesigner: Fix crash Change-Id: Idc7be64697764878ea320992efc78a40a0a1cb48 Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index ad7cf13efc0..745fdc4d00b 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -63,8 +63,7 @@ void QmlObjectNode::setVariantProperty(const PropertyName &name, const QVariant timelineFrames.setValue(value, frame); return; - } else if (timelineIsActive()) { - + } else if (modelNode().hasId() && timelineIsActive()) { QmlTimelineKeyframeGroup timelineFrames(currentTimeline().keyframeGroup(modelNode(), name)); Q_ASSERT(timelineFrames.isValid()); From 069ac16e1917441a89e3e24405e36255a3bfe184 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 21 Nov 2018 15:23:08 +0100 Subject: [PATCH 10/47] Android: Fix passing binary data through pipe on Windows Passing binary data through a pipe may break as soon it hits a control sequence. Encode binary data before piping and decode it on the device before writing to file. Fixes: QTCREATORBUG-21547 Change-Id: Iddef5582631575fdd2091c3795d2468be10b8c74 Reviewed-by: Eike Ziller --- src/plugins/android/androidrunnerworker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index 17004b10351..f76f202bba2 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -278,7 +278,8 @@ bool AndroidRunnerWorker::uploadFile(const QString &from, const QString &to, con if (!f.open(QIODevice::ReadOnly)) return false; runAdb({"shell", "run-as", m_packageName, "rm", to}); - auto res = runAdb({"shell", "run-as", m_packageName, QString("sh -c 'cat > %1'").arg(to)}, 60, f.readAll()); + const QByteArray data = f.readAll(); + const bool res = runAdb({"shell", "run-as", m_packageName, QString("sh -c 'base64 -d > %1'").arg(to)}, 60, data.toBase64()); if (!res) return false; return runAdb({"shell", "run-as", m_packageName, "chmod", flags, to}); From 1c9c42c3b22cb5ae8895a1c6a032aec37fcea7b6 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 14 Nov 2018 12:22:07 +0100 Subject: [PATCH 11/47] Update late changes in German translation Change-Id: Ib091abc409aa767ec8d27016fe9dbb3854f6fbec Reviewed-by: Friedemann Kleint --- share/qtcreator/translations/qtcreator_de.ts | 57 +++++++------------- 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index 43ae2372c98..005d2e5dbe2 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -13790,25 +13790,25 @@ Soll es noch einmal versucht werden? Record Macro Makroaufnahme - - Ctrl+( - Ctrl+( - - - Alt+( - Alt+( - Stop Recording Macro Makroaufnahme anhalten - Ctrl+) - Ctrl+) + Ctrl+[ + Ctrl+[ - Alt+) - Alt+) + Alt+[ + Alt+[ + + + Ctrl+] + Ctrl+] + + + Alt+] + Alt+] Play Last Macro @@ -20476,20 +20476,6 @@ should a repository require SSH-authentication (see documentation on SSH and the Missing Android SDK packages Fehlende Android-SDK-Pakete - - Cannot create kits for all architectures. - Kits können nicht für alle Architekturen erstellt werden. - - - Qt versions are missing for the following architectures: -%1 - -To add the Qt version, select Options > Build & Run > Qt Versions. - Es fehlen Qt-Versionen für die folgenden Architekturen: -%1 - -Um die Qt-Versionen hinzuzufügen, benutzen Sie Einstellungen > Erstellung und Ausführung > Qt Versionen. - (SDK Version: %1, NDK Version: %2) (SDK-Version: %1, NDK-Version: %2) @@ -20498,15 +20484,8 @@ Um die Qt-Versionen hinzuzufügen, benutzen Sie Einstellungen > Erstellung un Android::Internal::AndroidToolChainFactory - Android GCC - Android GCC - - - - Android::Internal::AndroidToolChainConfigWidget - - NDK Root: - NDK Root: + Android Clang + Android Clang @@ -30364,8 +30343,8 @@ Der vom Kit mindestens benötigte API-Level ist %1. Android-Debugger für %1 - Android for %1 (GCC %2, %3) - Android für %1 (GCC %2, %3) + Android for %1 (Clang %2) + Android für %1 (Clang %2) @@ -46059,6 +46038,10 @@ Die Dateien aus dem Quellverzeichnis des Android-Pakets werden in das Verzeichni Unexpectedly finished. Restarting in %1 seconds. Unerwartet beendet. Neustart in %1 Sekunden. + + Unexpectedly finished. + Unerwartet beendet. + LanguageClient::BaseSettingsWidget From f4f95ad35f636c4f8365e2452e64a1446018c28c Mon Sep 17 00:00:00 2001 From: Leena Miettinen Date: Wed, 21 Nov 2018 09:52:41 +0100 Subject: [PATCH 12/47] Welcome: Fix titles of tutorials to match the actual titles These were modified to have related items appear next to each other, but the participants of a usability study found that confusing. Change-Id: I7cadce7e44236687ae32997f72be8d7f7278b4f3 Reviewed-by: Eike Ziller --- src/plugins/qtsupport/qtcreator_tutorials.xml | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/plugins/qtsupport/qtcreator_tutorials.xml b/src/plugins/qtsupport/qtcreator_tutorials.xml index 9725c952a96..5984aeeeceb 100644 --- a/src/plugins/qtsupport/qtcreator_tutorials.xml +++ b/src/plugins/qtsupport/qtcreator_tutorials.xml @@ -1,40 +1,40 @@ - + qt creator,build,compile,help - + qt creator,qt designer,widgets,c++,text,help - + qt,qt creator,qt designer,widgets,c++,help - + qt creator,qt quick designer,qt quick,qml,states,transitions,help - + qt creator,qt quick designer,qml,android,ios,controls,help - + qt quick,qml,c++,help - + qt creator,qt quick,automotive,safe renderer,controls,video - + qt creator,embedded,device creation,video - + qt creator,embedded,device creation,video @@ -50,23 +50,23 @@ qt creator,qt quick,video - + qt creator,SCXML,video - + qt creator,qt quick,c++,video - + qt creator,video - + qt creator,video - + qt creator,qt quick,video @@ -74,20 +74,20 @@ qt creator,qt quick,qml,video - + qt creator,qt quick,controls,video - + qt creator,talk,2015 - + qt creator,wizard,talk,2015 - + qt creator,configuration,talk,2013 @@ -95,48 +95,48 @@ qt creator,plugins,talk,2013 - + qt quick,qt creator,qml profiler,talk,2014 - + qt creator,cpu usage analyzer,perf,embedded,device creation,talk,2015 - + qt creator,scxml,talk,2016 - + qt creator,qbs,qemu,talk,2015 - + qt creator,android,talk,2016 - + qt creator,ios,talk,2016 - + qt creator,baremetal,talk,2013 - + uwp,talk,2016 - + ui,qt quick designer,controls,ui,talk,2016 - + qt quick,ui,widgets,talk,2016 - + qt creator,android,talk,2016 @@ -144,40 +144,40 @@ macos,talk,2016 - + qt,qt quick,screen resolution,ui,talk,2016 - + android,ios,talk,2017 - + medical,ui,talk,2017 - + android,ios,talk,2017 - + automotive,application manager,talk,2017 - + embedded,virtual keyboard,talk,2017 - + android,ios,qt quick,controls,talk,2017 - + automotive,ivi,talk,2017 - + talk,2017 From afe5699f8d71b3351b73cacabad7f9d7ab4be89c Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 22 Nov 2018 09:42:35 +0100 Subject: [PATCH 13/47] Debugger: Show module in stack frames also for LLDB Change-Id: I2b20b83bedf98a1b0eb17519fb4bec536e48dbaf Reviewed-by: Eike Ziller --- share/qtcreator/debugger/lldbbridge.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index a3b46a413e6..486c5a4ec92 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1083,6 +1083,7 @@ class Dumper(DumperBase): addr = frame.GetPCAddress().GetLoadAddress(self.target) functionName = frame.GetFunctionName() + module = frame.GetModule() if isNativeMixed and functionName == '::qt_qmlDebugMessageAvailable()': interpreterStack = self.extractInterpreterStack() @@ -1102,6 +1103,7 @@ class Dumper(DumperBase): result += ',address="0x%x"' % addr result += ',function="%s"' % functionName result += ',line="%d"' % lineNumber + result += ',module="%s"' % module result += ',file="%s"},' % fileName result += ']' result += ',hasmore="%d"' % isLimited From 30b522892c51f3d73cf4768e5ad86bce842d65b6 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 22 Nov 2018 13:04:47 +0100 Subject: [PATCH 14/47] UnitTests: Fix build Change-Id: I9527c97ef2a7360df7b347dc779989c6f6a9710b Reviewed-by: Nikolai Kosjar --- .../source/clangpchmanagerbackend-source.pri | 20 +++++++++---------- tests/unit/unittest/unittest.pro | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri index 6c45f38ff59..b81b6cd9b5b 100644 --- a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri +++ b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri @@ -1,12 +1,11 @@ INCLUDEPATH += $$PWD SOURCES += \ + $$PWD/builddependenciesprovider.cpp \ $$PWD/pchmanagerserver.cpp \ $$PWD/projectparts.cpp \ $$PWD/projectpartqueue.cpp \ - $$PWD/pchtaskgenerator.cpp \ - $$PWD/builddependenciesprovider.cpp \ - $$PWD/builddependencycollector.cpp + $$PWD/pchtaskgenerator.cpp HEADERS += \ $$PWD/pchmanagerserver.h \ @@ -34,16 +33,13 @@ HEADERS += \ $$PWD/modifiedtimecheckerinterface.h \ $$PWD/sourceentry.h \ $$PWD/builddependenciesstorage.h \ - $$PWD/builddependencycollector.h \ - $$PWD/builddependencygeneratorinterface.h \ - $$PWD/collectbuilddependencytoolaction.h \ - $$PWD/collectbuilddependencyaction.h \ - $$PWD/collectbuilddependencypreprocessorcallbacks.h + $$PWD/builddependencygeneratorinterface.h !isEmpty(LIBTOOLING_LIBS) { SOURCES += \ $$PWD/usedmacrosandsourcescollector.cpp \ - $$PWD/pchcreator.cpp + $$PWD/pchcreator.cpp \ + $$PWD/builddependencycollector.cpp HEADERS += \ $$PWD/collectusedmacroactionfactory.h \ @@ -51,5 +47,9 @@ HEADERS += \ $$PWD/collectusedmacrosandsourcespreprocessorcallbacks.h \ $$PWD/pchcreator.h \ $$PWD/processormanager.h \ - $$PWD/usedmacrosandsourcescollector.h + $$PWD/usedmacrosandsourcescollector.h \ + $$PWD/builddependencycollector.h \ + $$PWD/collectbuilddependencytoolaction.h \ + $$PWD/collectbuilddependencyaction.h \ + $$PWD/collectbuilddependencypreprocessorcallbacks.h } diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro index 3c17ef126ad..545599ed603 100644 --- a/tests/unit/unittest/unittest.pro +++ b/tests/unit/unittest/unittest.pro @@ -106,8 +106,7 @@ SOURCES += \ pchtaskgenerator-test.cpp \ compilationdatabaseutils-test.cpp \ builddependenciesprovider-test.cpp \ - builddependenciesstorage-test.cpp \ - builddependencycollector-test.cpp + builddependenciesstorage-test.cpp !isEmpty(LIBCLANG_LIBS) { SOURCES += \ @@ -184,7 +183,8 @@ SOURCES += \ symbolscollector-test.cpp \ symbolfinder-test.cpp \ testclangtool.cpp \ - usedmacrocollector-test.cpp + usedmacrocollector-test.cpp \ + builddependencycollector-test.cpp } exists($$GOOGLEBENCHMARK_DIR) { From bd493f963dc5b7f7b56336793ff08fa58c8e2200 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 22 Nov 2018 10:12:21 +0100 Subject: [PATCH 15/47] Fix blank items in Issues pane Even if source items are removed that are currently not visible, the rest of the source mapping indices must be adapted. Fixes: QTCREATORBUG-20542 Change-Id: Ib351286e6e7c35cdbdc96a3c38b346e8ed8f456c Reviewed-by: Tobias Hunger Reviewed-by: Orgad Shaneh --- src/plugins/projectexplorer/taskmodel.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/projectexplorer/taskmodel.cpp b/src/plugins/projectexplorer/taskmodel.cpp index a7ac388487b..dcdf1554c81 100644 --- a/src/plugins/projectexplorer/taskmodel.cpp +++ b/src/plugins/projectexplorer/taskmodel.cpp @@ -437,12 +437,12 @@ void TaskFilterModel::handleRowsAboutToBeRemoved(const QModelIndex &index, int f QTC_ASSERT(!index.isValid(), return); const QPair range = findFilteredRange(first, last, m_mapping); - if (range.first > range.second) // rows to be removed are filtered out - return; - - beginRemoveRows(QModelIndex(), range.first, range.second); - m_beginRemoveRowsSent = true; - m_mapping.erase(m_mapping.begin() + range.first, m_mapping.begin() + range.second + 1); + if (range.first <= range.second) { // remove corresponding rows in filtermodel + beginRemoveRows(QModelIndex(), range.first, range.second); + m_beginRemoveRowsSent = true; + m_mapping.erase(m_mapping.begin() + range.first, m_mapping.begin() + range.second + 1); + } + // adapt existing mapping to removed source indices const int sourceRemovedCount = (last - first) + 1; for (int i = range.first; i < m_mapping.count(); ++i) m_mapping[i] = m_mapping.at(i) - sourceRemovedCount; From 25a135ef95f95a0013efe2bdacd19b162d0252ef Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 22 Nov 2018 14:42:08 +0100 Subject: [PATCH 16/47] Revert "Fix issue with snippet variables not behaving correctly on Gnome" This reverts commit e693c9a02e3e698c2cd9cd79da0439b7e34aafb7. The workaround filters out the last input mehtod event when deleting characters with backspace leading to unwanted side effects. Also we were not able to reproduce the original issue with the latest Qt neither on Debian nor Ubuntu with GNOME. Fixes: QTCREATORBUG-21483 Change-Id: I986d48216b5f62b0f67fc62f94f8e876bbea23d2 Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditor.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 9f8fed1122f..f4d141af6a4 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -3020,14 +3020,6 @@ void TextEditorWidget::contextMenuEvent(QContextMenuEvent *e) void TextEditorWidget::inputMethodEvent(QInputMethodEvent *e) { - if (e->commitString().isEmpty() && e->preeditString().isEmpty() && e->attributes().isEmpty()) { - // Avoid doing anything when getting bogus events as it can happen on Gnome desktop. - // Otherwise QPlainTextEdit will report content changes for locations where factually - // nothing changed. - // Workaround for QTCREATORBUG-19571 - e->accept(); - return; - } if (d->m_inBlockSelectionMode) { if (!e->commitString().isEmpty()) d->insertIntoBlockSelection(e->commitString()); From 7c17edcce24535d39eccb06624dca4d4c576866d Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 20 Nov 2018 19:49:40 +0200 Subject: [PATCH 17/47] Clang: Strip some more warnings Appear in pchtaskgenerator-test.cpp and builddependenciesprovider-test.cpp. Change-Id: I4f9f2660655e0dfc1002980ae31bc09288110b2d Reviewed-by: Marco Bubke --- qbs/modules/libclang/functions.js | 3 +++ src/shared/clang/clang_installation.pri | 3 +++ 2 files changed, 6 insertions(+) diff --git a/qbs/modules/libclang/functions.js b/qbs/modules/libclang/functions.js index 99577c3146b..4d384d773e4 100644 --- a/qbs/modules/libclang/functions.js +++ b/qbs/modules/libclang/functions.js @@ -167,6 +167,9 @@ function toolingParameters(llvmConfig) "-Wcovered-switch-default", "-Wnon-virtual-dtor", "-Woverloaded-virtual", + "-Wmissing-field-initializers", + "-Wno-unknown-warning", + "-Wno-unused-command-line-argument", "-fPIC", "-pedantic", "-Wstring-conversion", diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri index 3f4b4fde7c4..d4307d40994 100644 --- a/src/shared/clang/clang_installation.pri +++ b/src/shared/clang/clang_installation.pri @@ -230,6 +230,9 @@ isEmpty(LLVM_VERSION) { LLVM_CXXFLAGS ~= s,-Wcovered-switch-default, LLVM_CXXFLAGS ~= s,-Wnon-virtual-dtor, LLVM_CXXFLAGS ~= s,-Woverloaded-virtual, + LLVM_CXXFLAGS ~= s,-Wmissing-field-initializers, + LLVM_CXXFLAGS ~= s,-Wno-unknown-warning, + LLVM_CXXFLAGS ~= s,-Wno-unused-command-line-argument, LLVM_CXXFLAGS ~= s,-fPIC, LLVM_CXXFLAGS ~= s,-pedantic, LLVM_CXXFLAGS ~= s,-Wstring-conversion, From 9ee5cab4ae3823b2c1d8273e516f28f4888f8eef Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 22 Nov 2018 14:17:11 +0100 Subject: [PATCH 18/47] Android: Add Android 9/API level 28 Change-Id: I80b294a20bbfa19f9b83e080caa6e647062f7458 Reviewed-by: Eike Ziller Reviewed-by: BogDan Vatra --- src/plugins/android/androidmanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 2ce812d6753..336a1befd29 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -362,7 +362,7 @@ void AndroidManager::setDeviceApiLevel(ProjectExplorer::Target *target, int leve QPair AndroidManager::apiLevelRange() { - return qMakePair(16, 27); + return qMakePair(16, 28); } QString AndroidManager::androidNameForApiLevel(int x) @@ -416,6 +416,8 @@ QString AndroidManager::androidNameForApiLevel(int x) return QLatin1String("Android 8.0"); case 27: return QLatin1String("Android 8.1"); + case 28: + return QLatin1String("Android 9"); default: return tr("Unknown Android version. API Level: %1").arg(QString::number(x)); } From 49f8f050df137f16ab447e68d95311a0370fd510 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 23 Nov 2018 10:02:29 +0100 Subject: [PATCH 19/47] TextEditor: Fix possible crash Change-Id: I37074051f5fb498c3c074026b8ec7b65c1df3da2 Reviewed-by: David Schulz --- src/plugins/texteditor/basehoverhandler.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index 3b5edef2ee4..1be518a5cad 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -76,10 +76,14 @@ void BaseHoverHandler::contextHelpId(TextEditorWidget *widget, { // If the tooltip is visible and there is a help match, this match is used to update // the help id. Otherwise, let the identification process happen. - if (!Utils::ToolTip::isVisible() || !lastHelpItemIdentified().isValid()) - process(widget, pos, [this, widget, callback](int) { propagateHelpId(widget, callback); }); - else + if (!Utils::ToolTip::isVisible() || !lastHelpItemIdentified().isValid()) { + process(widget, pos, [this, widget = QPointer(widget), callback](int) { + if (widget) + propagateHelpId(widget, callback); + }); + } else { propagateHelpId(widget, callback); + } } void BaseHoverHandler::setToolTip(const QString &tooltip) From 323136f40321363b7cc1a4cb6d86091145a88b5e Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 23 Nov 2018 10:25:25 +0100 Subject: [PATCH 20/47] QmlDesigner: Skip failing test Change-Id: Ie23bef2faa45cd6ac2b96b49bfc02ce6d55d6639 Reviewed-by: Thomas Hartmann --- tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp index 9b5762f3da9..4334e90aa64 100644 --- a/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp +++ b/tests/auto/qml/qmldesigner/coretests/tst_testcore.cpp @@ -8228,6 +8228,8 @@ static void checkNode(QmlJS::SimpleReaderNode::Ptr node, TestRewriterView *view) void tst_TestCore::writeAnnotations() { + QSKIP("We have to improve handling of emtpy lines.", SkipAll); + const QLatin1String qmlCode("\n" "import QtQuick 2.1\n" "\n" From b61d11a446ff50b604f3f0a6e458e04a0b774897 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 19 Nov 2018 11:08:44 +0100 Subject: [PATCH 21/47] QmlJsTools: add mimetype for JavaScript modules Fixes: QTCREATORBUG-21517 Change-Id: I18b2b309279f40c3dd4cdee2e7cf27c25fa4984a Reviewed-by: Eike Ziller --- src/plugins/qmljstools/QmlJSTools.json.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/qmljstools/QmlJSTools.json.in b/src/plugins/qmljstools/QmlJSTools.json.in index 0a1d9945806..0902c0ec9ef 100644 --- a/src/plugins/qmljstools/QmlJSTools.json.in +++ b/src/plugins/qmljstools/QmlJSTools.json.in @@ -57,6 +57,11 @@ \" JSON file\", \" \", \" \", + \" \", + \" \", + \" Javascript module\", + \" \", + \" \", \"\" ] } From a4cf0ad109aa6d7a60cbcce2f4090bdc07d2f68d Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 23 Nov 2018 11:28:10 +0100 Subject: [PATCH 22/47] Clang: Disable printing stack traces by default Printing the stack strace in the event of a crash is very useful, but in the worst case it can also result in a deadlock, without any trace being printed, rendering the clangbackend completely useless. For example, if a thread allocates memory (lock) and another thread crashes right then, clang's stack trace printer is invoked, which (unfortunately) also tries to allocate memory (deadlock). This was observed with QTCREATORBUG-21559. The stack trace printer should be fixed in clang. Until then, disable printing stack traces by default and allow to enable when explicitly requested (QTC_CLANG_ENABLE_STACKTRACES=1). Task-number: QTCREATORBUG-21559 Change-Id: I418cea7f3d70bc8a9cae333b3858228650307c6e Reviewed-by: Christian Stenger Reviewed-by: Marco Bubke Reviewed-by: Ivan Donchevskii --- src/tools/clangbackend/clangbackendmain.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/clangbackend/clangbackendmain.cpp b/src/tools/clangbackend/clangbackendmain.cpp index d165ebb6dd3..efe5970a4d8 100644 --- a/src/tools/clangbackend/clangbackendmain.cpp +++ b/src/tools/clangbackend/clangbackendmain.cpp @@ -80,7 +80,9 @@ int main(int argc, char *argv[]) const QString connection = processArguments(application); - clang_enableStackTraces(); + // Printing the stack strace might dead lock as clang's stack printer allocates memory. + if (qEnvironmentVariableIntValue("QTC_CLANG_ENABLE_STACKTRACES")) + clang_enableStackTraces(); ClangCodeModelServer clangCodeModelServer; ConnectionServer connectionServer; From ca33c0b8c1b74d9414f38775ecdc7efd575229db Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 26 Nov 2018 11:08:23 +0100 Subject: [PATCH 23/47] Bump version to 4.8.0 Change-Id: I593dc1905bd4e2240449fb9f393c2c14b73488f1 Reviewed-by: Eike Ziller --- qbs/modules/qtc/qtc.qbs | 10 +++++----- qtcreator.pri | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 0d13dc3f913..9bfcc77a98f 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -4,16 +4,16 @@ import qbs.FileInfo import "qtc.js" as HelperFunctions Module { - property string qtcreator_display_version: '4.8.0-rc1' + property string qtcreator_display_version: '4.8.0' property string ide_version_major: '4' - property string ide_version_minor: '7' - property string ide_version_release: '84' + property string ide_version_minor: '8' + property string ide_version_release: '0' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release property string ide_compat_version_major: '4' - property string ide_compat_version_minor: '7' - property string ide_compat_version_release: '84' + property string ide_compat_version_minor: '8' + property string ide_compat_version_release: '0' property string qtcreator_compat_version: ide_compat_version_major + '.' + ide_compat_version_minor + '.' + ide_compat_version_release diff --git a/qtcreator.pri b/qtcreator.pri index 5af18c1b93d..d65ede07de7 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -1,10 +1,10 @@ !isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included") QTCREATOR_PRI_INCLUDED = 1 -QTCREATOR_VERSION = 4.7.84 -QTCREATOR_COMPAT_VERSION = 4.7.84 +QTCREATOR_VERSION = 4.8.0 +QTCREATOR_COMPAT_VERSION = 4.8.0 VERSION = $$QTCREATOR_VERSION -QTCREATOR_DISPLAY_VERSION = 4.8.0-rc1 +QTCREATOR_DISPLAY_VERSION = 4.8.0 QTCREATOR_COPYRIGHT_YEAR = 2018 BINARY_ARTIFACTS_BRANCH = 4.8 From 6a74a24f8c386b214ecd66b18ab238332323a483 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 26 Nov 2018 13:57:13 +0100 Subject: [PATCH 24/47] Clang: Fix tidy demo file Revert unintended addition. Change-Id: I8ee78ee6e59f7fdc29d62df3e720c5c2dd706ada Reviewed-by: Ivan Donchevskii --- share/qtcreator/cplusplus/examples/tidy_example.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/share/qtcreator/cplusplus/examples/tidy_example.cpp b/share/qtcreator/cplusplus/examples/tidy_example.cpp index 2b41a1e83b0..dc921114ea1 100644 --- a/share/qtcreator/cplusplus/examples/tidy_example.cpp +++ b/share/qtcreator/cplusplus/examples/tidy_example.cpp @@ -203,8 +203,6 @@ public: virtual bool check(bool enable = true); }; -bool Derived2:: - // performance-unnecessary-value-param void use(Base b) { From f5fb9932a2114d1e7e8e74186923368032d063b9 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 26 Nov 2018 14:50:34 +0100 Subject: [PATCH 25/47] Utils: Fix column number for Highlighting result Follow up for 8469e317c9. This column number compensation is not required anymore. Fixes: QTCREATORBUG-21384 Change-Id: I94da48533520471170200c592129781e5b4b614c Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/builtineditordocumentprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp index d5bfa510203..daf7ebf762f 100644 --- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp +++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp @@ -136,7 +136,7 @@ CppTools::CheckSymbols *createHighlighter(const CPlusPlus::Document::Ptr &doc, int line, column; convertPosition(textDocument, macro.utf16charsBegin(), &line, &column); - ++column; //Highlighting starts at (column-1) --> compensate here + Result use(line, column, name.size(), SemanticHighlighter::MacroUse); macroUses.append(use); } From bc6c65396fa2a61d15c16f7c09ab223bc4582dff Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 26 Nov 2018 09:47:14 +0100 Subject: [PATCH 26/47] Clang: Fix providing snippets for another case We have to indicate snippet addition for the PassThroughToLibClang case. This completes commit d946ff540312210f1da8cc509c474a39da45117c Clang: Fix adding completion snippets after { Change-Id: Ib543c415d4fdcc99d8bbf4815930f3d8481bc810 Reviewed-by: Ivan Donchevskii Reviewed-by: Marco Bubke --- .../clangcodemodel/clangcompletioncontextanalyzer.cpp | 1 + .../unit/unittest/clangcompletioncontextanalyzer-test.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/plugins/clangcodemodel/clangcompletioncontextanalyzer.cpp b/src/plugins/clangcodemodel/clangcompletioncontextanalyzer.cpp index 194d944cf5f..ad48a60685b 100644 --- a/src/plugins/clangcodemodel/clangcompletioncontextanalyzer.cpp +++ b/src/plugins/clangcodemodel/clangcompletioncontextanalyzer.cpp @@ -157,6 +157,7 @@ void ClangCompletionContextAnalyzer::handleFunctionCall(int afterOperatorPositio setActionAndClangPosition(CompleteSlot, afterOperatorPosition); } else if (m_interface->position() != afterOperatorPosition) { // No function completion if cursor is not after '(' or ',' + m_addSnippets = true; m_positionForProposal = afterOperatorPosition; setActionAndClangPosition(PassThroughToLibClang, afterOperatorPosition); } else { diff --git a/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp b/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp index 4850c0f9b5e..fb49a4c640b 100644 --- a/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp +++ b/tests/unit/unittest/clangcompletioncontextanalyzer-test.cpp @@ -312,6 +312,14 @@ TEST_F(ClangCompletionContextAnalyzer, AfterOpeningParenthesis) ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, 0, 0, positionInText, true)); } +TEST_F(ClangCompletionContextAnalyzer, AfterOpeningBraceAndIdentifierOnNewLine) +{ + auto analyzer = runAnalyzer("if (1) {\n" + "cla@"); + + ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, -3, -3, positionInText, true)); +} + TEST_F(ClangCompletionContextAnalyzer, ArgumentOneAtSignal) { auto analyzer = runAnalyzer("SIGNAL(@"); From f56ec051b0afcd5534f845db869c7502c03e01be Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 22 Nov 2018 15:39:37 +0100 Subject: [PATCH 27/47] Clang: Fix TokenProcessor.Qt* tests With the upgrade to clang 7 these started to fail on Linux. Something changed in clang regarding the processing of our wrappedQtHeaders/QtCore/qobjectdefs.h. Since we can't rely on the include paths of Qt in the tests anyway, inline the relevant preprocessor directives into the test file to make the tests independent of that. Change-Id: Iba5cdc5483c3007346346d294374598a75fcb5a1 Reviewed-by: Ivan Donchevskii --- tests/unit/unittest/data/highlightingmarks.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/unittest/data/highlightingmarks.cpp b/tests/unit/unittest/data/highlightingmarks.cpp index a5b6e85872f..7748ff17a07 100644 --- a/tests/unit/unittest/data/highlightingmarks.cpp +++ b/tests/unit/unittest/data/highlightingmarks.cpp @@ -592,9 +592,9 @@ class WithVirtualFunctionDefined { namespace NFoo { namespace NBar { namespace NTest { class NamespaceTypeSpelling; } } } Undeclared u; - -#include "../../../../share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h" - +#define Q_PROPERTY(arg) static_assert("Q_PROPERTY", #arg); // Keep these in sync with wrappedQtHeaders/QtCore/qobjectdefs.h +#define SIGNAL(arg) #arg +#define SLOT(arg) #arg class Property { Q_PROPERTY(const volatile unsigned long long * prop READ getProp WRITE setProp NOTIFY propChanged) Q_PROPERTY(const QString str READ getStr) From 39178cad8c3f3a6c7f48498c256ed0f7602e8a12 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 22 Nov 2018 16:02:31 +0100 Subject: [PATCH 28/47] Clang: Remove QTC_ASSERT triggered by test The code path is intentionally triggered with the test UnsavedFile.LineRangeForInvalidLines. Change-Id: I2a0acc618bfd4371c877424edcfbebd4ebb565a4 Reviewed-by: Ivan Donchevskii --- src/tools/clangbackend/source/unsavedfile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/clangbackend/source/unsavedfile.cpp b/src/tools/clangbackend/source/unsavedfile.cpp index efcad4cad47..25925ea3089 100644 --- a/src/tools/clangbackend/source/unsavedfile.cpp +++ b/src/tools/clangbackend/source/unsavedfile.cpp @@ -83,7 +83,8 @@ bool UnsavedFile::hasCharacterAt(uint line, uint column, char character) const Utf8String UnsavedFile::lineRange(uint fromLine, uint toLine) const { - QTC_ASSERT(fromLine <= toLine, return Utf8String()); + if (fromLine > toLine) + return Utf8String(); // Find start of first line bool ok = false; From dd5c6c73d071531b0d2f2c36bbf9537a9bc9163d Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 26 Nov 2018 12:22:57 +0100 Subject: [PATCH 29/47] ToolChain: QTC_CHECK() conversion of __cplusplus macro Change-Id: I80a6cc4ea9a7dcb10614638f534259e02ed4c10e Reviewed-by: Ivan Donchevskii --- src/plugins/projectexplorer/toolchain.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index a3f875726ec..90e9ec147fc 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -289,7 +289,12 @@ bool ToolChain::fromMap(const QVariantMap &data) static long toLanguageVersionAsLong(QByteArray dateAsByteArray) { dateAsByteArray.chop(1); // Strip 'L'. - return dateAsByteArray.toLong(nullptr); + + bool success = false; + const int result = dateAsByteArray.toLong(&success); + QTC_CHECK(success); + + return result; } LanguageVersion ToolChain::cxxLanguageVersion(const QByteArray &cplusplusMacroValue) From 217636886ced0b83a8fd5467242a742a91998457 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 26 Nov 2018 10:57:23 +0100 Subject: [PATCH 30/47] Tests: Fix QmlJs auto tests Change-Id: Iba5e5e786e8241db120359f95850207021d61c49 Reviewed-by: Marco Benelli --- .../qml/qmlprojectmanager/fileformat/tst_fileformat.cpp | 5 +++-- tests/auto/qml/reformatter/tst_reformatter.cpp | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp index 8c60c1c498d..bca2e8d7a88 100644 --- a/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp +++ b/tests/auto/qml/qmlprojectmanager/fileformat/tst_fileformat.cpp @@ -223,8 +223,9 @@ void tst_FileFormat::testLibraryPaths() project->setSourceDirectory(testDataDir); - QStringList expectedPaths(QStringList() << SRCDIR "/otherLibrary" - << SRCDIR "/data/library"); + const QDir base(testDataDir); + const QStringList expectedPaths({base.relativeFilePath(SRCDIR "/otherLibrary"), + base.relativeFilePath(SRCDIR "/data/library")}); qDebug() << expectedPaths << project->importPaths(); QCOMPARE(project->importPaths().toSet(), expectedPaths.toSet()); delete project; diff --git a/tests/auto/qml/reformatter/tst_reformatter.cpp b/tests/auto/qml/reformatter/tst_reformatter.cpp index f3164f440e3..64506195c4a 100644 --- a/tests/auto/qml/reformatter/tst_reformatter.cpp +++ b/tests/auto/qml/reformatter/tst_reformatter.cpp @@ -93,10 +93,18 @@ void tst_Reformatter::test() // compare line by line int commonLines = qMin(newLines.size(), sourceLines.size()); + bool insideMultiLineComment = false; for (int i = 0; i < commonLines; ++i) { // names intentional to make 'Actual (sourceLine): ...\nExpected (newLinee): ...' line up const QString &sourceLine = sourceLines.at(i); const QString &newLinee = newLines.at(i); + if (!insideMultiLineComment && sourceLine.trimmed().startsWith("/*")) { + insideMultiLineComment = true; + sourceLines.insert(i, "\n"); + continue; + } + if (sourceLine.trimmed().endsWith("*/")) + insideMultiLineComment = false; if (sourceLine.trimmed().isEmpty() && newLinee.trimmed().isEmpty()) continue; bool fail = !QCOMPARE_NOEXIT(newLinee, sourceLine); From a84a8518145b1dd3b027527cb225003b32622cd9 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 23 Nov 2018 14:11:28 +0100 Subject: [PATCH 31/47] Docs: Add notes regarding Android command line tools Change-Id: I14ac223570897a41c031f70bb35813b845872138 Reviewed-by: Leena Miettinen --- doc/src/android/androiddev.qdoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/src/android/androiddev.qdoc b/doc/src/android/androiddev.qdoc index e7fd3901be4..ac2a77a3fe6 100644 --- a/doc/src/android/androiddev.qdoc +++ b/doc/src/android/androiddev.qdoc @@ -103,7 +103,15 @@ \endlist - \endlist + \note When using the command line tools instead of Android Studio, + it is recommended to create an empty folder and extract the + downloaded archive into this folder. + The sdkmanager will install downloaded packages next to the + \c tools folder that contains all command line tools. + You must specify the path to the folder where you extracted the + files as Android SDK location inside the Android settings. + + \endlist \section1 Setting Up the Development Environment From 15df73a8ba287a995353a6eb8526bfdbf46561bf Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 22 Nov 2018 14:37:51 +0100 Subject: [PATCH 32/47] Clang: Fix output arguments highlighting for constructor parameters The are not any more shown but they are still not shown for constructor arguments because libClang is providing the wrong argument count. Task-number: QTCREATORBUG-21543 Change-Id: If9b6140ed4b2dedf71bd94aae0a97669cdd04e67 Reviewed-by: Ivan Donchevskii --- src/tools/clangbackend/source/tokeninfo.cpp | 3 --- tests/unit/unittest/data/highlightingmarks.cpp | 12 ++++++++++++ tests/unit/unittest/tokenprocessor-test.cpp | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/tools/clangbackend/source/tokeninfo.cpp b/src/tools/clangbackend/source/tokeninfo.cpp index dcd631eff82..b7e40d0327b 100644 --- a/src/tools/clangbackend/source/tokeninfo.cpp +++ b/src/tools/clangbackend/source/tokeninfo.cpp @@ -548,9 +548,6 @@ void TokenInfo::punctuationOrOperatorKind() // case CXCursor_CXXDeleteExpr: overloadedOperatorKind(); break; - case CXCursor_Constructor: - collectOutputArguments(m_originalCursor); - break; case CXCursor_UnaryOperator: case CXCursor_BinaryOperator: case CXCursor_CompoundAssignOperator: diff --git a/tests/unit/unittest/data/highlightingmarks.cpp b/tests/unit/unittest/data/highlightingmarks.cpp index 7748ff17a07..e1a48903ca3 100644 --- a/tests/unit/unittest/data/highlightingmarks.cpp +++ b/tests/unit/unittest/data/highlightingmarks.cpp @@ -674,3 +674,15 @@ int signalSlotTest() { SIGNAL(something(QString (*func1)(QString))); 1 == 2; } + +class NonConstParameterConstructor +{ + NonConstParameterConstructor() = default; + NonConstParameterConstructor(NonConstParameterConstructor &buildDependenciesStorage); + + void Call() + { + NonConstParameterConstructor foo; + NonConstParameterConstructor bar(foo); + } +}; diff --git a/tests/unit/unittest/tokenprocessor-test.cpp b/tests/unit/unittest/tokenprocessor-test.cpp index 2935a853814..f48d546cb10 100644 --- a/tests/unit/unittest/tokenprocessor-test.cpp +++ b/tests/unit/unittest/tokenprocessor-test.cpp @@ -1679,6 +1679,24 @@ TEST_F(TokenProcessor, QtOldStyleSignalFunctionPointerType) ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::Type)); } +TEST_F(TokenProcessor, NonConstParameterConstructor) +{ + const auto infos = translationUnit.tokenInfosInRange(sourceRange(681, 90)); + + infos[1]; + + ASSERT_THAT(infos[4], Not(HasMixin(HighlightingType::OutputArgument))); +} + +TEST_F(TokenProcessor, DISABLED_NonConstArgumentConstructor) +{ + const auto infos = translationUnit.tokenInfosInRange(sourceRange(686, 47)); + + infos[2]; + + ASSERT_THAT(infos[3], HasMixin(HighlightingType::OutputArgument)); +} + Data *TokenProcessor::d; void TokenProcessor::SetUpTestCase() From 8e31cfff91003525685f22a64d7dece85dfc5a2b Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 26 Nov 2018 15:58:39 +0100 Subject: [PATCH 33/47] ClangFormat: Don't export symbols of libraries Task-number: QTCREATORBUG-21571 Change-Id: I2f6dcadf08b935bec074b6c04e96a31d766b1889 Reviewed-by: Ivan Donchevskii Reviewed-by: Eike Ziller Reviewed-by: Nikolai Kosjar --- src/plugins/clangformat/clangformat.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/clangformat/clangformat.pro b/src/plugins/clangformat/clangformat.pro index 70eefe17f46..eda95884fd1 100644 --- a/src/plugins/clangformat/clangformat.pro +++ b/src/plugins/clangformat/clangformat.pro @@ -14,6 +14,7 @@ LIBS += $$CLANGFORMAT_LIBS INCLUDEPATH += $$LLVM_INCLUDEPATH QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS +unix:!macos:QMAKE_LFLAGS += -Wl,--exclude-libs,ALL SOURCES = \ clangformatconfigwidget.cpp \ From 386535cf181814c8f1a7d76cd69b081a32b1de26 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 26 Nov 2018 10:50:07 +0100 Subject: [PATCH 34/47] ClangFormat: Fix iteration through text blocks Document might be edited between consecutive currentBlock.next() calls which is unsafe. Let's instead operate with block numbers. Fixes: QTCREATORBUG-21521 Change-Id: I6863a77a32f5583269e1c796f38afb45cc9e7f77 Reviewed-by: Nikolai Kosjar --- .../clangformat/clangformatindenter.cpp | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/plugins/clangformat/clangformatindenter.cpp b/src/plugins/clangformat/clangformatindenter.cpp index 718d4526353..7f055d3d7e5 100644 --- a/src/plugins/clangformat/clangformatindenter.cpp +++ b/src/plugins/clangformat/clangformatindenter.cpp @@ -69,6 +69,13 @@ void adjustFormatStyleForLineBreak(format::FormatStyle &style) style.SortUsingDeclarations = false; } +StringRef clearExtraNewline(StringRef text) +{ + while (text.startswith("\n\n")) + text = text.drop_front(); + return text; +} + Replacements filteredReplacements(const Replacements &replacements, int offset, int extraOffsetToAdd, @@ -83,10 +90,13 @@ Replacements filteredReplacements(const Replacements &replacements, if (replacementOffset + 1 >= offset) replacementOffset += extraOffsetToAdd; + StringRef text = onlyIndention ? clearExtraNewline(replacement.getReplacementText()) + : replacement.getReplacementText(); + Error error = filtered.add(Replacement(replacement.getFilePath(), static_cast(replacementOffset), replacement.getLength(), - replacement.getReplacementText())); + text)); // Throws if error is not checked. if (error) break; @@ -335,10 +345,19 @@ void ClangFormatIndenter::indent(QTextDocument *doc, bool /*autoTriggered*/) { if (cursor.hasSelection()) { - QTextBlock currentBlock = doc->findBlock(cursor.selectionStart()); - while (currentBlock.isValid() && currentBlock.position() < cursor.selectionEnd()) { - indentBlock(doc, currentBlock, typedChar, tabSettings); - currentBlock = currentBlock.next(); + // Calling currentBlock.next() might be unsafe because we change the document. + // Let's operate with block numbers instead. + const int startNumber = doc->findBlock(cursor.selectionStart()).blockNumber(); + const int endNumber = doc->findBlock(cursor.selectionEnd()).blockNumber(); + for (int currentBlockNumber = startNumber; currentBlockNumber <= endNumber; + ++currentBlockNumber) { + const QTextBlock currentBlock = doc->findBlockByNumber(currentBlockNumber); + if (currentBlock.isValid()) { + const int blocksAmount = doc->blockCount(); + indentBlock(doc, currentBlock, typedChar, tabSettings); + QTC_CHECK(blocksAmount == doc->blockCount() + && "ClangFormat plugin indentation changed the amount of blocks."); + } } } else { indentBlock(doc, cursor.block(), typedChar, tabSettings); From f1634df8b303fb2b107913c0deb16e1c5d42c111 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 26 Nov 2018 12:44:44 +0100 Subject: [PATCH 35/47] ClangFormat: Trim space-only lines to properly indent them Do not add indentation to the existing spaces in the line but trim the line first and then indent it as an empty line. Change-Id: I0e95ab5e4550410e55abfb12362035751c47b0b3 Reviewed-by: Nikolai Kosjar Reviewed-by: Marco Bubke --- src/plugins/clangformat/clangformatindenter.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/plugins/clangformat/clangformatindenter.cpp b/src/plugins/clangformat/clangformatindenter.cpp index 7f055d3d7e5..18a79889c10 100644 --- a/src/plugins/clangformat/clangformatindenter.cpp +++ b/src/plugins/clangformat/clangformatindenter.cpp @@ -133,6 +133,18 @@ void trimFirstNonEmptyBlock(const QTextBlock ¤tBlock) cursor.endEditBlock(); } +void trimCurrentBlock(const QTextBlock ¤tBlock) +{ + if (currentBlock.text().trimmed().isEmpty()) { + // Clear the block containing only spaces + QTextCursor cursor(currentBlock); + cursor.beginEditBlock(); + cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); + cursor.removeSelectedText(); + cursor.endEditBlock(); + } +} + // Returns the total langth of previous lines with pure whitespace. int previousEmptyLinesLength(const QTextBlock ¤tBlock) { @@ -418,6 +430,7 @@ void ClangFormatIndenter::indentBlock(QTextDocument *doc, const Utils::FileName fileName = editor->textDocument()->filePath(); trimFirstNonEmptyBlock(block); + trimCurrentBlock(block); const QByteArray buffer = doc->toPlainText().toUtf8(); const int utf8Offset = Utils::Text::utf8NthLineOffset(doc, buffer, block.blockNumber() + 1); QTC_ASSERT(utf8Offset >= 0, return;); @@ -436,6 +449,7 @@ int ClangFormatIndenter::indentFor(const QTextBlock &block, const TextEditor::Ta const Utils::FileName fileName = editor->textDocument()->filePath(); trimFirstNonEmptyBlock(block); + trimCurrentBlock(block); const QTextDocument *doc = block.document(); const QByteArray buffer = doc->toPlainText().toUtf8(); const int utf8Offset = Utils::Text::utf8NthLineOffset(doc, buffer, block.blockNumber() + 1); From e5c2b30e903eefe052c74cdcf91bda0cfb1874db Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Wed, 21 Nov 2018 13:00:44 +0100 Subject: [PATCH 36/47] ClangFormat: Enable BreakStringLiterals in .clang-format Change-Id: Icbd601c236cb5ad620d1bc7217a8629fe50a0046 Reviewed-by: Marco Bubke Reviewed-by: Nikolai Kosjar --- .clang-format | 2 +- tests/manual/clang-format-for-qtc/test.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.clang-format b/.clang-format index 25df05eb265..953e0b44cd6 100644 --- a/.clang-format +++ b/.clang-format @@ -53,7 +53,7 @@ BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeComma BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: false +BreakStringLiterals: true ColumnLimit: 100 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false diff --git a/tests/manual/clang-format-for-qtc/test.cpp b/tests/manual/clang-format-for-qtc/test.cpp index e5afaff1300..b3cf22eaca8 100644 --- a/tests/manual/clang-format-for-qtc/test.cpp +++ b/tests/manual/clang-format-for-qtc/test.cpp @@ -656,7 +656,11 @@ void extremeFunction( ++uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuunbelievableLongValue; extremeFunction( - "some super duper super duper super duper super duper super duper super duper super duper long"); + "some super duper super duper super duper super duper super duper super duper long"); + + // BreakStringLiterals splits the string. + extremeFunction("some super duper super duper super duper super duper super duper super duper " + "super duper long"); } void extremeFunction2(int parameter1, From 18c6048099286d2203f15a519c831163fb0669b6 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 22 Nov 2018 16:22:45 +0100 Subject: [PATCH 37/47] Debugger: Fix thread switching when using lldb on macOS The SetSelectedThreadByID method expects an integer, and not a string. Fixes: QTCREATORBUG-21563 Change-Id: Ibd5538a3214b73d7e87e66b59d6b9af0b93effeb Reviewed-by: hjk --- share/qtcreator/debugger/lldbbridge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 486c5a4ec92..6cccd84fba7 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -1654,7 +1654,7 @@ class Dumper(DumperBase): def selectThread(self, args): self.reportToken(args) - self.process.SetSelectedThreadByID(args['id']) + self.process.SetSelectedThreadByID(int(args['id'])) self.reportResult('', args) def fetchFullBacktrace(self, _ = None): From 9d8cd37e8c93eefd660ef335ae04f66595cbf009 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 23 Nov 2018 15:59:25 +0100 Subject: [PATCH 38/47] Debugger: Fix thread switcher combobox to show current thread When a breakpoint was hit, the combo box "popup" correctly showed which thread was interrupted (with the little left-arrow icon), but the actual combo box always showed the first thread. This change makes sure to update the combo box current index whenever a breakpoint is hit. Change-Id: I8339f4334df46830f5e8f82a2b4eafa9e6a388c4 Reviewed-by: Alexandru Croitor Reviewed-by: hjk --- src/plugins/debugger/threadshandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/debugger/threadshandler.cpp b/src/plugins/debugger/threadshandler.cpp index 54b87599e3c..a37d6fbe1d9 100644 --- a/src/plugins/debugger/threadshandler.cpp +++ b/src/plugins/debugger/threadshandler.cpp @@ -408,6 +408,11 @@ void ThreadsHandler::setThreads(const GdbMi &data) if (!m_currentThread && threads.childCount() > 0) m_currentThread = rootItem()->childAt(0); + + if (!m_currentThread) { + const QModelIndex currentThreadIndex = m_currentThread->index(); + threadSwitcher()->setCurrentIndex(currentThreadIndex.row()); + } } QAbstractItemModel *ThreadsHandler::model() From fdc20e7705df9b00f9e2270e84690f8b71b04186 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 23 Nov 2018 10:51:39 +0100 Subject: [PATCH 39/47] Utils: Pile more hacks onto our "QTipLabel" The moc files "#include " these days. You cannot do that from within a custom namespace or funny things will happen. Therefore, include it already before the namespace. Change-Id: I34f808cd22634c85878658ec921ca31649fb37c3 Reviewed-by: Orgad Shaneh Reviewed-by: hjk Reviewed-by: Eike Ziller --- src/libs/utils/tooltip/tips.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/utils/tooltip/tips.cpp b/src/libs/utils/tooltip/tips.cpp index b0aee273f4d..8287e9fedda 100644 --- a/src/libs/utils/tooltip/tips.cpp +++ b/src/libs/utils/tooltip/tips.cpp @@ -43,6 +43,8 @@ #include #include +#include + namespace Utils { namespace Internal { From ea0837377b488dd6ec0d219cfa3afc49903a95fe Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Tue, 27 Nov 2018 15:04:04 +0100 Subject: [PATCH 40/47] Clang: Disable columns resizability for Clang-Tidy and Clazy view The resize behavior is not intuitive, let's disable it. Fixes: QTCREATORBUG-20803 Change-Id: I4bc7b513637077a99c3cdd1f4976e8ffc62d0680 Reviewed-by: Nikolai Kosjar --- src/plugins/clangtools/clangtoolsdiagnosticview.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangtools/clangtoolsdiagnosticview.cpp b/src/plugins/clangtools/clangtoolsdiagnosticview.cpp index 6314697593f..9c0efbbdb26 100644 --- a/src/plugins/clangtools/clangtoolsdiagnosticview.cpp +++ b/src/plugins/clangtools/clangtoolsdiagnosticview.cpp @@ -177,8 +177,10 @@ void DiagnosticView::setModel(QAbstractItemModel *model) m_ignoreSetSelectedFixItsCount = false; }); setHeader(clickableFixItHeader); - header()->setStretchLastSection(false); - header()->setSectionResizeMode(0, QHeaderView::Stretch); + clickableFixItHeader->setStretchLastSection(false); + clickableFixItHeader->setSectionResizeMode(0, QHeaderView::Stretch); + clickableFixItHeader->setSectionResizeMode(1, QHeaderView::ResizeToContents); + clickableFixItHeader->setSectionResizeMode(2, QHeaderView::ResizeToContents); } } // namespace Internal From d47cb489096bddcc646cdf255cff949de3fe1ab0 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Tue, 6 Nov 2018 14:50:35 +0100 Subject: [PATCH 41/47] Clang: Do not call built-in follow symbol with no document CppEditor tests (the part which works with ClangCodeModel) showed that it's possible that QTextCursor might get document reset to the moment we try to call built-in follow symbol. That means that the editor widget is closed already. Check for the document to prevent such behavior. Change-Id: I2463f4688dc6fca7f701fba243ffc6e43a573b33 Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cppfollowsymbolundercursor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/cpptools/cppfollowsymbolundercursor.cpp b/src/plugins/cpptools/cppfollowsymbolundercursor.cpp index a66c357986b..9633bfb6dd0 100644 --- a/src/plugins/cpptools/cppfollowsymbolundercursor.cpp +++ b/src/plugins/cpptools/cppfollowsymbolundercursor.cpp @@ -491,10 +491,13 @@ void FollowSymbolUnderCursor::findLink( { Link link; - int line = 0; - int column = 0; QTextCursor cursor = data.cursor(); QTextDocument *document = cursor.document(); + if (!document) + return processLinkCallback(link); + + int line = 0; + int column = 0; Utils::Text::convertPosition(document, cursor.position(), &line, &column); const int positionInBlock = column - 1; From 03ee0e6acc6ae2bb5afba698ef333db3ea36af97 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 26 Nov 2018 16:10:20 +0100 Subject: [PATCH 42/47] Clang: Abort hover handlers on ~TextEditorWidget We have a QPointer in HoverHandlerRunner and a check in onHandlerFinished() to handle the editor-closed-case. However, the HoverHandlerRunner and thus the QPointer<> do not outlive the TextEditorWidget. Abort the handlers in ~HoverHandlerRunner instead. Task-number: QTCREATORBUG-21582 Change-Id: I03b78802ca75ddd4be9fea994e3dd9b152060e72 Reviewed-by: Orgad Shaneh Reviewed-by: David Schulz --- src/plugins/texteditor/texteditor.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index f4d141af6a4..47beba57068 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -299,6 +299,8 @@ public: { } + ~HoverHandlerRunner() { abortHandlers(); } + void startChecking(const QTextCursor &textCursor, const QPoint &point) { if (m_handlers.empty()) @@ -315,9 +317,7 @@ public: if (isCheckRunning(documentRevision, position)) return; - // Cancel currently running checks - for (BaseHoverHandler *handler : m_handlers) - handler->abort(); + abortHandlers(); // Update invocation data m_documentRevision = documentRevision; @@ -352,8 +352,6 @@ public: void onHandlerFinished(int documentRevision, int position, int priority) { - if (!m_widget) - return; QTC_ASSERT(m_currentHandlerIndex < m_handlers.size(), return); QTC_ASSERT(documentRevision == m_documentRevision, return); QTC_ASSERT(position == m_position, return); @@ -379,7 +377,13 @@ public: } private: - QPointer m_widget; + void abortHandlers() + { + for (BaseHoverHandler *handler : m_handlers) + handler->abort(); + } + + TextEditorWidget *m_widget; const QList &m_handlers; struct LastHandlerInfo { From 5f79b5d2e5e33321cdcd00362f0d6d9442a73ec2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 26 Nov 2018 16:27:17 +0100 Subject: [PATCH 43/47] Fix crash in qmake parsing The read from a QHash needs to be protected too if other threads are writing. Fixes: QTCREATORBUG-21416 Change-Id: I75e5634e11b10056d6dbb6fdceef482ca2222ca1 Reviewed-by: Allan Sandfeld Jensen --- src/shared/proparser/qmakevfs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/proparser/qmakevfs.cpp b/src/shared/proparser/qmakevfs.cpp index f438978badc..4b0cb7df037 100644 --- a/src/shared/proparser/qmakevfs.cpp +++ b/src/shared/proparser/qmakevfs.cpp @@ -106,10 +106,10 @@ int QMakeVfs::idForFileName(const QString &fn, VfsFlags flags) return id; } #endif - if (!(flags & VfsAccessedOnly)) { #ifdef PROPARSER_THREAD_SAFE - QMutexLocker locker(&s_mutex); + QMutexLocker locker(&s_mutex); #endif + if (!(flags & VfsAccessedOnly)) { int &id = s_fileIdMap[fn]; if (!id) { id = ++s_fileIdCounter; From b36428222807857d8b5a2cac9fa6ad3a53cc7dc9 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Nov 2018 14:24:14 +0100 Subject: [PATCH 44/47] Debugger: Fix perspective combobox activation Fixes: QTCREATORBUG-21567 Change-Id: Ia309887fdc4752eb7ef82993608c83d0e2a757a8 Reviewed-by: Robert Loehning Reviewed-by: Eike Ziller --- src/plugins/debugger/debuggermainwindow.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 47a8f7b012a..8583cb6a8ea 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -384,7 +384,12 @@ void DebuggerMainWindowPrivate::selectPerspective(Perspective *perspective) if (m_currentPerspective) m_currentPerspective->d->restoreLayout(); - const int index = indexInChooser(m_currentPerspective); + int index = indexInChooser(m_currentPerspective); + if (index == -1) { + if (Perspective *parent = Perspective::findPerspective(m_currentPerspective->d->m_parentPerspectiveId)) + index = indexInChooser(parent); + } + if (index != -1) { m_perspectiveChooser->setCurrentIndex(index); From 20badbe019cdc5afe4aa6d2019d2b8660015c2e3 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 16 Nov 2018 14:10:35 +0100 Subject: [PATCH 45/47] CMake: Suppress header-only targets from code model Do not report targets that contain headers only and have no include directories/defines set up to the code model. Such targets are used to tell creator about the projects header files as a work-around to creator not reporting headers in cmake projects. This work-around is of course not necessary anymore, but it is widely used and breaks the heuristics in the code model. So do not inform the code model about these parts of the project. (cherry picked from commit 152d2245d9ed10aad188208cbdea02f0cf94c482) Task-number: QTCREATORBUG-21425 Change-Id: I387d9d9fb4ae7b54fa08ee9b23efb9ab1f179b9c Reviewed-by: Tobias Hunger --- .../cmakeprojectmanager/servermodereader.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/servermodereader.cpp b/src/plugins/cmakeprojectmanager/servermodereader.cpp index 3451e704da4..54364f75c7b 100644 --- a/src/plugins/cmakeprojectmanager/servermodereader.cpp +++ b/src/plugins/cmakeprojectmanager/servermodereader.cpp @@ -360,6 +360,19 @@ void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps) { int counter = 0; for (const FileGroup *fg : qAsConst(m_fileGroups)) { + // CMake users worked around Creator's inability of listing header files by creating + // custom targets with all the header files. This target breaks the code model, so + // keep quiet about it:-) + if (fg->macros.isEmpty() + && fg->includePaths.isEmpty() + && !fg->isGenerated + && Utils::allOf(fg->sources, [](const Utils::FileName &source) { + return Node::fileTypeForFileName(source) == FileType::Header; + })) { + qWarning() << "Not reporting all-header file group of target" << fg->target << "to code model."; + continue; + } + ++counter; const QStringList flags = QtcProcess::splitArgs(fg->compileFlags); const QStringList includes = transform(fg->includePaths, [](const IncludePath *ip) { return ip->path.toString(); }); From ab4f6ad9ce9f7f83857d8b09326ea57d1b521703 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 28 Nov 2018 13:38:11 +0100 Subject: [PATCH 46/47] QbsProjectManager: Fix race condition on target switch (cherry picked from commit 77c729bb8a315dc596d111bddabf0b510094f7cc) Fixes: QTCREATORBUG-21544 Change-Id: I2a29e17ad1fd37049db16634f16e8c6916cb1093 Reviewed-by: Nikolai Kosjar --- src/plugins/qbsprojectmanager/qbsproject.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index a1df7d2e2ce..6b280eb5b93 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -1126,6 +1126,8 @@ void QbsProject::updateApplicationTargets() bti.usesTerminal = usesTerminal; bti.displayName = productData.fullDisplayName(); bti.runEnvModifier = [targetFile, productData, this](Utils::Environment &env, bool usingLibraryPaths) { + if (!qbsProject().isValid()) + return; QProcessEnvironment procEnv = env.toProcessEnvironment(); procEnv.insert(QLatin1String("QBS_RUN_FILE_PATH"), targetFile); QStringList setupRunEnvConfig; From 9eb66a806f098b84c22654da5aeb62a9db8e8c59 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 12 Nov 2018 09:53:44 +0100 Subject: [PATCH 47/47] Clang: Properly set up warnings for clang-based libraries Add warning flags to QMAKE_CXXFLAGS_WARN_ON to have them after default warnings. Change-Id: Ic94fe36175d3198191251d5b475f8f8ed000bef7 Reviewed-by: Nikolai Kosjar Reviewed-by: Marco Bubke --- src/plugins/clangformat/clangformat.pro | 3 ++- src/plugins/clangformat/clangformat.qbs | 1 + src/shared/clang/clang_installation.pri | 14 ++++++++++++++ .../clangpchmanagerbackend.pro | 3 ++- .../clangrefactoringbackend.pro | 3 ++- tests/unit/unittest/clang_dependency.pri | 1 + 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/plugins/clangformat/clangformat.pro b/src/plugins/clangformat/clangformat.pro index eda95884fd1..345340f9e6c 100644 --- a/src/plugins/clangformat/clangformat.pro +++ b/src/plugins/clangformat/clangformat.pro @@ -13,7 +13,8 @@ win32 { LIBS += $$CLANGFORMAT_LIBS INCLUDEPATH += $$LLVM_INCLUDEPATH -QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS +QMAKE_CXXFLAGS_WARN_ON *= $$LLVM_CXXFLAGS_WARNINGS +QMAKE_CXXFLAGS *= $$LLVM_CXXFLAGS unix:!macos:QMAKE_LFLAGS += -Wl,--exclude-libs,ALL SOURCES = \ diff --git a/src/plugins/clangformat/clangformat.qbs b/src/plugins/clangformat/clangformat.qbs index 66e481785e5..abb81d46473 100644 --- a/src/plugins/clangformat/clangformat.qbs +++ b/src/plugins/clangformat/clangformat.qbs @@ -17,6 +17,7 @@ QtcPlugin { condition: libclang.present && (!qbs.targetOS.contains("windows") || libclang.llvmBuildModeMatches) + cpp.cxxFlags: base.concat(libclang.llvmToolingCxxFlags) cpp.defines: base.concat("CLANGPCHMANAGER_LIB") cpp.includePaths: base.concat(libclang.llvmIncludeDir) cpp.libraryPaths: base.concat(libclang.llvmLibDir) diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri index d4307d40994..5ea21874fbb 100644 --- a/src/shared/clang/clang_installation.pri +++ b/src/shared/clang/clang_installation.pri @@ -111,6 +111,17 @@ defineReplace(splitFlags) { return($$result) } +defineReplace(extractWarnings) { + flags = $$1 + result = + for (flag, flags) { + contains(flag, ^[-/][wW].*$) { + result += $$flag + } + } + return($$result) +} + CLANGTOOLING_LIBS=-lclangTooling -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \ -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \ -lclangASTMatchers -lclangToolingCore -lclangAST -lclangLex -lclangBasic @@ -241,6 +252,9 @@ isEmpty(LLVM_VERSION) { LLVM_CXXFLAGS = $$splitFlags($$LLVM_CXXFLAGS) + LLVM_CXXFLAGS_WARNINGS = $$extractWarnings($$LLVM_CXXFLAGS) + LLVM_CXXFLAGS -= $$LLVM_CXXFLAGS_WARNINGS + LLVM_IS_COMPILED_WITH_RTTI = $$system($$llvm_config --has-rtti, lines) unix:!disable_external_rpath:!contains(QMAKE_DEFAULT_LIBDIRS, $${LLVM_LIBDIR}) { diff --git a/src/tools/clangpchmanagerbackend/clangpchmanagerbackend.pro b/src/tools/clangpchmanagerbackend/clangpchmanagerbackend.pro index dd2592e5ac4..0997b0ec961 100644 --- a/src/tools/clangpchmanagerbackend/clangpchmanagerbackend.pro +++ b/src/tools/clangpchmanagerbackend/clangpchmanagerbackend.pro @@ -18,7 +18,8 @@ QT -= gui LIBS += $$LIBTOOLING_LIBS INCLUDEPATH += $$LLVM_INCLUDEPATH -QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS +QMAKE_CXXFLAGS_WARN_ON *= $$LLVM_CXXFLAGS_WARNINGS +QMAKE_CXXFLAGS *= $$LLVM_CXXFLAGS INCLUDEPATH += ../clangrefactoringbackend/source diff --git a/src/tools/clangrefactoringbackend/clangrefactoringbackend.pro b/src/tools/clangrefactoringbackend/clangrefactoringbackend.pro index ea66a43b61e..630afdf6189 100644 --- a/src/tools/clangrefactoringbackend/clangrefactoringbackend.pro +++ b/src/tools/clangrefactoringbackend/clangrefactoringbackend.pro @@ -19,7 +19,8 @@ LIBS += $$LIBTOOLING_LIBS INCLUDEPATH += $$LLVM_INCLUDEPATH INCLUDEPATH += ../clangpchmanagerbackend/source -QMAKE_CXXFLAGS += $$LLVM_CXXFLAGS +QMAKE_CXXFLAGS_WARN_ON *= $$LLVM_CXXFLAGS_WARNINGS +QMAKE_CXXFLAGS *= $$LLVM_CXXFLAGS SOURCES += \ clangrefactoringbackendmain.cpp diff --git a/tests/unit/unittest/clang_dependency.pri b/tests/unit/unittest/clang_dependency.pri index 2c72feadff0..62c798464b1 100644 --- a/tests/unit/unittest/clang_dependency.pri +++ b/tests/unit/unittest/clang_dependency.pri @@ -22,6 +22,7 @@ include(../../../src/shared/clang/clang_defines.pri) !contains(QMAKE_DEFAULT_LIBDIRS, $$LLVM_LIBDIR): QMAKE_RPATHDIR += $$LLVM_LIBDIR LLVM_CXXFLAGS ~= s,-g\d?, + QMAKE_CXXFLAGS_WARN_ON *= $$LLVM_CXXFLAGS_WARNINGS QMAKE_CXXFLAGS *= $$LLVM_CXXFLAGS DEFINES += CLANG_COMPILER_PATH=\"R\\\"xxx($$LLVM_BINDIR/clang)xxx\\\"\"