forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.8'
Change-Id: I74268f767e2fc7dae5db390a0348095ef220abd2
This commit is contained in:
@@ -101,17 +101,33 @@ function extraLibraries(llvmConfig, targetOS)
|
||||
}));
|
||||
}
|
||||
|
||||
function formattingLibs(llvmConfig, targetOS)
|
||||
function formattingLibs(llvmConfig, qtcFunctions, targetOS)
|
||||
{
|
||||
var fixedList = [
|
||||
var clangVersion = version(llvmConfig)
|
||||
var libs = []
|
||||
if (qtcFunctions.versionIsAtLeast(clangVersion, MinimumLLVMVersion)) {
|
||||
if (qtcFunctions.versionIsAtLeast(clangVersion, "7.0.0")) {
|
||||
libs.concat([
|
||||
"clangFormat",
|
||||
"clangToolingInclusions",
|
||||
"clangToolingCore",
|
||||
"clangRewrite",
|
||||
"clangLex",
|
||||
"clangBasic",
|
||||
]);
|
||||
} else {
|
||||
libs.concat([
|
||||
"clangFormat",
|
||||
"clangToolingCore",
|
||||
"clangRewrite",
|
||||
"clangLex",
|
||||
"clangBasic",
|
||||
];
|
||||
]);
|
||||
}
|
||||
libs.concat(extraLibraries(llvmConfig, targetOS));
|
||||
}
|
||||
|
||||
return fixedList.concat(extraLibraries(llvmConfig, targetOS));
|
||||
return libs;
|
||||
}
|
||||
|
||||
function toolingLibs(llvmConfig, targetOS)
|
||||
|
@@ -38,7 +38,7 @@ Module {
|
||||
llvmToolingDefines = toolingParams.defines;
|
||||
llvmToolingIncludes = toolingParams.includes;
|
||||
llvmToolingCxxFlags = toolingParams.cxxFlags;
|
||||
llvmFormattingLibs = ClangFunctions.formattingLibs(llvmConfig, targetOS);
|
||||
llvmFormattingLibs = ClangFunctions.formattingLibs(llvmConfig, QtcFunctions, targetOS);
|
||||
found = llvmConfig && File.exists(llvmIncludeDir.concat("/clang-c/Index.h"));
|
||||
}
|
||||
}
|
||||
|
@@ -419,6 +419,7 @@ FlatProjectsMode=true
|
||||
FlatMenuBar=true
|
||||
ToolBarIconShadow=true
|
||||
WindowColorAsBase=false
|
||||
DarkUserInterface=true
|
||||
|
||||
[Gradients]
|
||||
DetailsWidgetHeaderGradient\1\color=00000000
|
||||
|
@@ -443,7 +443,8 @@ static bool isGuiThread()
|
||||
}
|
||||
|
||||
SynchronousProcessResponse SynchronousProcess::run(const QString &binary,
|
||||
const QStringList &args)
|
||||
const QStringList &args,
|
||||
const QByteArray &writeData)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << '>' << Q_FUNC_INFO << binary << args;
|
||||
@@ -454,8 +455,20 @@ 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, QIODevice::ReadOnly);
|
||||
d->m_process.start(binary, args, writeData.isEmpty() ? QIODevice::ReadOnly : QIODevice::ReadWrite);
|
||||
connect(&d->m_process, &QProcess::started, this, [this, writeData] {
|
||||
if (!writeData.isEmpty()) {
|
||||
int pos = 0;
|
||||
int sz = writeData.size();
|
||||
do {
|
||||
d->m_process.waitForBytesWritten();
|
||||
auto res = d->m_process.write(writeData.constData() + pos, sz - pos);
|
||||
if (res > 0) pos += res;
|
||||
} while (pos < sz);
|
||||
d->m_process.waitForBytesWritten();
|
||||
}
|
||||
d->m_process.closeWriteChannel();
|
||||
});
|
||||
if (!d->m_startFailure) {
|
||||
d->m_timer.start();
|
||||
if (isGuiThread())
|
||||
|
@@ -127,7 +127,7 @@ public:
|
||||
ExitCodeInterpreter exitCodeInterpreter() const;
|
||||
|
||||
// Starts an nested event loop and runs the binary with the arguments
|
||||
SynchronousProcessResponse run(const QString &binary, const QStringList &args);
|
||||
SynchronousProcessResponse run(const QString &binary, const QStringList &args, const QByteArray &writeData = {});
|
||||
// Starts the binary with the arguments blocking the UI fully
|
||||
SynchronousProcessResponse runBlocking(const QString &binary, const QStringList &args);
|
||||
|
||||
|
@@ -768,6 +768,27 @@ FileName AndroidConfig::ndkLocation() const
|
||||
return m_ndkLocation;
|
||||
}
|
||||
|
||||
static inline QString gdbServerArch(const Abi &abi)
|
||||
{
|
||||
switch (abi.architecture()) {
|
||||
case Abi::X86Architecture:
|
||||
return abi.wordWidth() == 64 ? QString{"x86_64"} : QString{"x86"};
|
||||
case Abi::ArmArchitecture:
|
||||
return abi.wordWidth() == 64 ? QString{"arm64"} : QString{"arm"};
|
||||
default: return {};
|
||||
};
|
||||
}
|
||||
|
||||
FileName AndroidConfig::gdbServer(const ProjectExplorer::Abi &abi) const
|
||||
{
|
||||
FileName path = AndroidConfigurations::currentConfig().ndkLocation();
|
||||
path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver")
|
||||
.arg(gdbServerArch(abi)));
|
||||
if (path.exists())
|
||||
return path;
|
||||
return {};
|
||||
}
|
||||
|
||||
QVersionNumber AndroidConfig::ndkVersion() const
|
||||
{
|
||||
QVersionNumber version;
|
||||
@@ -1081,7 +1102,7 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
QVariant id = Debugger::DebuggerItemManager::registerDebugger(debugger);
|
||||
Debugger::DebuggerKitInformation::setDebugger(toSetup, id);
|
||||
|
||||
AndroidGdbServerKitInformation::setGdbSever(toSetup, tc->suggestedGdbServer());
|
||||
AndroidGdbServerKitInformation::setGdbSever(toSetup, currentConfig().gdbServer(tc->targetAbi()));
|
||||
toSetup->makeSticky();
|
||||
toSetup->setUnexpandedDisplayName(tr("Android for %1 (GCC %2, %3)")
|
||||
.arg(static_cast<const AndroidQtVersion *>(qt)->targetArch())
|
||||
|
@@ -106,6 +106,7 @@ public:
|
||||
void setSdkManagerToolArgs(const QStringList &args);
|
||||
|
||||
Utils::FileName ndkLocation() const;
|
||||
Utils::FileName gdbServer(const ProjectExplorer::Abi &abi) const;
|
||||
QVersionNumber ndkVersion() const;
|
||||
void setNdkLocation(const Utils::FileName &ndkLocation);
|
||||
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "androidconstants.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidrunconfiguration.h"
|
||||
#include "androidgdbserverkitinformation.h"
|
||||
|
||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
@@ -42,6 +43,7 @@
|
||||
#include <utils/temporaryfile.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/url.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QLoggingCategory>
|
||||
#include <QTcpServer>
|
||||
@@ -222,6 +224,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
|
||||
<< "Extra Start Args:" << m_amStartExtraArgs
|
||||
<< "Before Start ADB cmds:" << m_beforeStartAdbCommands
|
||||
<< "After finish ADB cmds:" << m_afterFinishAdbCommands;
|
||||
m_gdbserverPath = AndroidGdbServerKitInformation::gdbServer(target->kit()).toString();
|
||||
}
|
||||
|
||||
AndroidRunnerWorker::~AndroidRunnerWorker()
|
||||
@@ -255,13 +258,13 @@ bool AndroidRunnerWorker::adbShellAmNeedsQuotes()
|
||||
return !oldSdk;
|
||||
}
|
||||
|
||||
bool AndroidRunnerWorker::runAdb(const QStringList &args, int timeoutS)
|
||||
bool AndroidRunnerWorker::runAdb(const QStringList &args, int timeoutS, const QByteArray &writeData)
|
||||
{
|
||||
QStringList adbArgs = selector() + args;
|
||||
qCDebug(androidRunWorkerLog) << "ADB command: " << m_adb << adbArgs.join(' ');
|
||||
Utils::SynchronousProcess adb;
|
||||
adb.setTimeoutS(timeoutS);
|
||||
Utils::SynchronousProcessResponse response = adb.run(m_adb, adbArgs);
|
||||
Utils::SynchronousProcessResponse response = adb.run(m_adb, adbArgs, writeData);
|
||||
m_lastRunAdbError = response.exitMessage(m_adb, timeoutS);
|
||||
m_lastRunAdbRawOutput = response.allRawOutput();
|
||||
bool success = response.result == Utils::SynchronousProcessResponse::Finished;
|
||||
@@ -269,6 +272,18 @@ bool AndroidRunnerWorker::runAdb(const QStringList &args, int timeoutS)
|
||||
return success;
|
||||
}
|
||||
|
||||
bool AndroidRunnerWorker::uploadFile(const QString &from, const QString &to, const QString &flags)
|
||||
{
|
||||
QFile f(from);
|
||||
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());
|
||||
if (!res)
|
||||
return false;
|
||||
return runAdb({"shell", "run-as", m_packageName, "chmod", flags, to});
|
||||
}
|
||||
|
||||
void AndroidRunnerWorker::adbKill(qint64 pid)
|
||||
{
|
||||
runAdb({"shell", "kill", "-9", QString::number(pid)});
|
||||
@@ -410,30 +425,17 @@ void AndroidRunnerWorker::asyncStartHelper()
|
||||
// e.g. on Android 8 with NDK 10e
|
||||
runAdb({"shell", "run-as", m_packageName, "chmod", "a+x", packageDir});
|
||||
|
||||
QString gdbServerExecutable;
|
||||
if (!runAdb({"shell", "run-as", m_packageName, "ls", "lib/"})) {
|
||||
emit remoteProcessFinished(tr("Failed to get process path. Reason: %1.").arg(m_lastRunAdbError));
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto &line: m_lastRunAdbRawOutput.split('\n')) {
|
||||
if (line.indexOf("gdbserver") != -1/* || line.indexOf("lldb-server") != -1*/) {
|
||||
gdbServerExecutable = QString::fromUtf8(line.trimmed());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gdbServerExecutable.isEmpty()) {
|
||||
emit remoteProcessFinished(tr("Cannot find C++ debugger."));
|
||||
if (m_gdbserverPath.isEmpty() || !uploadFile(m_gdbserverPath, "gdbserver")) {
|
||||
emit remoteProcessFinished(tr("Can not find/copy C++ debug server."));
|
||||
return;
|
||||
}
|
||||
|
||||
QString gdbServerSocket = packageDir + "/debug-socket";
|
||||
runAdb({"shell", "run-as", m_packageName, "killall", gdbServerExecutable});
|
||||
runAdb({"shell", "run-as", m_packageName, "killall", "gdbserver"});
|
||||
runAdb({"shell", "run-as", m_packageName, "rm", gdbServerSocket});
|
||||
std::unique_ptr<QProcess, Deleter> gdbServerProcess(new QProcess, deleter);
|
||||
gdbServerProcess->start(m_adb, selector() << "shell" << "run-as"
|
||||
<< m_packageName << "lib/" + gdbServerExecutable
|
||||
<< m_packageName << "./gdbserver"
|
||||
<< "--multi" << "+" + gdbServerSocket);
|
||||
if (!gdbServerProcess->waitForStarted()) {
|
||||
emit remoteProcessFinished(tr("Failed to start C++ debugger."));
|
||||
|
@@ -47,7 +47,8 @@ public:
|
||||
AndroidRunnerWorker(ProjectExplorer::RunWorker *runner, const QString &packageName);
|
||||
~AndroidRunnerWorker() override;
|
||||
bool adbShellAmNeedsQuotes();
|
||||
bool runAdb(const QStringList &args, int timeoutS = 10);
|
||||
bool runAdb(const QStringList &args, int timeoutS = 10, const QByteArray &writeData = {});
|
||||
bool uploadFile(const QString &from, const QString &to, const QString &flags = QString("+x"));
|
||||
void adbKill(qint64 pid);
|
||||
QStringList selector() const;
|
||||
void forceStop();
|
||||
@@ -110,6 +111,7 @@ protected:
|
||||
int m_apiLevel = -1;
|
||||
QString m_extraAppParams;
|
||||
Utils::Environment m_extraEnvVars;
|
||||
QString m_gdbserverPath;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -193,19 +193,7 @@ FileName AndroidToolChain::suggestedDebugger() const
|
||||
|
||||
FileName AndroidToolChain::suggestedGdbServer() const
|
||||
{
|
||||
FileName path = AndroidConfigurations::currentConfig().ndkLocation();
|
||||
path.appendPath(QString::fromLatin1("prebuilt/android-%1/gdbserver/gdbserver")
|
||||
.arg(Abi::toString(targetAbi().architecture())));
|
||||
if (path.exists())
|
||||
return path;
|
||||
path = AndroidConfigurations::currentConfig().ndkLocation();
|
||||
path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(AndroidConfig::toolchainPrefix(targetAbi()))
|
||||
.arg(m_ndkToolChainVersion));
|
||||
if (path.exists())
|
||||
return path;
|
||||
|
||||
return FileName();
|
||||
return AndroidConfigurations::currentConfig().gdbServer(targetAbi());
|
||||
}
|
||||
|
||||
QVariantMap AndroidToolChain::toMap() const
|
||||
|
@@ -3,7 +3,7 @@ include(../../shared/clang/clang_installation.pri)
|
||||
|
||||
include(../../shared/clang/clang_defines.pri)
|
||||
|
||||
requires(!isEmpty(LLVM_VERSION))
|
||||
requires(!isEmpty(CLANGFORMAT_LIBS))
|
||||
|
||||
win32 {
|
||||
LLVM_BUILDMODE = $$system($$llvm_config --build-mode, lines)
|
||||
|
@@ -36,6 +36,8 @@
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QTextBlock>
|
||||
@@ -60,7 +62,12 @@ void adjustFormatStyleForLineBreak(format::FormatStyle &style,
|
||||
if (length > 0)
|
||||
style.ColumnLimit = prevBlockSize;
|
||||
style.AlwaysBreakBeforeMultilineStrings = true;
|
||||
#if LLVM_VERSION_MAJOR >= 7
|
||||
style.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes;
|
||||
#else
|
||||
style.AlwaysBreakTemplateDeclarations = true;
|
||||
#endif
|
||||
|
||||
style.AllowAllParametersOfDeclarationOnNextLine = true;
|
||||
style.AllowShortBlocksOnASingleLine = true;
|
||||
style.AllowShortCaseLabelsOnASingleLine = true;
|
||||
|
@@ -170,11 +170,6 @@ void CompilerOptionsBuilder::add(const QString &option)
|
||||
m_options.append(option);
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addDefine(const ProjectExplorer::Macro ¯o)
|
||||
{
|
||||
m_options.append(defineDirectiveToDefineOption(macro));
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addWordWidth()
|
||||
{
|
||||
const QString argument = m_projectPart.toolChainWordWidth == ProjectPart::WordWidth64Bit
|
||||
@@ -211,7 +206,7 @@ static QString creatorResourcePath()
|
||||
#ifndef UNIT_TESTS
|
||||
return Core::ICore::resourcePath();
|
||||
#else
|
||||
return QString();
|
||||
return QDir::toNativeSeparators(QString::fromUtf8(QTC_RESOURCE_DIR ""));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -221,7 +216,7 @@ static QString clangIncludeDirectory(const QString &clangVersion,
|
||||
#ifndef UNIT_TESTS
|
||||
return Core::ICore::clangIncludeDirectory(clangVersion, clangResourceDirectory);
|
||||
#else
|
||||
return QString();
|
||||
return QDir::toNativeSeparators(QString::fromUtf8(CLANG_RESOURCE_DIR ""));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -238,12 +233,20 @@ static int lastIncludeIndex(const QStringList &options, const QRegularExpression
|
||||
return index;
|
||||
}
|
||||
|
||||
static int includeIndexForResourceDirectory(const QStringList &options)
|
||||
static int includeIndexForResourceDirectory(const QStringList &options, bool isMacOs = false)
|
||||
{
|
||||
// include/c++/{version}, include/c++/v1 and include/g++
|
||||
const int cppIncludeIndex = lastIncludeIndex(
|
||||
options,
|
||||
QRegularExpression("\\A.*[\\/\\\\]include[\\/\\\\].*(g\\+\\+.*\\z|c\\+\\+[\\/\\\\](v1\\z|\\d+.*\\z))"));
|
||||
static const QRegularExpression includeRegExp(
|
||||
R"(\A.*[\/\\]include[\/\\].*(g\+\+.*\z|c\+\+[\/\\](v1\z|\d+.*\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))");
|
||||
|
||||
const int cppIncludeIndex = lastIncludeIndex(options, isMacOs
|
||||
? includeRegExpMac
|
||||
: includeRegExp);
|
||||
|
||||
if (cppIncludeIndex > 0)
|
||||
return cppIncludeIndex + 1;
|
||||
@@ -317,7 +320,8 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
|
||||
const QString clangIncludePath
|
||||
= clangIncludeDirectory(m_clangVersion, m_clangResourceDirectory);
|
||||
int includeIndexForResourceDir = includeIndexForResourceDirectory(builtInIncludes);
|
||||
int includeIndexForResourceDir = includeIndexForResourceDirectory(
|
||||
builtInIncludes, m_projectPart.toolChainTargetTriple.contains("darwin"));
|
||||
|
||||
if (includeIndexForResourceDir >= 0) {
|
||||
builtInIncludes.insert(includeIndexForResourceDir, clangIncludePath);
|
||||
|
@@ -56,33 +56,27 @@ public:
|
||||
SkipBuiltIn skipBuiltInHeaderPathsAndDefines = SkipBuiltIn::No,
|
||||
QString clangVersion = QString(),
|
||||
QString clangResourceDirectory = QString());
|
||||
virtual ~CompilerOptionsBuilder() {}
|
||||
|
||||
virtual void addTargetTriple();
|
||||
virtual void addExtraCodeModelFlags();
|
||||
virtual void enableExceptions();
|
||||
virtual void insertWrappedQtHeaders();
|
||||
virtual void addOptionsForLanguage(bool checkForBorlandExtensions = true);
|
||||
virtual void updateLanguageOption(ProjectFile::Kind fileKind);
|
||||
|
||||
virtual void addExtraOptions() {}
|
||||
|
||||
QStringList build(ProjectFile::Kind fileKind,
|
||||
PchUsage pchUsage);
|
||||
QStringList options() const;
|
||||
|
||||
// Add custom options
|
||||
void add(const QString &option);
|
||||
void addDefine(const ProjectExplorer::Macro &marco);
|
||||
|
||||
virtual void addExtraOptions() {}
|
||||
// Add options based on project part
|
||||
virtual void addToolchainAndProjectMacros();
|
||||
void addWordWidth();
|
||||
void addToolchainFlags();
|
||||
void addHeaderPathOptions();
|
||||
void addPrecompiledHeaderOptions(PchUsage pchUsage);
|
||||
virtual void addToolchainAndProjectMacros();
|
||||
void addMacros(const ProjectExplorer::Macros ¯os);
|
||||
|
||||
void addTargetTriple();
|
||||
void addExtraCodeModelFlags();
|
||||
void enableExceptions();
|
||||
void insertWrappedQtHeaders();
|
||||
void addOptionsForLanguage(bool checkForBorlandExtensions = true);
|
||||
void updateLanguageOption(ProjectFile::Kind fileKind);
|
||||
|
||||
void addMsvcCompatibilityVersion();
|
||||
void undefineCppLanguageFeatureMacrosForMsvc2015();
|
||||
void addDefineFunctionMacrosMsvc();
|
||||
@@ -97,8 +91,13 @@ protected:
|
||||
virtual QString defineOption() const;
|
||||
virtual QString undefineOption() const;
|
||||
virtual QString includeOption() const;
|
||||
|
||||
// Add custom options
|
||||
void add(const QString &option);
|
||||
|
||||
QString includeDirOptionForPath(const QString &path) const;
|
||||
const ProjectPart m_projectPart;
|
||||
|
||||
const ProjectPart &m_projectPart;
|
||||
|
||||
private:
|
||||
QByteArray macroOption(const ProjectExplorer::Macro ¯o) const;
|
||||
|
@@ -14,6 +14,8 @@
|
||||
<file>images/debugger_interrupt@2x.png</file>
|
||||
<file>images/debugger_interrupt_mask.png</file>
|
||||
<file>images/debugger_interrupt_mask@2x.png</file>
|
||||
<file>images/debugger_stop_mask.png</file>
|
||||
<file>images/debugger_stop_mask@2x.png</file>
|
||||
<file>images/debugger_reversemode.png</file>
|
||||
<file>images/debugger_reversemode@2x.png</file>
|
||||
<file>images/debugger_reversemode_background.png</file>
|
||||
|
@@ -770,7 +770,7 @@ void DebuggerEnginePrivate::setupViews()
|
||||
m_perspective->addWindow(m_sourceFilesWindow, Perspective::AddToTab, m_modulesWindow, false);
|
||||
m_perspective->addWindow(m_localsAndInspectorWindow, Perspective::AddToTab, nullptr, true, Qt::RightDockWidgetArea);
|
||||
m_perspective->addWindow(m_watchersWindow, Perspective::AddToTab, m_localsAndInspectorWindow, true, Qt::RightDockWidgetArea);
|
||||
m_perspective->addWindow(m_registerWindow, Perspective::AddToTab, m_watchersWindow, true, Qt::RightDockWidgetArea);
|
||||
m_perspective->addWindow(m_registerWindow, Perspective::AddToTab, m_watchersWindow, false, Qt::RightDockWidgetArea);
|
||||
m_perspective->addWindow(m_logWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea);
|
||||
|
||||
m_perspective->select();
|
||||
@@ -2529,7 +2529,7 @@ Context CppDebuggerEngine::languageContext() const
|
||||
void CppDebuggerEngine::validateExecutable()
|
||||
{
|
||||
DebuggerRunParameters &rp = mutableRunParameters();
|
||||
const bool warnOnRelease = boolSetting(WarnOnReleaseBuilds);
|
||||
const bool warnOnRelease = boolSetting(WarnOnReleaseBuilds) && rp.toolChainAbi.osFlavor() != Abi::AndroidLinuxFlavor;
|
||||
bool warnOnInappropriateDebugger = false;
|
||||
QString detailedWarning;
|
||||
switch (rp.toolChainAbi.binaryFormat()) {
|
||||
|
@@ -66,6 +66,9 @@ const Icon INTERRUPT(
|
||||
const Icon INTERRUPT_FLAT({
|
||||
{":/debugger/images/debugger_interrupt_mask.png", Theme::IconsInterruptToolBarColor},
|
||||
{":/projectexplorer/images/debugger_beetle_mask.png", Theme::IconsDebugColor}});
|
||||
const Icon STOP_FLAT({
|
||||
{":/debugger/images/debugger_stop_mask.png", Theme::IconsStopColor},
|
||||
{":/projectexplorer/images/debugger_beetle_mask.png", Theme::IconsDebugColor}});
|
||||
const Icon DEBUG_INTERRUPT_SMALL({
|
||||
{":/utils/images/interrupt_small.png", Theme::IconsInterruptColor},
|
||||
{":/projectexplorer/images/debugger_overlay_small.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle);
|
||||
|
@@ -50,6 +50,7 @@ extern const Utils::Icon DEBUG_CONTINUE_SMALL;
|
||||
extern const Utils::Icon DEBUG_CONTINUE_SMALL_TOOLBAR;
|
||||
extern const Utils::Icon INTERRUPT;
|
||||
extern const Utils::Icon INTERRUPT_FLAT;
|
||||
extern const Utils::Icon STOP_FLAT;
|
||||
extern const Utils::Icon DEBUG_INTERRUPT_SMALL;
|
||||
extern const Utils::Icon DEBUG_INTERRUPT_SMALL_TOOLBAR;
|
||||
extern const Utils::Icon DEBUG_EXIT_SMALL;
|
||||
|
@@ -568,6 +568,7 @@ void Perspective::setEnabled(bool enabled)
|
||||
|
||||
QToolButton *PerspectivePrivate::setupToolButton(QAction *action)
|
||||
{
|
||||
QTC_ASSERT(action, return nullptr);
|
||||
auto toolButton = new QToolButton(m_innerToolBar);
|
||||
toolButton->setProperty("panelwidget", true);
|
||||
toolButton->setDefaultAction(action);
|
||||
@@ -577,16 +578,19 @@ QToolButton *PerspectivePrivate::setupToolButton(QAction *action)
|
||||
|
||||
void Perspective::addToolBarAction(QAction *action)
|
||||
{
|
||||
QTC_ASSERT(action, return);
|
||||
d->setupToolButton(action);
|
||||
}
|
||||
|
||||
void Perspective::addToolBarAction(OptionalAction *action)
|
||||
{
|
||||
QTC_ASSERT(action, return);
|
||||
action->m_toolButton = d->setupToolButton(action);
|
||||
}
|
||||
|
||||
void Perspective::addToolBarWidget(QWidget *widget)
|
||||
{
|
||||
QTC_ASSERT(widget, return);
|
||||
// QStyle::polish is called before it is added to the toolbar, explicitly make it a panel widget
|
||||
widget->setProperty("panelwidget", true);
|
||||
widget->setParent(d->m_innerToolBar);
|
||||
@@ -644,6 +648,7 @@ void Perspective::addWindow(QWidget *widget,
|
||||
bool visibleByDefault,
|
||||
Qt::DockWidgetArea area)
|
||||
{
|
||||
QTC_ASSERT(widget, return);
|
||||
DockOperation op;
|
||||
op.widget = widget;
|
||||
if (anchorWidget)
|
||||
|
@@ -1143,11 +1143,14 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
||||
|
||||
m_visibleStartAction.initialize(&m_startAction);
|
||||
m_visibleStartAction.setAttribute(ProxyAction::UpdateText);
|
||||
m_visibleStartAction.setAttribute(ProxyAction::UpdateIcon);
|
||||
m_visibleStartAction.setAction(&m_startAction);
|
||||
m_visibleStartAction.setIcon(startIcon(true));
|
||||
|
||||
ModeManager::addAction(&m_visibleStartAction, Constants::P_ACTION_DEBUG);
|
||||
|
||||
m_undisturbableAction.setIcon(interruptIcon(false));
|
||||
m_undisturbableAction.setEnabled(false);
|
||||
|
||||
cmd = ActionManager::registerAction(&m_debugWithoutDeployAction,
|
||||
"Debugger.DebugWithoutDeploy");
|
||||
cmd->setAttribute(Command::CA_Hide);
|
||||
@@ -1446,28 +1449,31 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
DebuggerEngine *currentEngine = EngineManager::currentEngine();
|
||||
|
||||
QString whyNot;
|
||||
const bool canRun = startupProject
|
||||
&& ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot);
|
||||
const bool canRun =
|
||||
ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE, &whyNot);
|
||||
|
||||
if (!currentEngine || !currentEngine->isStartupRunConfiguration()) {
|
||||
// No engine running -- or -- we have a running engine but it does not
|
||||
// correspond to the current start up project.
|
||||
QString startupRunConfigName;
|
||||
if (startupRunConfig)
|
||||
startupRunConfigName = startupRunConfig->displayName();
|
||||
if (startupRunConfigName.isEmpty() && startupProject)
|
||||
startupRunConfigName = startupProject->displayName();
|
||||
|
||||
QString startToolTip = canRun ? tr("Start debugging of \"%1\"").arg(startupRunConfigName) : whyNot;
|
||||
QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot;
|
||||
// Step into/next: Start and break at 'main' unless a debugger is running.
|
||||
m_stepAction.setEnabled(canRun);
|
||||
m_stepAction.setToolTip(stepToolTip);
|
||||
m_nextAction.setEnabled(canRun);
|
||||
m_nextAction.setToolTip(stepToolTip);
|
||||
m_startAction.setEnabled(canRun);
|
||||
const QString startToolTip =
|
||||
canRun ? tr("Start debugging of \"%1\"").arg(startupRunConfigName) : whyNot;
|
||||
|
||||
m_startAction.setToolTip(startToolTip);
|
||||
m_startAction.setText(startToolTip);
|
||||
m_startAction.setText(canRun ? startToolTip : tr("Start Debugging"));
|
||||
|
||||
if (!currentEngine || !currentEngine->isStartupRunConfiguration()) {
|
||||
// No engine running -- or -- we have a running engine but it does not
|
||||
// correspond to the current start up project.
|
||||
// Step into/next: Start and break at 'main' unless a debugger is running.
|
||||
QString stepToolTip = canRun ? tr("Start \"%1\" and break at function \"main\"").arg(startupRunConfigName) : whyNot;
|
||||
m_stepAction.setToolTip(stepToolTip);
|
||||
m_nextAction.setToolTip(stepToolTip);
|
||||
m_stepAction.setEnabled(canRun);
|
||||
m_nextAction.setEnabled(canRun);
|
||||
m_startAction.setEnabled(canRun);
|
||||
m_startAction.setIcon(startIcon(false));
|
||||
m_startAction.setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
m_startAction.setVisible(true);
|
||||
@@ -1475,7 +1481,7 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_continueAction.setEnabled(false);
|
||||
m_exitAction.setEnabled(false);
|
||||
m_debugWithoutDeployAction.setEnabled(canRun);
|
||||
m_visibleStartAction.setIcon(startIcon(true));
|
||||
m_visibleStartAction.setAction(&m_startAction);
|
||||
m_hiddenStopAction.setAction(&m_undisturbableAction);
|
||||
m_detachAction.setEnabled(false);
|
||||
m_jumpToLineAction.setEnabled(false);
|
||||
@@ -1490,15 +1496,13 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_nextAction.setToolTip(QString());
|
||||
|
||||
// The 'state' bits only affect the fat debug button, not the preset start button.
|
||||
m_startAction.setText(QString());
|
||||
m_startAction.setToolTip(whyNot);
|
||||
m_startAction.setIcon(startIcon(false));
|
||||
m_startAction.setEnabled(false);
|
||||
m_startAction.setVisible(false);
|
||||
|
||||
QString currentDisplayName = currentEngine->displayName();
|
||||
m_interruptAction.setToolTip(tr("Interrupt \"%1\"").arg(currentDisplayName));
|
||||
m_continueAction.setToolTip(tr("Continue \"%1\"").arg(currentDisplayName));
|
||||
m_interruptAction.setToolTip(tr("Interrupt %1").arg(currentDisplayName));
|
||||
m_continueAction.setToolTip(tr("Continue %1").arg(currentDisplayName));
|
||||
|
||||
m_debugWithoutDeployAction.setEnabled(canRun);
|
||||
|
||||
@@ -1517,7 +1521,6 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_exitAction.setEnabled(true);
|
||||
m_debugWithoutDeployAction.setEnabled(false);
|
||||
m_visibleStartAction.setAction(&m_continueAction);
|
||||
m_visibleStartAction.setIcon(continueIcon(true));
|
||||
m_hiddenStopAction.setAction(&m_exitAction);
|
||||
m_stepAction.setEnabled(!companionPreventsAction);
|
||||
m_nextAction.setEnabled(!companionPreventsAction);
|
||||
@@ -1537,7 +1540,6 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_exitAction.setEnabled(true);
|
||||
m_debugWithoutDeployAction.setEnabled(false);
|
||||
m_visibleStartAction.setAction(&m_interruptAction);
|
||||
m_visibleStartAction.setIcon(interruptIcon(true));
|
||||
m_hiddenStopAction.setAction(&m_interruptAction);
|
||||
m_stepAction.setEnabled(false);
|
||||
m_nextAction.setEnabled(false);
|
||||
@@ -1557,7 +1559,6 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_exitAction.setEnabled(false);
|
||||
m_debugWithoutDeployAction.setEnabled(canRun);
|
||||
m_visibleStartAction.setAction(&m_startAction);
|
||||
m_visibleStartAction.setIcon(startIcon(true));
|
||||
m_hiddenStopAction.setAction(&m_undisturbableAction);
|
||||
m_stepAction.setEnabled(false);
|
||||
m_nextAction.setEnabled(false);
|
||||
@@ -1576,8 +1577,7 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_continueAction.setEnabled(false);
|
||||
m_exitAction.setEnabled(true);
|
||||
m_debugWithoutDeployAction.setEnabled(false);
|
||||
m_visibleStartAction.setAction(&m_undisturbableAction);
|
||||
m_visibleStartAction.setIcon(startIcon(true));
|
||||
m_visibleStartAction.setAction(&m_exitAction);
|
||||
m_hiddenStopAction.setAction(&m_exitAction);
|
||||
m_stepAction.setEnabled(false);
|
||||
m_nextAction.setEnabled(false);
|
||||
@@ -1589,10 +1589,10 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_stepOutAction.setEnabled(false);
|
||||
m_runToLineAction.setEnabled(false);
|
||||
m_runToSelectedFunctionAction.setEnabled(false);
|
||||
} else if (state == DebuggerNotReady) {
|
||||
// The startup phase should be over once we are here
|
||||
QTC_CHECK(false);
|
||||
} else {
|
||||
// The startup phase should be over once we are here.
|
||||
// But treat it as 'undisturbable if we are here by accident.
|
||||
QTC_CHECK(state != DebuggerNotReady);
|
||||
// Everything else is "undisturbable".
|
||||
m_startAction.setEnabled(false);
|
||||
m_interruptAction.setEnabled(false);
|
||||
@@ -1600,7 +1600,6 @@ void DebuggerPluginPrivate::updatePresetState()
|
||||
m_exitAction.setEnabled(false);
|
||||
m_debugWithoutDeployAction.setEnabled(false);
|
||||
m_visibleStartAction.setAction(&m_undisturbableAction);
|
||||
m_visibleStartAction.setIcon(startIcon(true));
|
||||
m_hiddenStopAction.setAction(&m_undisturbableAction);
|
||||
m_stepAction.setEnabled(false);
|
||||
m_nextAction.setEnabled(false);
|
||||
|
BIN
src/plugins/debugger/images/debugger_stop_mask.png
Normal file
BIN
src/plugins/debugger/images/debugger_stop_mask.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 100 B |
BIN
src/plugins/debugger/images/debugger_stop_mask@2x.png
Normal file
BIN
src/plugins/debugger/images/debugger_stop_mask@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 B |
Binary file not shown.
After Width: | Height: | Size: 227 B |
Binary file not shown.
After Width: | Height: | Size: 433 B |
@@ -18,3 +18,6 @@ SOURCES += \
|
||||
languageclientmanager.cpp \
|
||||
languageclientplugin.cpp \
|
||||
languageclientsettings.cpp
|
||||
|
||||
RESOURCES += \
|
||||
languageclient.qrc
|
||||
|
6
src/plugins/languageclient/languageclient.qrc
Normal file
6
src/plugins/languageclient/languageclient.qrc
Normal file
@@ -0,0 +1,6 @@
|
||||
<RCC>
|
||||
<qresource prefix="/languageclient">
|
||||
<file>images/settingscategory_languageclient.png</file>
|
||||
<file>images/settingscategory_languageclient@2x.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@@ -201,7 +201,8 @@ LanguageClientSettingsPage::LanguageClientSettingsPage()
|
||||
setCategory(Constants::LANGUAGECLIENT_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("LanguageClient",
|
||||
Constants::LANGUAGECLIENT_SETTINGS_TR));
|
||||
//setCategoryIcon( /* TODO */ );
|
||||
setCategoryIcon(Utils::Icon({{":/languageclient/images/settingscategory_languageclient.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
}
|
||||
|
||||
LanguageClientSettingsPage::~LanguageClientSettingsPage()
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QFormLayout>
|
||||
#include <QSpinBox>
|
||||
#include <QToolButton>
|
||||
|
||||
using namespace Utils;
|
||||
@@ -77,6 +78,19 @@ public:
|
||||
QPixmap m_labelPixmap;
|
||||
};
|
||||
|
||||
class BaseIntegerAspectPrivate
|
||||
{
|
||||
public:
|
||||
QVariant m_value;
|
||||
QVariant m_minimumValue;
|
||||
QVariant m_maximumValue;
|
||||
int m_displayIntegerBase = 10;
|
||||
QString m_label;
|
||||
QString m_prefix;
|
||||
QString m_suffix;
|
||||
QPointer<QSpinBox> m_spinBox; // Owned by configuration widget
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
||||
/*!
|
||||
@@ -337,4 +351,82 @@ void BaseBoolAspect::setLabel(const QString &label)
|
||||
d->m_label = label;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::BaseIntegerAspect
|
||||
*/
|
||||
|
||||
// BaseIntegerAspect
|
||||
|
||||
BaseIntegerAspect::BaseIntegerAspect()
|
||||
: d(new Internal::BaseIntegerAspectPrivate)
|
||||
{}
|
||||
|
||||
BaseIntegerAspect::~BaseIntegerAspect() = default;
|
||||
|
||||
void BaseIntegerAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
{
|
||||
QTC_CHECK(!d->m_spinBox);
|
||||
d->m_spinBox = new QSpinBox(layout->parentWidget());
|
||||
d->m_spinBox->setValue(d->m_value.toInt());
|
||||
d->m_spinBox->setDisplayIntegerBase(d->m_displayIntegerBase);
|
||||
d->m_spinBox->setPrefix(d->m_prefix);
|
||||
d->m_spinBox->setSuffix(d->m_suffix);
|
||||
if (d->m_maximumValue.isValid() && d->m_maximumValue.isValid())
|
||||
d->m_spinBox->setRange(d->m_minimumValue.toInt(), d->m_maximumValue.toInt());
|
||||
layout->addRow(d->m_label, d->m_spinBox);
|
||||
connect(d->m_spinBox.data(), static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged),
|
||||
this, [this](int value) {
|
||||
d->m_value = value;
|
||||
emit changed();
|
||||
});
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
d->m_value = map.value(settingsKey());
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::toMap(QVariantMap &data) const
|
||||
{
|
||||
data.insert(settingsKey(), d->m_value);
|
||||
}
|
||||
|
||||
int BaseIntegerAspect::value() const
|
||||
{
|
||||
return d->m_value.toInt();
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::setValue(int value)
|
||||
{
|
||||
d->m_value = value;
|
||||
if (d->m_spinBox)
|
||||
d->m_spinBox->setValue(d->m_value.toInt());
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::setRange(int min, int max)
|
||||
{
|
||||
d->m_minimumValue = min;
|
||||
d->m_maximumValue = max;
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::setLabel(const QString &label)
|
||||
{
|
||||
d->m_label = label;
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::setPrefix(const QString &prefix)
|
||||
{
|
||||
d->m_prefix = prefix;
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::setSuffix(const QString &suffix)
|
||||
{
|
||||
d->m_suffix = suffix;
|
||||
}
|
||||
|
||||
void BaseIntegerAspect::setDisplayIntegerBase(int base)
|
||||
{
|
||||
d->m_displayIntegerBase = base;
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -38,6 +38,7 @@ namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
class BaseBoolAspectPrivate;
|
||||
class BaseStringAspectPrivate;
|
||||
class BaseIntegerAspectPrivate;
|
||||
} // Internal
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BaseBoolAspect : public ProjectConfigurationAspect
|
||||
@@ -106,4 +107,30 @@ private:
|
||||
std::unique_ptr<Internal::BaseStringAspectPrivate> d;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BaseIntegerAspect : public ProjectConfigurationAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseIntegerAspect();
|
||||
~BaseIntegerAspect() override;
|
||||
|
||||
void addToConfigurationLayout(QFormLayout *layout) override;
|
||||
|
||||
int value() const;
|
||||
void setValue(int val);
|
||||
|
||||
void setRange(int min, int max);
|
||||
void setLabel(const QString &label);
|
||||
void setPrefix(const QString &prefix);
|
||||
void setSuffix(const QString &suffix);
|
||||
void setDisplayIntegerBase(int base);
|
||||
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void toMap(QVariantMap &map) const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<Internal::BaseIntegerAspectPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -69,11 +69,20 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
||||
|
||||
QTimer timer;
|
||||
timer.setInterval(100);
|
||||
|
||||
bool modalSeen = false;
|
||||
connect(&timer, &QTimer::timeout, this, [&]() {
|
||||
if (auto activeModal
|
||||
= qobject_cast<QmlProfilerAttachDialog *>(QApplication::activeModalWidget())) {
|
||||
activeModal->setPort(serverUrl.port());
|
||||
activeModal->accept();
|
||||
if (QWidget *activeModal = QApplication::activeModalWidget()) {
|
||||
modalSeen = true;
|
||||
auto dialog = qobject_cast<QmlProfilerAttachDialog *>(activeModal);
|
||||
if (dialog) {
|
||||
dialog->setPort(serverUrl.port());
|
||||
dialog->accept();
|
||||
timer.stop();
|
||||
} else {
|
||||
qWarning() << "Some other modal widget popped up:" << activeModal;
|
||||
activeModal->close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -83,6 +92,8 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
|
||||
|
||||
QTRY_VERIFY(connection);
|
||||
QTRY_VERIFY(runControl->isRunning());
|
||||
QTRY_VERIFY(modalSeen);
|
||||
QTRY_VERIFY(!timer.isActive());
|
||||
QTRY_VERIFY(profilerTool.clientManager()->isConnected());
|
||||
|
||||
connection.reset();
|
||||
|
@@ -116,9 +116,6 @@ CLANGTOOLING_LIBS=-lclangTooling -lclangIndex -lclangFrontend -lclangParse -lcla
|
||||
-lclangASTMatchers -lclangToolingCore -lclangAST -lclangLex -lclangBasic
|
||||
win32:CLANGTOOLING_LIBS += -lversion
|
||||
|
||||
CLANGFORMAT_LIBS=-lclangFormat -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
|
||||
win32:CLANGFORMAT_LIBS += -lversion
|
||||
|
||||
BIN_EXTENSION =
|
||||
win32: BIN_EXTENSION = .exe
|
||||
|
||||
@@ -141,6 +138,17 @@ isEmpty(LLVM_INSTALL_DIR) {
|
||||
|
||||
output = $$system($$llvm_config --version, lines)
|
||||
LLVM_VERSION = $$extractVersion($$output)
|
||||
|
||||
!isEmpty(LLVM_VERSION) {
|
||||
versionIsAtLeast($$LLVM_VERSION, 7, 0, 0): {
|
||||
CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
|
||||
win32:CLANGFORMAT_LIBS += -lversion
|
||||
} else:versionIsAtLeast($$LLVM_VERSION, 6, 0, 0): {
|
||||
CLANGFORMAT_LIBS=-lclangFormat -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
|
||||
win32:CLANGFORMAT_LIBS += -lversion
|
||||
}
|
||||
}
|
||||
|
||||
isEmpty(LLVM_VERSION) {
|
||||
$$llvmWarningOrError(\
|
||||
"Cannot determine clang version. Set LLVM_INSTALL_DIR to build the Clang Code Model",\
|
||||
|
@@ -68,6 +68,12 @@ for svgElement in svgTreeRoot.iter():
|
||||
except:
|
||||
pass
|
||||
|
||||
for id in svgIDs:
|
||||
pngFile = qtcSourceRoot + id + ".png"
|
||||
pngAt2XFile = qtcSourceRoot + id + "@2x.png"
|
||||
if not (os.path.isfile(pngFile) or os.path.isfile(pngAt2XFile)):
|
||||
sys.stderr.write(id + " has not yet been exported as .png.\n")
|
||||
|
||||
# The shell mode of Inkscape is used to execute several export commands
|
||||
# with one launch of Inkscape.
|
||||
inkscapeShellCommands = ""
|
||||
|
@@ -1300,7 +1300,7 @@
|
||||
sodipodi:nodetypes="cc" />
|
||||
</g>
|
||||
<g
|
||||
id="share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/down-arrow">
|
||||
id="share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/down-arrow">
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
id="rect5094"
|
||||
@@ -1318,8 +1318,8 @@
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/down-arrow"
|
||||
id="share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/up-arrow"
|
||||
xlink:href="#share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/down-arrow"
|
||||
id="share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/up-arrow"
|
||||
transform="matrix(1,0,0,-1,8,1174)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
@@ -2528,52 +2528,6 @@
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
<g
|
||||
id="share/qtcreator/templates/wizards/projects/qtquickapplication/canvas3d/icon"
|
||||
transform="translate(-159,-83)">
|
||||
<use
|
||||
style="display:inline"
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#transparentBackgroundRect_60_60"
|
||||
id="use5906-0-4-3-5-6-36"
|
||||
width="100%"
|
||||
height="100%"
|
||||
transform="translate(399,143)" />
|
||||
<use
|
||||
style="display:inline"
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#wizardicons_laptop_and_mobile"
|
||||
id="use5639"
|
||||
width="100%"
|
||||
height="100%"
|
||||
transform="translate(376,0.9999997)" />
|
||||
<g
|
||||
id="g7204"
|
||||
transform="translate(20,8)">
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5743"
|
||||
d="m 387,310 7,4 v 8 l -7,-4.50001 z"
|
||||
style="fill:#53586b" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path5747"
|
||||
d="m 394,306 7,4 2.6e-4,7.49999 L 394,322 v -8 l -7,-4 z"
|
||||
style="fill:#cecfd5" />
|
||||
</g>
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#g7204"
|
||||
id="use7208"
|
||||
transform="translate(20.99974,1.00001)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
<g
|
||||
id="share/qtcreator/templates/wizards/global/consoleapplication"
|
||||
transform="translate(-185,-78)">
|
||||
@@ -2770,7 +2724,7 @@
|
||||
x="0" />
|
||||
<g
|
||||
transform="matrix(0.875,0,0,0.875,828.5,72.25)"
|
||||
id="src/plugins/welcome/images/userguide-6" />
|
||||
id="g2818" />
|
||||
<path
|
||||
id="path7726"
|
||||
style="fill:#000000"
|
||||
@@ -3045,31 +2999,6 @@
|
||||
id="path6672"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="src/plugins/qbsprojectmanager/images/settingscategory_qbs"
|
||||
transform="translate(-229,-84)">
|
||||
<use
|
||||
style="display:inline"
|
||||
transform="translate(1144,148)"
|
||||
height="100%"
|
||||
width="100%"
|
||||
id="use3820-1-8-0-1-6-0-1-4-4-5-9-2-0-5-9"
|
||||
xlink:href="#backgroundRect_24"
|
||||
y="0"
|
||||
x="0" />
|
||||
<rect
|
||||
y="564"
|
||||
x="1124"
|
||||
height="16"
|
||||
width="16"
|
||||
id="rect6710"
|
||||
style="fill:#000000" />
|
||||
<path
|
||||
d="m 1139,570.5 h -1.5 c 0,0 -1,0 -1,1 0,1 2,1 2,2 0,1 -1,1 -1,1 h -1.5 m -4.5,-4 h 1.5 c 1,0 1.5,1 1.5,2 0,1 -0.5,2 -1.5,2 h -1.5 m 0,-6.5 v 7 m -3.5,-0.5 c 0.2067,0.72504 1,1 2,1 m -0.5,-4 a 2,3 0 0 1 -2,3 2,3 0 0 1 -2,-3 2,3 0 0 1 2,-3 2,3 0 0 1 2,3 z"
|
||||
style="fill:none;stroke:#ffffff"
|
||||
id="path6706"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
id="src/plugins/autotest/images/settingscategory_autotest"
|
||||
transform="translate(-220,-84)">
|
||||
@@ -3190,6 +3119,75 @@
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-181,-104)"
|
||||
id="src/plugins/languageclient/images/settingscategory_languageclient">
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#backgroundRect_24"
|
||||
id="use4625"
|
||||
width="100%"
|
||||
height="100%"
|
||||
transform="translate(1196,168)"
|
||||
style="display:inline" />
|
||||
<ellipse
|
||||
style="fill:none;stroke:#000000"
|
||||
id="path4643"
|
||||
cx="1180.5"
|
||||
cy="597.5"
|
||||
rx="4"
|
||||
ry="2" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#path4643"
|
||||
id="use4684"
|
||||
width="100%"
|
||||
height="100%"
|
||||
transform="translate(0,-6)" />
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
id="rect4670"
|
||||
width="10"
|
||||
height="3"
|
||||
x="1176"
|
||||
y="594.5" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000"
|
||||
d="m 1176.5,591.5 v 6"
|
||||
id="path4672"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#path4672"
|
||||
id="use4686"
|
||||
transform="translate(8)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
<path
|
||||
style="fill:#ffffff;stroke:#000000"
|
||||
d="m 1183,584.5 h 7 c 1,0 1.5,0.5 1.5,1.5 v 5 c 0,1 -0.5,1.5 -1.5,1.5 v 0 l -3,2.5 0.5,-2.5 h -4.5 c -1,0 -1.5,-0.5 -1.5,-1.5 v -5 c 0,-1 0.5,-1.5 1.5,-1.5 z"
|
||||
id="path4639"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccsc" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000"
|
||||
d="m 1185.75,586.25 -2.25,2.25 2.25,2.25"
|
||||
id="path4676"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccc" />
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#path4676"
|
||||
id="use4682"
|
||||
transform="matrix(-1,0,0,1,2373.0138,0)"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
@@ -4773,7 +4771,7 @@
|
||||
<g
|
||||
transform="translate(32,0)"
|
||||
style="display:inline"
|
||||
id="src/libs/timeline/qml/ico_rangeselection">
|
||||
id="src/libs/tracing/qml/ico_rangeselection">
|
||||
<rect
|
||||
id="rect6782-96-0-0-7"
|
||||
height="16"
|
||||
@@ -4814,7 +4812,7 @@
|
||||
<g
|
||||
transform="translate(32,0)"
|
||||
style="display:inline"
|
||||
id="src/libs/timeline/qml/ico_rangeselected">
|
||||
id="src/libs/tracing/qml/ico_rangeselected">
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
@@ -4833,7 +4831,7 @@
|
||||
</g>
|
||||
<g
|
||||
style="display:inline"
|
||||
id="src/libs/timeline/qml/ico_selectionmode"
|
||||
id="src/libs/tracing/qml/ico_selectionmode"
|
||||
clip-path="url(#clipPath6127)"
|
||||
transform="translate(31,0)">
|
||||
<rect
|
||||
@@ -4885,7 +4883,7 @@
|
||||
x="0" />
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/timeline/qml/ico_edit">
|
||||
id="src/libs/tracing/qml/ico_edit">
|
||||
<rect
|
||||
style="fill:#ffffff"
|
||||
x="1144"
|
||||
@@ -7466,38 +7464,6 @@
|
||||
ry="1.5" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/utils/images/panel_manage_button_hover"
|
||||
style="opacity:0.83">
|
||||
<use
|
||||
height="600"
|
||||
width="800"
|
||||
transform="translate(8,0)"
|
||||
id="use4140"
|
||||
xlink:href="#panel_manage_button"
|
||||
y="0"
|
||||
x="0" />
|
||||
<rect
|
||||
ry="3"
|
||||
y="500"
|
||||
x="192"
|
||||
height="20"
|
||||
width="8"
|
||||
id="rect4143"
|
||||
style="fill:#ffffff;fill-opacity:0.12549020000000000;stroke:none" />
|
||||
</g>
|
||||
<g
|
||||
id="src/libs/utils/images/panel_manage_button_pressed"
|
||||
style="opacity:0.82999998">
|
||||
<use
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#panel_manage_button"
|
||||
id="use3293"
|
||||
transform="matrix(1,0,0,-1,16,1020)"
|
||||
width="800"
|
||||
height="600" />
|
||||
</g>
|
||||
<g
|
||||
style="display:inline"
|
||||
transform="translate(-4)"
|
||||
@@ -9004,7 +8970,7 @@
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-247.75,309.5)"
|
||||
id="src/boot2qtdevice">
|
||||
id="../boot2qt/common/images/boot2qtdevice">
|
||||
<use
|
||||
transform="translate(458.75,6.5)"
|
||||
style="display:inline"
|
||||
@@ -9095,7 +9061,7 @@
|
||||
inkscape:label="#rect5338" />
|
||||
</g>
|
||||
<g
|
||||
id="src/boot2qtdevicesmall"
|
||||
id="../boot2qt/common/images/boot2qtdevicesmall"
|
||||
transform="translate(-318,27)">
|
||||
<use
|
||||
x="0"
|
||||
@@ -9174,7 +9140,7 @@
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-211.75,309.5)"
|
||||
id="src/boot2qtemulator">
|
||||
id="../boot2qt/common/images/boot2qtemulator">
|
||||
<use
|
||||
transform="translate(458.75,6.5)"
|
||||
style="display:inline"
|
||||
@@ -9230,7 +9196,7 @@
|
||||
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccc" />
|
||||
</g>
|
||||
<g
|
||||
id="src/boot2qtemulatorsmall"
|
||||
id="../boot2qt/common/images/boot2qtemulatorsmall"
|
||||
transform="translate(-282,27)">
|
||||
<use
|
||||
x="0"
|
||||
@@ -9264,7 +9230,7 @@
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-175.75,309.5)"
|
||||
id="src/boot2qtstartvm">
|
||||
id="../boot2qt/common/images/boot2qtstartvm">
|
||||
<use
|
||||
transform="translate(458.75,6.5)"
|
||||
style="display:inline"
|
||||
@@ -9311,7 +9277,7 @@
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-139.75,310.5)"
|
||||
id="src/vxworksqtdevice">
|
||||
id="../vxworks/plugins/vxworks/images/vxworksqtdevice">
|
||||
<use
|
||||
transform="translate(458.75,5.5)"
|
||||
style="display:inline"
|
||||
@@ -9329,7 +9295,7 @@
|
||||
sodipodi:nodetypes="cccccccccccccc" />
|
||||
</g>
|
||||
<g
|
||||
id="src/vxworksdevicesmall"
|
||||
id="../vxworks/plugins/vxworks/images/vxworksdevicesmall"
|
||||
transform="translate(-210,27)">
|
||||
<use
|
||||
x="0"
|
||||
@@ -9464,6 +9430,27 @@
|
||||
y="0"
|
||||
x="0" />
|
||||
</g>
|
||||
<g
|
||||
id="src/plugins/debugger/images/debugger_stop_mask"
|
||||
transform="translate(-711,333)"
|
||||
style="display:inline">
|
||||
<use
|
||||
transform="translate(704,3)"
|
||||
style="display:inline"
|
||||
x="0"
|
||||
y="0"
|
||||
xlink:href="#backgroundRect_32_28"
|
||||
id="use5913-0-8-1-7-9"
|
||||
width="100%"
|
||||
height="100%" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect4608-0-6"
|
||||
width="17"
|
||||
height="18"
|
||||
x="753"
|
||||
y="48" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="src/plugins/vcsbase/images/submit_arrow">
|
||||
|
Before Width: | Height: | Size: 352 KiB After Width: | Height: | Size: 351 KiB |
@@ -33,6 +33,8 @@ namespace ProjectExplorer {
|
||||
|
||||
class Project : public QObject {
|
||||
public:
|
||||
Project() = default;
|
||||
|
||||
Utils::FileName projectDirectory() const {
|
||||
return Utils::FileName();
|
||||
}
|
||||
|
@@ -1,4 +1,6 @@
|
||||
include(../../../src/shared/clang/clang_installation.pri)
|
||||
include(../../../src/shared/clang/clang_defines.pri)
|
||||
|
||||
!isEmpty(LLVM_VERSION) {
|
||||
requires(!isEmpty(LIBCLANG_LIBS))
|
||||
equals(LLVM_IS_COMPILED_WITH_RTTI, "NO") : message("LLVM needs to be compiled with RTTI!")
|
||||
|
343
tests/unit/unittest/compileroptionsbuilder-test.cpp
Normal file
343
tests/unit/unittest/compileroptionsbuilder-test.cpp
Normal file
@@ -0,0 +1,343 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2018 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "googletest.h"
|
||||
|
||||
#include <cpptools/compileroptionsbuilder.h>
|
||||
#include <cpptools/cppprojectfile.h>
|
||||
#include <cpptools/projectpart.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using CppTools::CompilerOptionsBuilder;
|
||||
using CppTools::ProjectFile;
|
||||
using CppTools::ProjectPart;
|
||||
using ProjectExplorer::HeaderPath;
|
||||
using ProjectExplorer::HeaderPathType;
|
||||
using ProjectExplorer::Project;
|
||||
|
||||
MATCHER_P(IsPartOfHeader, headerPart, std::string(negation ? "isn't " : "is ") + headerPart)
|
||||
{
|
||||
return arg.contains(QString::fromUtf8(headerPart));
|
||||
}
|
||||
|
||||
class CompilerOptionsBuilderTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() final
|
||||
{
|
||||
projectPart.project = project.get();
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID;
|
||||
projectPart.languageVersion = CppTools::ProjectPart::CXX17;
|
||||
projectPart.toolChainWordWidth = CppTools::ProjectPart::WordWidth64Bit;
|
||||
projectPart.toolChainTargetTriple = "x86_64-apple-darwin10";
|
||||
projectPart.extraCodeModelFlags = QStringList{"-arch", "x86_64"};
|
||||
|
||||
projectPart.precompiledHeaders = QStringList{TESTDATA_DIR "/compileroptionsbuilder.pch"};
|
||||
projectPart.toolChainMacros = {ProjectExplorer::Macro{"foo", "bar"}};
|
||||
projectPart.projectMacros = {ProjectExplorer::Macro{"projectFoo", "projectBar"}};
|
||||
projectPart.qtVersion = ProjectPart::Qt5;
|
||||
|
||||
projectPart.headerPaths = {HeaderPath{"/tmp/builtin_path", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/tmp/system_path", HeaderPathType::System},
|
||||
HeaderPath{"/tmp/path", HeaderPathType::User}};
|
||||
}
|
||||
|
||||
std::unique_ptr<Project> project{std::make_unique<ProjectExplorer::Project>()};
|
||||
ProjectPart projectPart;
|
||||
CompilerOptionsBuilder compilerOptionsBuilder{projectPart};
|
||||
};
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddToolchainAndProjectMacros)
|
||||
{
|
||||
compilerOptionsBuilder.addToolchainAndProjectMacros();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-Dfoo=bar", "-DprojectFoo=projectBar"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddWordWidth)
|
||||
{
|
||||
compilerOptionsBuilder.addWordWidth();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-m64"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddToolchainFlags)
|
||||
{
|
||||
compilerOptionsBuilder.addToolchainFlags();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-undef"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, HeaderPathOptionsOrder)
|
||||
{
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-nostdlibinc",
|
||||
"-I", QDir::toNativeSeparators("/tmp/path"),
|
||||
"-I", QDir::toNativeSeparators("/tmp/system_path"),
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UseSystemHeader)
|
||||
{
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::UseSystemHeader::Yes);
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-nostdlibinc",
|
||||
"-I", QDir::toNativeSeparators("/tmp/path"),
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/system_path"),
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, ClangHeadersPath)
|
||||
{
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
"7.0.0",
|
||||
"");
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-nostdinc",
|
||||
"-nostdlibinc",
|
||||
"-I", QDir::toNativeSeparators("/tmp/path"),
|
||||
"-I", QDir::toNativeSeparators("/tmp/system_path"),
|
||||
"-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderMacOs)
|
||||
{
|
||||
auto defaultPaths = projectPart.headerPaths;
|
||||
projectPart.headerPaths = {HeaderPath{"/usr/include/c++/4.2.1", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/include/c++/4.2.1/backward", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/local/include", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/include", HeaderPathType::BuiltIn}
|
||||
};
|
||||
projectPart.headerPaths.append(defaultPaths);
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
"7.0.0",
|
||||
"");
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-nostdinc",
|
||||
"-nostdlibinc",
|
||||
"-I", QDir::toNativeSeparators("/tmp/path"),
|
||||
"-I", QDir::toNativeSeparators("/tmp/system_path"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/include/c++/4.2.1"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/include/c++/4.2.1/backward"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/local/include"),
|
||||
"-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", QDir::toNativeSeparators("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/include"),
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, ClangHeadersAndCppIncludesPathsOrderLinux)
|
||||
{
|
||||
projectPart.headerPaths = {HeaderPath{"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/local/include", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/lib/gcc/x86_64-linux-gnu/4.8/include", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/include/x86_64-linux-gnu", HeaderPathType::BuiltIn},
|
||||
HeaderPath{"/usr/include", HeaderPathType::BuiltIn}
|
||||
};
|
||||
projectPart.toolChainTargetTriple = "x86_64-linux-gnu";
|
||||
CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
|
||||
CppTools::UseSystemHeader::No,
|
||||
CppTools::SkipBuiltIn::No,
|
||||
"7.0.0",
|
||||
"");
|
||||
|
||||
compilerOptionsBuilder.addHeaderPathOptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-nostdinc",
|
||||
"-nostdlibinc",
|
||||
"-isystem", QDir::toNativeSeparators("/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"),
|
||||
"-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/local/include"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/include/x86_64-linux-gnu"),
|
||||
"-isystem", QDir::toNativeSeparators("/usr/include")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, NoPrecompiledHeader)
|
||||
{
|
||||
compilerOptionsBuilder.addPrecompiledHeaderOptions(CompilerOptionsBuilder::PchUsage::None);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options().empty(), true);
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UsePrecompiledHeader)
|
||||
{
|
||||
compilerOptionsBuilder.addPrecompiledHeaderOptions(CompilerOptionsBuilder::PchUsage::Use);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre("-include", QDir::toNativeSeparators(TESTDATA_DIR "/compileroptionsbuilder.pch")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddMacros)
|
||||
{
|
||||
compilerOptionsBuilder.addMacros(ProjectExplorer::Macros{ProjectExplorer::Macro{"key", "value"}});
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-Dkey=value"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddTargetTriple)
|
||||
{
|
||||
compilerOptionsBuilder.addTargetTriple();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-target", "x86_64-apple-darwin10"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, EnableCExceptions)
|
||||
{
|
||||
projectPart.languageVersion = CppTools::ProjectPart::C99;
|
||||
|
||||
compilerOptionsBuilder.enableExceptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fexceptions"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, EnableCXXExceptions)
|
||||
{
|
||||
compilerOptionsBuilder.enableExceptions();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fcxx-exceptions", "-fexceptions"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, InsertWrappedQtHeaders)
|
||||
{
|
||||
compilerOptionsBuilder.insertWrappedQtHeaders();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(IsPartOfHeader("wrappedQtHeaders")));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, SetLanguageVersion)
|
||||
{
|
||||
compilerOptionsBuilder.updateLanguageOption(ProjectFile::CXXSource);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "c++"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, HandleLanguageExtension)
|
||||
{
|
||||
projectPart.languageExtensions = ProjectPart::ObjectiveCExtensions;
|
||||
|
||||
compilerOptionsBuilder.updateLanguageOption(ProjectFile::CXXSource);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "objective-c++"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UpdateLanguageVersion)
|
||||
{
|
||||
compilerOptionsBuilder.updateLanguageOption(ProjectFile::CXXSource);
|
||||
|
||||
compilerOptionsBuilder.updateLanguageOption(ProjectFile::CXXHeader);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-x", "c++-header"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddMsvcCompatibilityVersion)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
projectPart.toolChainMacros.append(ProjectExplorer::Macro{"_MSC_FULL_VER", "190000000"});
|
||||
|
||||
compilerOptionsBuilder.addMsvcCompatibilityVersion();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-fms-compatibility-version=19.00"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UndefineCppLanguageFeatureMacrosForMsvc2015)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
projectPart.isMsvc2015Toolchain = true;
|
||||
|
||||
compilerOptionsBuilder.undefineCppLanguageFeatureMacrosForMsvc2015();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-U__cpp_aggregate_bases"}));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddDefineFunctionMacrosMsvc)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
|
||||
compilerOptionsBuilder.addDefineFunctionMacrosMsvc();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-D__FUNCTION__=\"\""}));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, AddProjectConfigFileInclude)
|
||||
{
|
||||
projectPart.projectConfigFile = "dummy_file.h";
|
||||
|
||||
compilerOptionsBuilder.addProjectConfigFileInclude();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), ElementsAre("-include", "dummy_file.h"));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, UndefineClangVersionMacrosForMsvc)
|
||||
{
|
||||
projectPart.toolchainType = ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID;
|
||||
|
||||
compilerOptionsBuilder.undefineClangVersionMacrosForMsvc();
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(), Contains(QString{"-U__clang__"}));
|
||||
}
|
||||
|
||||
TEST_F(CompilerOptionsBuilderTest, BuildAllOptions)
|
||||
{
|
||||
compilerOptionsBuilder.build(ProjectFile::CXXSource, CompilerOptionsBuilder::PchUsage::None);
|
||||
|
||||
ASSERT_THAT(compilerOptionsBuilder.options(),
|
||||
ElementsAre(
|
||||
"-nostdlibinc", "-c", "-m64", "-target", "x86_64-apple-darwin10",
|
||||
"-arch", "x86_64", "-x", "c++", "-std=c++17", "-fcxx-exceptions",
|
||||
"-fexceptions", "-Dfoo=bar", "-DprojectFoo=projectBar", "-undef",
|
||||
"-I", QDir::toNativeSeparators("D:/code/qt-creator/tests/unit/unittest/../../../share/qtcreator/cplusplus/wrappedQtHeaders"),
|
||||
"-I", QDir::toNativeSeparators("D:/code/qt-creator/tests/unit/unittest/../../../share/qtcreator/cplusplus/wrappedQtHeaders/QtCore"),
|
||||
"-I", QDir::toNativeSeparators("/tmp/path"),
|
||||
"-I", QDir::toNativeSeparators("/tmp/system_path"),
|
||||
"-isystem", QDir::toNativeSeparators("/tmp/builtin_path")
|
||||
));
|
||||
}
|
||||
|
0
tests/unit/unittest/data/compileroptionsbuilder.pch
Normal file
0
tests/unit/unittest/data/compileroptionsbuilder.pch
Normal file
@@ -20,6 +20,7 @@ DEFINES += \
|
||||
QT_USE_FAST_CONCATENATION \
|
||||
UNIT_TESTS \
|
||||
DONT_CHECK_MESSAGE_COUNTER \
|
||||
QTC_RESOURCE_DIR=\"R\\\"xxx($$PWD/../../../share/qtcreator)xxx\\\"\" \
|
||||
TESTDATA_DIR=\"R\\\"xxx($$PWD/data)xxx\\\"\"
|
||||
msvc: QMAKE_CXXFLAGS_WARN_ON -= -w34100 # 'unreferenced formal parameter' in MATCHER_* functions
|
||||
win32:DEFINES += ECHOSERVER=\"R\\\"xxx($$OUT_PWD/../echo)xxx\\\"\"
|
||||
@@ -102,6 +103,7 @@ SOURCES += \
|
||||
projectpartqueue-test.cpp \
|
||||
processormanager-test.cpp \
|
||||
taskscheduler-test.cpp \
|
||||
compileroptionsbuilder-test.cpp
|
||||
|
||||
!isEmpty(LIBCLANG_LIBS) {
|
||||
SOURCES += \
|
||||
|
Reference in New Issue
Block a user