Merge remote-tracking branch 'origin/4.15'

Change-Id: Ia6558fc2423fd9cd84ca2282bfa60d102dff682e
This commit is contained in:
Eike Ziller
2021-05-19 09:54:07 +02:00
21 changed files with 164 additions and 35 deletions

View File

@@ -23,7 +23,7 @@ instructions:
maxTimeBetweenOutput: 360
userMessageOnFailure: "Failed to extract LLVM package, check logs."
- type: ExecuteCommand
command: "python {{.AgentWorkingDir}}/qt-creator/qt-creator/scripts/build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}/qt-creator/qt-creator --build {{.AgentWorkingDir}}/qt-creator/qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --elfutils-path {{.AgentWorkingDir}}/build/qt_temp/elfutils --llvm-path {{.AgentWorkingDir}}/build/qt_temp/libclang --with-tests --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
command: "python -u {{.AgentWorkingDir}}/qt-creator/qt-creator/scripts/build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}/qt-creator/qt-creator --build {{.AgentWorkingDir}}/qt-creator/qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --elfutils-path {{.AgentWorkingDir}}/build/qt_temp/elfutils --llvm-path {{.AgentWorkingDir}}/build/qt_temp/libclang --with-tests --no-zip --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to run build.py, check logs."
@@ -50,7 +50,7 @@ instructions:
maxTimeBetweenOutput: 360
userMessageOnFailure: "Failed to extract LLVM package, check logs."
- type: ExecuteCommand
command: "python {{.AgentWorkingDir}}/qt-creator/qt-creator/scripts/build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}/qt-creator/qt-creator --build {{.AgentWorkingDir}}/qt-creator/qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --llvm-path {{.AgentWorkingDir}}/build/qt_temp/libclang --keychain-unlock-script /Users/qt/unlock-keychain.sh --with-tests --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
command: "python -u {{.AgentWorkingDir}}/qt-creator/qt-creator/scripts/build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}/qt-creator/qt-creator --build {{.AgentWorkingDir}}/qt-creator/qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --llvm-path {{.AgentWorkingDir}}/build/qt_temp/libclang --keychain-unlock-script /Users/qt/unlock-keychain.sh --with-tests --no-zip --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to run build.py, check logs."
@@ -92,7 +92,7 @@ instructions:
maxTimeBetweenOutput: 360
userMessageOnFailure: "Failed to extract LLVM package, check logs."
- type: ExecuteCommand
command: "python -u {{.AgentWorkingDir}}\\qt-creator\\qt-creator\\scripts\\build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}\\qt-creator\\qt-creator --build {{.AgentWorkingDir}}\\qt-creator\\qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --python-path {{.AgentWorkingDir}}\\build\\qt_temp\\python --elfutils-path {{.AgentWorkingDir}}\\buid\\qt_temp\\elfutils --llvm-path {{.AgentWorkingDir}}\\build\\qt_temp\\libclang --with-tests --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache --add-config=-DWITH_SCCACHE_SUPPORT=ON"
command: "python -u {{.AgentWorkingDir}}\\qt-creator\\qt-creator\\scripts\\build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}\\qt-creator\\qt-creator --build {{.AgentWorkingDir}}\\qt-creator\\qt-creator_build --qt-path {{.AgentWorkingDir}}/build/qt5_install_dir --python-path {{.AgentWorkingDir}}\\build\\qt_temp\\python --elfutils-path {{.AgentWorkingDir}}\\buid\\qt_temp\\elfutils --llvm-path {{.AgentWorkingDir}}\\build\\qt_temp\\libclang --with-tests --no-zip --add-config=-DCMAKE_C_COMPILER_LAUNCHER=sccache --add-config=-DCMAKE_CXX_COMPILER_LAUNCHER=sccache --add-config=-DWITH_SCCACHE_SUPPORT=ON"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to run build.py, check logs."
@@ -124,7 +124,7 @@ instructions:
maxTimeBetweenOutput: 360
userMessageOnFailure: "Failed to extract python package, check logs."
- type: ExecuteCommand
command: "python -u {{.AgentWorkingDir}}\\qt-creator\\qt-creator\\scripts\\build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}\\qt-creator\\qt-creator --build {{.AgentWorkingDir}}\\qt-creator\\qt-creator_build --python-path {{.AgentWorkingDir}}\\buid\\qt_temp\\python --no-qtcreator"
command: "python -u {{.AgentWorkingDir}}\\qt-creator\\qt-creator\\scripts\\build.py --build-type {{.Env.QTC_BUILD_TYPE}} --src {{.AgentWorkingDir}}\\qt-creator\\qt-creator --build {{.AgentWorkingDir}}\\qt-creator\\qt-creator_build --python-path {{.AgentWorkingDir}}\\buid\\qt_temp\\python --no-qtcreator --no-zip"
maxTimeInSeconds: 36000
maxTimeBetweenOutput: 3600
userMessageOnFailure: "Failed to run build.py, check logs."

View File

@@ -141,7 +141,7 @@
For example:
\badcode
git clone "ssh://user@codereview.qt-project.org:29418/qt-labs/qtquickdesigner-components"
git clone "https://codereview.qt-project.org/qt-labs/qtquickdesigner-components"
\endcode
Then use qmake from your Qt installation to build the module and to add it
@@ -166,7 +166,7 @@
For example:
\badcode
git clone ssh://user@codereview.qt-project.org:29418/qt/qtquicktimeline
git clone "https://codereview.qt-project.org/qt/qtquicktimeline"
\endcode
Then build the module and add it to your Qt as described in the previous

View File

@@ -35,6 +35,24 @@ int %{CN}::rowCount(const QModelIndex &parent) const
// FIXME: Implement me!
}
@if %{DynamicFetch}
bool %{CN}::hasChildren(const QModelIndex &parent) const
{
// FIXME: Implement me!
}
bool %{CN}::canFetchMore(const QModelIndex &parent) const
{
// FIXME: Implement me!
return false;
}
void %{CN}::fetchMore(const QModelIndex &parent)
{
// FIXME: Implement me!
}
@endif
QVariant %{CN}::data(const QModelIndex &index, int role) const
{

View File

@@ -28,6 +28,14 @@ public:
// Basic functionality:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
@if %{DynamicFetch}
// Fetch data dynamically:
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
bool canFetchMore(const QModelIndex &parent) const override;
void fetchMore(const QModelIndex &parent) override;
@endif
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
@if %{Editable}

View File

@@ -42,6 +42,24 @@ int %{CN}::columnCount(const QModelIndex &parent) const
// FIXME: Implement me!
}
@if %{DynamicFetch}
bool %{CN}::hasChildren(const QModelIndex &parent) const
{
// FIXME: Implement me!
}
bool %{CN}::canFetchMore(const QModelIndex &parent) const
{
// FIXME: Implement me!
return false;
}
void %{CN}::fetchMore(const QModelIndex &parent)
{
// FIXME: Implement me!
}
@endif
QVariant %{CN}::data(const QModelIndex &index, int role) const
{

View File

@@ -29,6 +29,14 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
@if %{DynamicFetch}
// Fetch data dynamically:
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
bool canFetchMore(const QModelIndex &parent) const override;
void fetchMore(const QModelIndex &parent) override;
@endif
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
@if %{Editable}

View File

@@ -212,10 +212,18 @@ jobs:
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
set(build_plugin_py "scripts/build_plugin.py")
foreach(dir "share/qtcreator/scripts" "Qt Creator.app/Contents/Resources/scripts" "Contents/Resources/scripts")
if(EXISTS "${{ steps.qt_creator.outputs.qtc_dir }}/${dir}/build_plugin.py")
set(build_plugin_py "${dir}/build_plugin.py")
break()
endif()
endforeach()
execute_process(
COMMAND python
-u
${{ steps.qt_creator.outputs.qtc_dir }}/scripts/build_plugin.py
"${{ steps.qt_creator.outputs.qtc_dir }}/${build_plugin_py}"
--name "$ENV{PLUGIN_NAME}-$ENV{QT_CREATOR_VERSION}-${{ matrix.config.artifact }}"
--src .
--build build

View File

@@ -206,7 +206,12 @@ void TextTip::configure(const QPoint &pos)
// Try to find a nice width without unnecessary wrapping.
setWordWrap(false);
int tipWidth = sizeHint().width();
const int screenWidth = QGuiApplication::screenAt(pos)->availableGeometry().width();
QScreen *screen = QGuiApplication::screenAt(pos);
if (!screen)
screen = QGuiApplication::primaryScreen();
const int screenWidth = screen->availableGeometry().width();
const int maxDesiredWidth = int(screenWidth * .5);
if (tipWidth > maxDesiredWidth) {
setWordWrap(true);

View File

@@ -666,7 +666,10 @@ void ExternalToolRunner::run()
const CommandLine cmd{m_resolvedExecutable, m_resolvedArguments, CommandLine::Raw};
m_process->setCommand(cmd);
m_process->setEnvironment(m_resolvedEnvironment);
MessageManager::writeDisrupting(tr("Starting external tool \"%1\"").arg(cmd.toUserOutput()));
const auto write = m_tool->outputHandling() == ExternalTool::ShowInPane
? QOverload<const QString &>::of(MessageManager::writeDisrupting)
: QOverload<const QString &>::of(MessageManager::writeSilently);
write(tr("Starting external tool \"%1\"").arg(cmd.toUserOutput()));
m_process->start();
}
@@ -686,7 +689,10 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status)
}
if (m_tool->modifiesCurrentDocument())
DocumentManager::unexpectFileChange(m_expectedFileName);
MessageManager::writeFlashing(tr("\"%1\" finished").arg(m_resolvedExecutable.toUserOutput()));
const auto write = m_tool->outputHandling() == ExternalTool::ShowInPane
? QOverload<const QString &>::of(MessageManager::writeFlashing)
: QOverload<const QString &>::of(MessageManager::writeSilently);
write(tr("\"%1\" finished").arg(m_resolvedExecutable.toUserOutput()));
deleteLater();
}

View File

@@ -234,7 +234,8 @@ bool TestCase::waitUntilProjectIsFullyOpened(Project *project, int timeOutInMs)
return QTest::qWaitFor(
[project]() {
return !SessionManager::startupBuildSystem()->isParsing()
return SessionManager::startupBuildSystem()
&& !SessionManager::startupBuildSystem()->isParsing()
&& CppModelManager::instance()->projectInfo(project).isValid();
},
timeOutInMs);

View File

@@ -1470,9 +1470,9 @@ void ClangClToolChainConfigWidget::setFromClangClToolChain()
const auto *clangClToolChain = static_cast<const ClangClToolChain *>(toolChain());
if (clangClToolChain->isAutoDetected())
m_llvmDirLabel->setText(clangClToolChain->compilerCommand().toUserOutput());
m_llvmDirLabel->setText(QDir::toNativeSeparators(clangClToolChain->clangPath()));
else
m_compilerCommand->setFilePath(clangClToolChain->compilerCommand());
m_compilerCommand->setFilePath(Utils::FilePath::fromString(clangClToolChain->clangPath()));
}
static const MsvcToolChain *findMsvcToolChain(unsigned char wordWidth, Abi::OSFlavor flavor)
@@ -1569,7 +1569,7 @@ static QList<ToolChain *> detectClangClToolChainInPath(const QString &clangClPat
res << tc;
} else {
auto cltc = new ClangClToolChain;
cltc->setCompilerCommand(FilePath::fromString(clangClPath));
cltc->setClangPath(clangClPath);
cltc->setDisplayName(name);
cltc->setDetection(ToolChain::AutoDetection);
cltc->setLanguage(language);
@@ -1587,18 +1587,18 @@ static QString compilerFromPath(const QString &path)
void ClangClToolChainConfigWidget::applyImpl()
{
FilePath compilerCommand = m_compilerCommand->filePath();
Utils::FilePath clangClPath = m_compilerCommand->filePath();
auto clangClToolChain = static_cast<ClangClToolChain *>(toolChain());
clangClToolChain->setCompilerCommand(compilerCommand);
clangClToolChain->setClangPath(clangClPath.toString());
if (compilerCommand.fileName() != "clang-cl.exe") {
if (clangClPath.fileName() != "clang-cl.exe") {
clangClToolChain->resetVarsBat();
setFromClangClToolChain();
return;
}
const QString displayedVarsBat = m_varsBatDisplayCombo->currentText();
QList<ToolChain *> results = detectClangClToolChainInPath(compilerCommand.toString(),
QList<ToolChain *> results = detectClangClToolChainInPath(clangClPath.toString(),
{},
displayedVarsBat);
@@ -1638,22 +1638,26 @@ ClangClToolChain::ClangClToolChain()
{
setDisplayName("clang-cl");
setTypeDisplayName(QCoreApplication::translate("ProjectExplorer::ClangToolChainFactory", "Clang"));
setCompilerCommandKey("ProjectExplorer.ClangClToolChain.LlvmDir");
}
bool ClangClToolChain::isValid() const
{
return MsvcToolChain::isValid() && compilerCommand().exists()
&& compilerCommand().fileName() == "clang-cl.exe";
const QFileInfo fi(clangPath());
return MsvcToolChain::isValid() && fi.exists() && fi.fileName() == "clang-cl.exe";
}
void ClangClToolChain::addToEnvironment(Utils::Environment &env) const
{
MsvcToolChain::addToEnvironment(env);
QDir path = compilerCommand().toFileInfo().absoluteDir(); // bin folder
QDir path = QFileInfo(m_clangPath).absoluteDir(); // bin folder
env.prependOrSetPath(path.canonicalPath());
}
Utils::FilePath ClangClToolChain::compilerCommand() const
{
return Utils::FilePath::fromString(m_clangPath);
}
QStringList ClangClToolChain::suggestedMkspecList() const
{
const QString mkspec = "win32-clang-" + Abi::toString(targetAbi().osFlavor());
@@ -1665,11 +1669,44 @@ QList<OutputLineParser *> ClangClToolChain::createOutputParsers() const
return {new ClangClParser};
}
static inline QString llvmDirKey()
{
return QStringLiteral("ProjectExplorer.ClangClToolChain.LlvmDir");
}
QVariantMap ClangClToolChain::toMap() const
{
QVariantMap result = MsvcToolChain::toMap();
result.insert(llvmDirKey(), m_clangPath);
return result;
}
bool ClangClToolChain::fromMap(const QVariantMap &data)
{
if (!MsvcToolChain::fromMap(data))
return false;
const QString clangPath = data.value(llvmDirKey()).toString();
if (clangPath.isEmpty())
return false;
m_clangPath = clangPath;
return true;
}
std::unique_ptr<ToolChainConfigWidget> ClangClToolChain::createConfigurationWidget()
{
return std::make_unique<ClangClToolChainConfigWidget>(this);
}
bool ClangClToolChain::operator==(const ToolChain &other) const
{
if (!MsvcToolChain::operator==(other))
return false;
const auto *clangClTc = static_cast<const ClangClToolChain *>(&other);
return m_clangPath == clangClTc->m_clangPath;
}
Macros ClangClToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
const Utils::Environment &env) const
{
@@ -1683,7 +1720,7 @@ Macros ClangClToolChain::msvcPredefinedMacros(const QStringList &cxxflags,
QStringList arguments = cxxflags;
arguments.append(gccPredefinedMacrosOptions(language()));
arguments.append("-");
cpp.runBlocking({compilerCommand(), arguments});
cpp.runBlocking({clangPath(), arguments});
if (cpp.result() != Utils::QtcProcess::Finished || cpp.exitCode() != 0) {
// Show the warning but still parse the output.
QTC_CHECK(false && "clang-cl exited with non-zero code.");

View File

@@ -164,18 +164,28 @@ public:
bool isValid() const override;
QStringList suggestedMkspecList() const override;
void addToEnvironment(Utils::Environment &env) const override;
Utils::FilePath compilerCommand() const override; // FIXME: Remove
QList<Utils::OutputLineParser *> createOutputParsers() const override;
QVariantMap toMap() const override;
bool fromMap(const QVariantMap &data) override;
std::unique_ptr<ToolChainConfigWidget> createConfigurationWidget() override;
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(
const Utils::Environment &env) const override;
const QList<MsvcToolChain *> &msvcToolchains() const;
QString clangPath() const { return m_clangPath; }
void setClangPath(const QString &path) { m_clangPath = path; }
Macros msvcPredefinedMacros(const QStringList &cxxflags,
const Utils::Environment &env) const override;
Utils::LanguageVersion msvcLanguageVersion(const QStringList &cxxflags,
const Utils::Id &language,
const Macros &macros) const override;
bool operator==(const ToolChain &) const override;
private:
QString m_clangPath;
};
// --------------------------------------------------------------------------

View File

@@ -279,14 +279,7 @@ void ToolChain::toolChainUpdated()
void ToolChain::setDetection(ToolChain::Detection de)
{
if (d->m_detection == de)
return;
if (d->m_detection == ToolChain::UninitializedDetection) {
d->m_detection = de;
} else {
d->m_detection = de;
toolChainUpdated();
}
}
QString ToolChain::typeDisplayName() const

View File

@@ -146,7 +146,7 @@ public:
Utils::Id language() const;
Utils::FilePath compilerCommand() const;
virtual Utils::FilePath compilerCommand() const; // FIXME: De-virtualize.
void setCompilerCommand(const Utils::FilePath &command);
virtual QList<Utils::OutputLineParser *> createOutputParsers() const = 0;

View File

@@ -16,6 +16,7 @@ add_qtc_plugin(QmlDesigner
PLUGIN_DEPENDS
Core ProjectExplorer QmlJSEditor QmakeProjectManager QmlProjectManager
QtSupport TextEditor
PLUGIN_RECOMMENDS QmlPreview
SOURCES
designersettings.cpp designersettings.h
designmodecontext.cpp designmodecontext.h

View File

@@ -190,6 +190,7 @@ Core::IDocument::OpenResult ResourceFile::load()
const QString alias = felt.attribute(QLatin1String("alias"));
File * const file = new File(p, fileName, alias);
file->compress = felt.attribute(QLatin1String("compress"));
file->compressAlgo = felt.attribute(QLatin1String("compress-algo"));
file->threshold = felt.attribute(QLatin1String("threshold"));
p->file_list.append(file);
}
@@ -226,6 +227,8 @@ QString ResourceFile::contents() const
felt.setAttribute(QLatin1String("alias"), file.alias);
if (!file.compress.isEmpty())
felt.setAttribute(QLatin1String("compress"), file.compress);
if (!file.compressAlgo.isEmpty())
felt.setAttribute(QLatin1String("compress-algo"), file.compressAlgo);
if (!file.threshold.isEmpty())
felt.setAttribute(QLatin1String("threshold"), file.threshold);
}

View File

@@ -84,6 +84,7 @@ public:
// not used, only loaded and saved
QString compress;
QString compressAlgo;
QString threshold;
private:

View File

@@ -482,7 +482,7 @@ void CodeAssistantPrivate::destroyContext()
cancelCurrentRequest();
} else if (m_proposalWidget) {
m_editorWidget->keepAutoCompletionHighlight(false);
if (m_proposalWidget->isVisible())
if (m_proposalWidget->proposalIsVisible())
m_proposalWidget->closeProposal();
disconnect(m_proposalWidget, &QObject::destroyed,
this, &CodeAssistantPrivate::finalizeProposal);

View File

@@ -384,7 +384,9 @@ void TokenInfo::identifierKind(const Cursor &cursor, Recursion recursion)
if (cursor.isInvalidDeclaration())
return;
if (recursion == Recursion::FirstPass && cursor.kind() != CXCursor_NotImplemented) {
if (recursion == Recursion::FirstPass
&& cursor.kind() != CXCursor_NotImplemented
&& cursor.kind() != CXCursor_PreprocessingDirective) {
const Cursor c = realCursor(cursor);
if (!clang_isInvalid(c.kind()) && c != cursor) {
identifierKind(c, Recursion::FirstPass);

View File

@@ -790,3 +790,7 @@ static inline constexpr vecn<T, S> operator<(vecn<T, S> a, vecn<T, S> b)
}
const char *cyrillic = "б";
struct foo {
#define blubb
};

View File

@@ -1813,6 +1813,12 @@ TEST_F(TokenProcessor, CyrillicString)
ASSERT_THAT(infos[5], IsHighlightingMark(792u, 24u, 3u, HighlightingType::StringLiteral));
}
TEST_F(TokenProcessor, PreProcessorInStruct)
{
const auto infos = translationUnit.tokenInfosInRange(sourceRange(793, 14));
ASSERT_THAT(infos[1], HasOnlyType(HighlightingType::Preprocessor));
}
Data *TokenProcessor::d;
void TokenProcessor::SetUpTestCase()