Merge remote-tracking branch 'origin/4.8'

Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I87f47cecbb924064296a002fd9446a0627acad8e
This commit is contained in:
Eike Ziller
2018-12-12 09:44:13 +01:00
27 changed files with 214 additions and 140 deletions

View File

@@ -246,17 +246,13 @@ class Dumper(DumperBase):
#warn('TARGET TYPE: %s' % targetType) #warn('TARGET TYPE: %s' % targetType)
if targetType.code == gdb.TYPE_CODE_ARRAY: if targetType.code == gdb.TYPE_CODE_ARRAY:
val = self.Value(self) val = self.Value(self)
val.laddress = toInteger(nativeValue.address)
val.nativeValue = nativeValue
else: else:
# Cast may fail (e.g for arrays, see test for Bug5799) # Cast may fail (e.g for arrays, see test for Bug5799)
val = self.fromNativeValue(nativeValue.cast(targetType)) val = self.fromNativeValue(nativeValue.cast(targetType))
val.type = self.fromNativeType(nativeType)
val.nativeValue = nativeValue
#warn('CREATED TYPEDEF: %s' % val) #warn('CREATED TYPEDEF: %s' % val)
return val else:
val = self.Value(self)
val = self.Value(self)
val.nativeValue = nativeValue val.nativeValue = nativeValue
if not nativeValue.address is None: if not nativeValue.address is None:
val.laddress = toInteger(nativeValue.address) val.laddress = toInteger(nativeValue.address)

View File

@@ -2275,3 +2275,10 @@ def __lldb_init_module(debugger, internal_dict):
if not __name__ == 'qt': if not __name__ == 'qt':
# Make available under global 'qt' name for consistency # Make available under global 'qt' name for consistency
internal_dict['qt'] = internal_dict[__name__] internal_dict['qt'] = internal_dict[__name__]
if __name__ == "lldbbridge":
try:
theDumper = Dumper()
except Exception as error:
print('@\nstate="enginesetupfailed",error="{}"@\n'.format(error))

View File

@@ -28666,7 +28666,7 @@ Preselects a desktop Qt for building the application if available.</source>
</message> </message>
<message> <message>
<source>Empty qmake Project</source> <source>Empty qmake Project</source>
<translation>Пустрой проект qmake</translation> <translation>Пустой проект qmake</translation>
</message> </message>
<message> <message>
<source>Define Project Details</source> <source>Define Project Details</source>

View File

@@ -117,8 +117,11 @@ private:
if (layoutDirection() == Qt::LeftToRight) if (layoutDirection() == Qt::LeftToRight)
rr = viewport()->width() - event->x(); rr = viewport()->width() - event->x();
if (rr < clearButtonSize.width()) { if (rr < clearButtonSize.width()) {
model->removeRow(indexAt(event->pos()).row()); const QModelIndex index = indexAt(event->pos());
return; if (index.isValid()) {
model->removeRow(indexAt(event->pos()).row());
return;
}
} }
} }
QListView::mousePressEvent(event); QListView::mousePressEvent(event);

View File

@@ -142,6 +142,9 @@ QTextCursor wordStartCursor(const QTextCursor &textCursor)
int utf8NthLineOffset(const QTextDocument *textDocument, const QByteArray &buffer, int line) int utf8NthLineOffset(const QTextDocument *textDocument, const QByteArray &buffer, int line)
{ {
if (textDocument->blockCount() < line)
return -1;
if (textDocument->characterCount() == buffer.size() + 1) if (textDocument->characterCount() == buffer.size() + 1)
return textDocument->findBlockByNumber(line - 1).position(); return textDocument->findBlockByNumber(line - 1).position();

View File

@@ -25,6 +25,8 @@
#include "clangcompletionchunkstotextconverter.h" #include "clangcompletionchunkstotextconverter.h"
#include <QtGlobal>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
@@ -70,6 +72,11 @@ void CompletionChunksToTextConverter::setAddSpaces(bool addSpaces)
m_addSpaces = addSpaces; m_addSpaces = addSpaces;
} }
void CompletionChunksToTextConverter::setHonorVerticalSpace(bool honor)
{
m_honorVerticalSpace = honor;
}
void CompletionChunksToTextConverter::setAddExtraVerticalSpaceBetweenBraces( void CompletionChunksToTextConverter::setAddExtraVerticalSpaceBetweenBraces(
bool addExtraVerticalSpaceBetweenBraces) bool addExtraVerticalSpaceBetweenBraces)
{ {
@@ -145,6 +152,8 @@ QString CompletionChunksToTextConverter::convertToName(
{ {
CompletionChunksToTextConverter converter; CompletionChunksToTextConverter converter;
converter.setHonorVerticalSpace(false);
converter.parseChunks(codeCompletionChunks); converter.parseChunks(codeCompletionChunks);
return converter.text(); return converter.text();
@@ -183,6 +192,10 @@ void CompletionChunksToTextConverter::parse(
parsePlaceHolder(codeCompletionChunk); break; parsePlaceHolder(codeCompletionChunk); break;
case CodeCompletionChunk::LeftParen: parseLeftParen(codeCompletionChunk); break; case CodeCompletionChunk::LeftParen: parseLeftParen(codeCompletionChunk); break;
case CodeCompletionChunk::LeftBrace: parseLeftBrace(codeCompletionChunk); break; case CodeCompletionChunk::LeftBrace: parseLeftBrace(codeCompletionChunk); break;
case CodeCompletionChunk::VerticalSpace:
if (!m_honorVerticalSpace)
break;
Q_FALLTHROUGH();
default: parseText(codeCompletionChunk.text); break; default: parseText(codeCompletionChunk.text); break;
} }
} }

View File

@@ -50,6 +50,7 @@ public:
void setAddPlaceHolderPositions(bool addPlaceHolderPositions); void setAddPlaceHolderPositions(bool addPlaceHolderPositions);
void setAddResultType(bool addResultType); void setAddResultType(bool addResultType);
void setAddSpaces(bool addSpaces); void setAddSpaces(bool addSpaces);
void setHonorVerticalSpace(bool honor);
void setAddExtraVerticalSpaceBetweenBraces(bool addExtraVerticalSpaceBetweenBraces); void setAddExtraVerticalSpaceBetweenBraces(bool addExtraVerticalSpaceBetweenBraces);
void setEmphasizeOptional(bool emphasizeOptional); // Only for Html format void setEmphasizeOptional(bool emphasizeOptional); // Only for Html format
void setAddOptional(bool addOptional); void setAddOptional(bool addOptional);
@@ -103,6 +104,7 @@ private:
bool m_addPlaceHolderPositions = false; bool m_addPlaceHolderPositions = false;
bool m_addResultType = false; bool m_addResultType = false;
bool m_addSpaces = false; bool m_addSpaces = false;
bool m_honorVerticalSpace = true;
bool m_addExtraVerticalSpaceBetweenBraces = false; bool m_addExtraVerticalSpaceBetweenBraces = false;
bool m_emphasizeOptional = false; bool m_emphasizeOptional = false;
bool m_addOptional = false; bool m_addOptional = false;

View File

@@ -242,40 +242,43 @@ static QString clangIncludeDirectory(const QString &clangVersion,
#endif #endif
} }
static int lastIncludeIndex(const QStringList &options, const QRegularExpression &includePathRegEx) static QStringList insertResourceDirectory(const QStringList &options,
{ const QString &resourceDir,
int index = options.lastIndexOf(includePathRegEx); bool isMacOs = false)
while (index > 0 && options[index - 1] != includeUserPathOption
&& options[index - 1] != includeSystemPathOption) {
index = options.lastIndexOf(includePathRegEx, index - 1);
}
if (index == 0)
index = -1;
return index;
}
static int includeIndexForResourceDirectory(const QStringList &options, bool isMacOs = false)
{ {
// include/c++, include/g++, libc++\include and libc++abi\include // include/c++, include/g++, libc++\include and libc++abi\include
static const QString cppIncludes = R"((.*[\/\\]include[\/\\].*(g\+\+|c\+\+).*))" static const QString cppIncludes = R"((.*[\/\\]include[\/\\].*(g\+\+|c\+\+).*))"
R"(|(.*libc\+\+[\/\\]include))" R"(|(.*libc\+\+[\/\\]include))"
R"(|(.*libc\+\+abi[\/\\]include))"; R"(|(.*libc\+\+abi[\/\\]include))";
static const QRegularExpression includeRegExp("\\A(" + cppIncludes + ")\\z");
// The same as includeRegExp but also matches /usr/local/include QStringList optionsBeforeResourceDirectory;
static const QRegularExpression includeRegExpMac( QStringList optionsAfterResourceDirectory;
"\\A(" + cppIncludes + R"(|([\/\\]usr[\/\\]local[\/\\]include))" + ")\\z"); QRegularExpression includeRegExp;
if (!isMacOs) {
includeRegExp = QRegularExpression("\\A(" + cppIncludes + ")\\z");
} else {
// The same as includeRegExp but also matches /usr/local/include
includeRegExp = QRegularExpression(
"\\A(" + cppIncludes + R"(|([\/\\]usr[\/\\]local[\/\\]include))" + ")\\z");
}
const int cppIncludeIndex = lastIncludeIndex(options, for (const QString &option : options) {
isMacOs ? includeRegExpMac : includeRegExp); if (option == includeSystemPathOption)
continue;
if (cppIncludeIndex > 0) if (includeRegExp.match(option).hasMatch()) {
return cppIncludeIndex + 1; optionsBeforeResourceDirectory.push_back(includeSystemPathOption);
optionsBeforeResourceDirectory.push_back(option);
} else {
optionsAfterResourceDirectory.push_back(includeSystemPathOption);
optionsAfterResourceDirectory.push_back(option);
}
}
return -1; optionsBeforeResourceDirectory.push_back(includeSystemPathOption);
optionsBeforeResourceDirectory.push_back(resourceDir);
return optionsBeforeResourceDirectory + optionsAfterResourceDirectory;
} }
void CompilerOptionsBuilder::insertWrappedQtHeaders() void CompilerOptionsBuilder::insertWrappedQtHeaders()
@@ -354,20 +357,13 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
// Exclude all built-in includes and Clang resource directory. // Exclude all built-in includes and Clang resource directory.
m_options.prepend("-nostdinc"); m_options.prepend("-nostdinc");
const QString clangIncludePath = clangIncludeDirectory(m_clangVersion, const QString clangIncludePath
m_clangResourceDirectory); = clangIncludeDirectory(m_clangVersion, m_clangResourceDirectory);
const int includeIndexForResourceDir
= includeIndexForResourceDirectory(builtInIncludes,
m_projectPart.toolChainTargetTriple.contains(
"darwin"));
if (includeIndexForResourceDir >= 0) { builtInIncludes = insertResourceDirectory(builtInIncludes,
builtInIncludes.insert(includeIndexForResourceDir, clangIncludePath); clangIncludePath,
builtInIncludes.insert(includeIndexForResourceDir, includeSystemPathOption); m_projectPart.toolChainTargetTriple.contains(
} else { "darwin"));
builtInIncludes.prepend(clangIncludePath);
builtInIncludes.prepend(includeSystemPathOption);
}
} }
m_options.append(builtInIncludes); m_options.append(builtInIncludes);

View File

@@ -242,7 +242,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentProjectTabSettings()
TextEditor::ICodeStylePreferences *codeStylePreferences TextEditor::ICodeStylePreferences *codeStylePreferences
= editorConfiguration->codeStyle(CppTools::Constants::CPP_SETTINGS_ID); = editorConfiguration->codeStyle(CppTools::Constants::CPP_SETTINGS_ID);
QTC_ASSERT(codeStylePreferences, return currentGlobalTabSettings()); QTC_ASSERT(codeStylePreferences, return currentGlobalTabSettings());
return codeStylePreferences->tabSettings(); return codeStylePreferences->currentTabSettings();
} }
TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings() TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings()
@@ -251,7 +251,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings()
= CppTools::CppToolsSettings::instance()->cppCodeStyle(); = CppTools::CppToolsSettings::instance()->cppCodeStyle();
QTC_ASSERT(cppCodeStylePreferences, return TextEditor::TabSettings()); QTC_ASSERT(cppCodeStylePreferences, return TextEditor::TabSettings());
return cppCodeStylePreferences->tabSettings(); return cppCodeStylePreferences->currentTabSettings();
} }

View File

@@ -418,6 +418,8 @@ public:
m_watchHandler.cleanup(); m_watchHandler.cleanup();
m_engine->showMessage(tr("Debugger finished."), StatusBar); m_engine->showMessage(tr("Debugger finished."), StatusBar);
m_engine->setState(DebuggerFinished); // Also destroys views. m_engine->setState(DebuggerFinished); // Also destroys views.
if (boolSetting(SwitchModeOnExit))
EngineManager::deactivateDebugMode();
} }
void scheduleResetLocation() void scheduleResetLocation()
@@ -2619,7 +2621,10 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp)
"experience for this binary format.").arg(preferredDebugger); "experience for this binary format.").arg(preferredDebugger);
break; break;
} }
if (warnOnRelease && rp.cppEngineType == CdbEngineType) { if (warnOnRelease
&& rp.cppEngineType == CdbEngineType
&& rp.startMode != AttachToRemoteServer) {
QTC_ASSERT(!rp.symbolFile.isEmpty(), return);
if (!rp.symbolFile.endsWith(".exe", Qt::CaseInsensitive)) if (!rp.symbolFile.endsWith(".exe", Qt::CaseInsensitive))
rp.symbolFile.append(".exe"); rp.symbolFile.append(".exe");
QString errorMessage; QString errorMessage;

View File

@@ -26,6 +26,7 @@
#include "debuggermainwindow.h" #include "debuggermainwindow.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggerinternalconstants.h" #include "debuggerinternalconstants.h"
#include "enginemanager.h"
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
@@ -696,7 +697,7 @@ void Perspective::addWindow(QWidget *widget,
void Perspective::select() void Perspective::select()
{ {
ModeManager::activateMode(Debugger::Constants::MODE_DEBUG); Debugger::Internal::EngineManager::activateDebugMode();
if (Perspective::currentPerspective() == this) if (Perspective::currentPerspective() == this)
return; return;
theMainWindow->d->selectPerspective(this); theMainWindow->d->selectPerspective(this);

View File

@@ -706,7 +706,6 @@ public:
void runScheduled(); void runScheduled();
void attachCore(); void attachCore();
void runControlFinished(DebuggerRunTool *runTool);
void remoteCommand(const QStringList &options); void remoteCommand(const QStringList &options);
void dumpLog(); void dumpLog();

View File

@@ -422,6 +422,18 @@ void EngineManager::activateDebugMode()
} }
} }
void EngineManager::deactivateDebugMode()
{
if (ModeManager::currentModeId() == Constants::MODE_DEBUG && d->m_previousMode.isValid()) {
// If stopping the application also makes Qt Creator active (as the
// "previously active application"), doing the switch synchronously
// leads to funny effects with floating dock widgets
const Core::Id mode = d->m_previousMode;
QTimer::singleShot(0, d, [mode]() { ModeManager::activateMode(mode); });
d->m_previousMode = Id();
}
}
bool EngineManager::isLastOf(const QString &type) bool EngineManager::isLastOf(const QString &type)
{ {
int count = 0; int count = 0;

View File

@@ -49,6 +49,7 @@ public:
static void unregisterEngine(DebuggerEngine *engine); static void unregisterEngine(DebuggerEngine *engine);
static void activateEngine(DebuggerEngine *engine); static void activateEngine(DebuggerEngine *engine);
static void activateDebugMode(); static void activateDebugMode();
static void deactivateDebugMode();
static bool isLastOf(const QString &type); static bool isLastOf(const QString &type);
static QList<QPointer<DebuggerEngine> > engines(); static QList<QPointer<DebuggerEngine> > engines();

View File

@@ -2488,15 +2488,17 @@ void GdbEngine::updateBreakpoint(const Breakpoint &bp)
QTC_ASSERT(state2 == BreakpointUpdateProceeding, qDebug() << state2); QTC_ASSERT(state2 == BreakpointUpdateProceeding, qDebug() << state2);
DebuggerCommand cmd; DebuggerCommand cmd;
if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) { // FIXME: See QTCREATORBUG-21611, QTCREATORBUG-21616
// The only way to change this seems to be to re-set the bp completely. // if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) {
cmd.function = "-break-delete " + bpnr; // // The only way to change this seems to be to re-set the bp completely.
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); }; // cmd.function = "-break-delete " + bpnr;
} else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) { // cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); };
// The only way to change this seems to be to re-set the bp completely. // } else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) {
cmd.function = "-break-delete " + bpnr; // // The only way to change this seems to be to re-set the bp completely.
cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; // cmd.function = "-break-delete " + bpnr;
} else if (requested.command != bp->command()) { // cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); };
// } else if
if (requested.command != bp->command()) {
cmd.function = "-break-commands " + bpnr; cmd.function = "-break-commands " + bpnr;
for (QString command : requested.command.split('\n')) { for (QString command : requested.command.split('\n')) {
if (!command.isEmpty()) { if (!command.isEmpty()) {

View File

@@ -191,6 +191,11 @@ void LldbEngine::abortDebuggerProcess()
notifyEngineShutdownFinished(); notifyEngineShutdownFinished();
} }
static QString adapterStartFailed()
{
return LldbEngine::tr("Adapter start failed.");
}
void LldbEngine::setupEngine() void LldbEngine::setupEngine()
{ {
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
@@ -211,7 +216,7 @@ void LldbEngine::setupEngine()
notifyEngineSetupFailed(); notifyEngineSetupFailed();
showMessage("ADAPTER START FAILED"); showMessage("ADAPTER START FAILED");
if (!msg.isEmpty()) if (!msg.isEmpty())
ICore::showWarningWithOptions(tr("Adapter start failed."), msg); ICore::showWarningWithOptions(adapterStartFailed(), msg);
return; return;
} }
m_lldbProc.waitForReadyRead(1000); m_lldbProc.waitForReadyRead(1000);
@@ -222,9 +227,8 @@ void LldbEngine::setupEngine()
ICore::resourcePath().toLocal8Bit() + "/debugger/"; ICore::resourcePath().toLocal8Bit() + "/debugger/";
m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n"); m_lldbProc.write("script sys.path.insert(1, '" + dumperSourcePath + "')\n");
// This triggers reportState("enginesetupok") or "enginesetupfailed":
m_lldbProc.write("script from lldbbridge import *\n"); m_lldbProc.write("script from lldbbridge import *\n");
m_lldbProc.write("script print(dir())\n");
m_lldbProc.write("script theDumper = Dumper()\n"); // This triggers reportState("enginesetupok")
QString commands = nativeStartupCommands(); QString commands = nativeStartupCommands();
if (!commands.isEmpty()) if (!commands.isEmpty())
@@ -384,7 +388,7 @@ void LldbEngine::handleResponse(const QString &response)
cmd.callback(response); cmd.callback(response);
} }
} else if (name == "state") } else if (name == "state")
handleStateNotification(item); handleStateNotification(all);
else if (name == "location") else if (name == "location")
handleLocationNotification(item); handleLocationNotification(item);
else if (name == "output") else if (name == "output")
@@ -830,9 +834,9 @@ void LldbEngine::readLldbStandardOutput()
} }
} }
void LldbEngine::handleStateNotification(const GdbMi &reportedState) void LldbEngine::handleStateNotification(const GdbMi &item)
{ {
QString newState = reportedState.data(); const QString newState = item["state"].data();
if (newState == "running") if (newState == "running")
notifyInferiorRunOk(); notifyInferiorRunOk();
else if (newState == "inferiorrunfailed") else if (newState == "inferiorrunfailed")
@@ -867,9 +871,11 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState)
notifyInferiorIll(); notifyInferiorIll();
else if (newState == "enginesetupok") else if (newState == "enginesetupok")
notifyEngineSetupOk(); notifyEngineSetupOk();
else if (newState == "enginesetupfailed") else if (newState == "enginesetupfailed") {
Core::AsynchronousMessageBox::critical(adapterStartFailed(),
item["error"].data());
notifyEngineSetupFailed(); notifyEngineSetupFailed();
else if (newState == "enginerunfailed") } else if (newState == "enginerunfailed")
notifyEngineRunFailed(); notifyEngineRunFailed();
else if (newState == "enginerunandinferiorrunok") { else if (newState == "enginerunandinferiorrunok") {
if (runParameters().continueAfterAttach) if (runParameters().continueAfterAttach)

View File

@@ -117,7 +117,7 @@ private:
void readLldbStandardOutput(); void readLldbStandardOutput();
void readLldbStandardError(); void readLldbStandardError();
void handleStateNotification(const GdbMi &state); void handleStateNotification(const GdbMi &item);
void handleLocationNotification(const GdbMi &location); void handleLocationNotification(const GdbMi &location);
void handleOutputNotification(const GdbMi &output); void handleOutputNotification(const GdbMi &output);

View File

@@ -34,6 +34,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <cmath>
#include <limits> #include <limits>
namespace QmlDesigner { namespace QmlDesigner {
@@ -282,7 +283,7 @@ void QmlTimelineKeyframeGroup::moveAllKeyframes(qreal offset)
for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) { for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) {
auto property = childNode.variantProperty("frame"); auto property = childNode.variantProperty("frame");
if (property.isValid()) if (property.isValid())
property.setValue(property.value().toReal() + offset); property.setValue(std::round(property.value().toReal() + offset));
} }
} }
@@ -292,7 +293,7 @@ void QmlTimelineKeyframeGroup::scaleAllKeyframes(qreal factor)
auto property = childNode.variantProperty("frame"); auto property = childNode.variantProperty("frame");
if (property.isValid()) if (property.isValid())
property.setValue(property.value().toReal() * factor); property.setValue(std::round(property.value().toReal() * factor));
} }
} }

View File

@@ -427,7 +427,7 @@ void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaul
syncComboWithSettings(d->m_filterCombo, d->m_filterSetting); syncComboWithSettings(d->m_filterCombo, d->m_filterSetting);
QStringList exclusionFilters = settings->value("exclusionFilters").toStringList(); QStringList exclusionFilters = settings->value("exclusionFilters").toStringList();
if (exclusionFilters.isEmpty()) if (!exclusionFilters.contains(defaultExclusionFilter))
exclusionFilters << defaultExclusionFilter; exclusionFilters << defaultExclusionFilter;
const QVariant currentExclusionFilter = settings->value("currentExclusionFilter"); const QVariant currentExclusionFilter = settings->value("currentExclusionFilter");
d->m_exclusionSetting = currentExclusionFilter.isValid() ? currentExclusionFilter.toString() d->m_exclusionSetting = currentExclusionFilter.isValid() ? currentExclusionFilter.toString()

View File

@@ -218,7 +218,7 @@ void FindInFiles::writeSettings(QSettings *settings)
void FindInFiles::readSettings(QSettings *settings) void FindInFiles::readSettings(QSettings *settings)
{ {
settings->beginGroup(QLatin1String("FindInFiles")); settings->beginGroup(QLatin1String("FindInFiles"));
readCommonSettings(settings, "*.cpp,*.h", "*/.git/*,*/.cvs/*,*/.svn/*"); readCommonSettings(settings, "*.cpp,*.h", "*/.git/*,*/.cvs/*,*/.svn/*,*.autosave");
settings->endGroup(); settings->endGroup();
} }

View File

@@ -406,12 +406,9 @@ bool FontSettings::loadColorScheme(const QString &fileName,
if (!m_scheme.contains(id)) { if (!m_scheme.contains(id)) {
Format format; Format format;
const Format &descFormat = desc.format(); const Format &descFormat = desc.format();
if (descFormat == format && m_scheme.contains(C_TEXT)) { // Default fallback for background and foreground is C_TEXT, which is set through
// Default format -> Text // the editor's palette, i.e. we leave these as invalid colors in that case
const Format textFormat = m_scheme.formatFor(C_TEXT); if (descFormat != format || !m_scheme.contains(C_TEXT)) {
format.setForeground(textFormat.foreground());
format.setBackground(textFormat.background());
} else {
format.setForeground(descFormat.foreground()); format.setForeground(descFormat.foreground());
format.setBackground(descFormat.background()); format.setBackground(descFormat.background());
} }

View File

@@ -4111,12 +4111,12 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
if (!blockUserData) if (!blockUserData)
return; return;
TextMarks marks = blockUserData->marks(); TextMarks marks = Utils::filtered(blockUserData->marks(), [](const TextMark* mark){
const bool annotationsVisible = Utils::anyOf(marks, [](const TextMark* mark) {
return !mark->lineAnnotation().isEmpty(); return !mark->lineAnnotation().isEmpty();
}); });
const bool annotationsVisible = !marks.isEmpty();
if (updateAnnotationBounds(blockUserData, data.documentLayout, annotationsVisible) if (updateAnnotationBounds(blockUserData, data.documentLayout, annotationsVisible)
|| !annotationsVisible) { || !annotationsVisible) {
return; return;

View File

@@ -1990,7 +1990,7 @@ void tst_Dumpers::dumper_data()
+ CoreProfile() + CoreProfile()
+ Check("f1", "a (1)", TypeDef("QFlags<enum Foo>", "FooFlags")) % CdbEngine + Check("f1", "a (1)", TypeDef("QFlags<enum Foo>", "FooFlags")) % CdbEngine
+ Check("f1", "a (0x0001)", "FooFlags") % NoCdbEngine + Check("f1", "a (0x0001)", "FooFlags") % NoCdbEngine
+ Check("f2", "a | b (0x0003)", "FooFlags") % GdbEngine; + Check("f2", "(a | b) (0x0003)", "FooFlags") % GdbEngine;
QTest::newRow("QDateTime") QTest::newRow("QDateTime")
<< Data("#include <QDateTime>\n", << Data("#include <QDateTime>\n",

View File

@@ -77,8 +77,9 @@ def main():
proposalToolTips) proposalToolTips)
correction = testData.field(record, "correction") correction = testData.field(record, "correction")
if correction == 'all': if correction == 'all':
test.compare(len(needCorrection), len(proposalToolTips), __verifyLineUnderCursor__(cppwindow, record)
"Verifying whether all proposal need correction.") test.compare(len(needCorrection), 0,
"Verifying whether operator has been already corrected.")
elif correction == 'mixed': elif correction == 'mixed':
test.verify(len(proposalToolTips) > len(needCorrection) > 0, test.verify(len(proposalToolTips) > len(needCorrection) > 0,
"Verifying whether some of the proposals need correction.") "Verifying whether some of the proposals need correction.")

View File

@@ -46,8 +46,9 @@ def commit(commitMessage, expectedLogMessage, uncheckUntracked=False):
checkOrFixCommitterInformation('invalidEmailLabel', 'emailLineEdit', 'nobody@nowhere.com') checkOrFixCommitterInformation('invalidEmailLabel', 'emailLineEdit', 'nobody@nowhere.com')
clickButton(waitForObject(":splitter.Commit File(s)_VcsBase::QActionPushButton")) clickButton(waitForObject(":splitter.Commit File(s)_VcsBase::QActionPushButton"))
vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' " vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}").plainText "window=':Qt Creator_Core::Internal::MainWindow'}")
test.verify(expectedLogMessage in str(vcsLog), "Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog)) test.verify(waitFor('expectedLogMessage in str(vcsLog.plainText)', 2000),
"Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog.plainText))
return commitMessage return commitMessage
def verifyItemsInGit(commitMessages): def verifyItemsInGit(commitMessages):

View File

@@ -235,51 +235,16 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux)
} }
TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) 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::UseToolchainMacros::Yes,
CppTools::UseTweakedHeaderPaths::Yes,
CppTools::UseLanguageDefines::No,
"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 = { projectPart.headerPaths = {
HeaderPath{ HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include", HeaderPathType::BuiltIn},
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android", HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++",
HeaderPathType::BuiltIn}, HeaderPathType::BuiltIn},
HeaderPath{ HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32",
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include", HeaderPathType::BuiltIn},
HeaderPathType::BuiltIn}, HeaderPath{"C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward",
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}}; HeaderPathType::BuiltIn}};
projectPart.toolChainTargetTriple = "i686-linux-android"; projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu";
CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart,
CppTools::UseSystemHeader::No, CppTools::UseSystemHeader::No,
CppTools::UseToolchainMacros::Yes, CppTools::UseToolchainMacros::Yes,
@@ -296,22 +261,69 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang)
"-nostdinc", "-nostdinc",
"-nostdlibinc", "-nostdlibinc",
"-isystem", "-isystem",
QDir::toNativeSeparators( QDir::toNativeSeparators("C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++"),
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android"),
"-isystem", "-isystem",
QDir::toNativeSeparators( QDir::toNativeSeparators(
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include"), "C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32"),
"-isystem", "-isystem",
QDir::toNativeSeparators( QDir::toNativeSeparators(
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include"), "C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward"),
"-isystem",
QDir::toNativeSeparators(
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include"),
"-isystem", "-isystem",
QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""),
"-isystem", "-isystem",
QDir::toNativeSeparators( QDir::toNativeSeparators("C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include")));
"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include"))); }
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::UseToolchainMacros::Yes,
CppTools::UseTweakedHeaderPaths::Yes,
CppTools::UseLanguageDefines::No,
"7.0.0",
"");
compilerOptionsBuilder.addHeaderPathOptions();
ASSERT_THAT(
compilerOptionsBuilder.options(),
ElementsAre("-nostdinc",
"-nostdlibinc",
"-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/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/i686-linux-android"),
"-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/sysroot/usr/include")));
} }
TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader) TEST_F(CompilerOptionsBuilder, NoPrecompiledHeader)

View File

@@ -256,7 +256,7 @@ TEST_F(CompletionChunksToTextConverter, Enumeration)
ASSERT_THAT(converter.text(), QStringLiteral("Class")); ASSERT_THAT(converter.text(), QStringLiteral("Class"));
} }
TEST_F(CompletionChunksToTextConverter, Switch) TEST_F(CompletionChunksToTextConverter, SwitchAsKeyword)
{ {
CodeCompletionChunks completionChunks({switchName, CodeCompletionChunks completionChunks({switchName,
leftParen, leftParen,
@@ -273,6 +273,22 @@ TEST_F(CompletionChunksToTextConverter, Switch)
ASSERT_THAT(converter.placeholderPositions().at(0), 8); ASSERT_THAT(converter.placeholderPositions().at(0), 8);
} }
TEST_F(CompletionChunksToTextConverter, SwitchAsName)
{
CodeCompletionChunks completionChunks({switchName,
leftParen,
condition,
rightParen,
leftBrace,
verticalSpace,
rightBrace});
const QString text = ClangCodeModel::Internal::CompletionChunksToTextConverter::convertToName(
completionChunks);
ASSERT_THAT(text, QStringLiteral("switch(){}"));
}
TEST_F(CompletionChunksToTextConverter, For) TEST_F(CompletionChunksToTextConverter, For)
{ {
CodeCompletionChunks completionChunks({forName, CodeCompletionChunks completionChunks({forName,