From c4a3b770c73bea6597b248c822042e60b0ba5961 Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Mon, 26 Nov 2018 15:29:43 +0100 Subject: [PATCH 01/20] QmlDesigner: Transform keyframes to integer positions Task-number: QDS-339 Change-Id: Iabfba5ef2ea78d86054de174a30c4ef8965dee34 Reviewed-by: Thomas Hartmann --- .../designercore/model/qmltimelinekeyframegroup.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp index 35ff98710ca..8a6defa4694 100644 --- a/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmltimelinekeyframegroup.cpp @@ -34,6 +34,7 @@ #include +#include #include namespace QmlDesigner { @@ -282,7 +283,7 @@ void QmlTimelineKeyframeGroup::moveAllKeyframes(qreal offset) for (const ModelNode &childNode : modelNode().defaultNodeListProperty().toModelNodeList()) { auto property = childNode.variantProperty("frame"); 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"); if (property.isValid()) - property.setValue(property.value().toReal() * factor); + property.setValue(std::round(property.value().toReal() * factor)); } } From 57715c7f66fb66d2aabeb78232944ae11b29794b Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 5 Dec 2018 09:56:30 +0100 Subject: [PATCH 02/20] Debugger: do not show warning on remote debugging session Do not show a warning about debugging a release build when attaching to a remote cdb debug session. Change-Id: Icfafe13efc873cafc98466d3ab2cd2c344796e0e Reviewed-by: hjk --- src/plugins/debugger/debuggerengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 5193bed8c07..eaafa9b9d3f 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -2638,7 +2638,10 @@ void CppDebuggerEngine::validateRunParameters(DebuggerRunParameters &rp) "experience for this binary format.").arg(preferredDebugger); 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)) rp.symbolFile.append(".exe"); QString errorMessage; From 9e17bd1bf0037e06c3f89d92d58c6c4b82cabf00 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 3 Dec 2018 16:09:08 +0100 Subject: [PATCH 03/20] Clang: Avoid multi-line display name for completion items These come directly from clang. If converting for display in the completion list widget, skip new line chunks. Fixes: QTCREATORBUG-21600 Change-Id: I83749ed73fa68658ec073d97177768f59a87cebf Reviewed-by: David Schulz Reviewed-by: Ivan Donchevskii --- .../clangcompletionchunkstotextconverter.cpp | 13 +++++++++++++ .../clangcompletionchunkstotextconverter.h | 2 ++ .../completionchunkstotextconverter-test.cpp | 18 +++++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp index e8ca9f67abd..5af48386bd2 100644 --- a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp +++ b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.cpp @@ -25,6 +25,8 @@ #include "clangcompletionchunkstotextconverter.h" +#include + #include #include @@ -70,6 +72,11 @@ void CompletionChunksToTextConverter::setAddSpaces(bool addSpaces) m_addSpaces = addSpaces; } +void CompletionChunksToTextConverter::setHonorVerticalSpace(bool honor) +{ + m_honorVerticalSpace = honor; +} + void CompletionChunksToTextConverter::setAddExtraVerticalSpaceBetweenBraces( bool addExtraVerticalSpaceBetweenBraces) { @@ -145,6 +152,8 @@ QString CompletionChunksToTextConverter::convertToName( { CompletionChunksToTextConverter converter; + converter.setHonorVerticalSpace(false); + converter.parseChunks(codeCompletionChunks); return converter.text(); @@ -183,6 +192,10 @@ void CompletionChunksToTextConverter::parse( parsePlaceHolder(codeCompletionChunk); break; case CodeCompletionChunk::LeftParen: parseLeftParen(codeCompletionChunk); break; case CodeCompletionChunk::LeftBrace: parseLeftBrace(codeCompletionChunk); break; + case CodeCompletionChunk::VerticalSpace: + if (!m_honorVerticalSpace) + break; + Q_FALLTHROUGH(); default: parseText(codeCompletionChunk.text); break; } } diff --git a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h index 27eccbcf169..88654ed3fd9 100644 --- a/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h +++ b/src/plugins/clangcodemodel/clangcompletionchunkstotextconverter.h @@ -50,6 +50,7 @@ public: void setAddPlaceHolderPositions(bool addPlaceHolderPositions); void setAddResultType(bool addResultType); void setAddSpaces(bool addSpaces); + void setHonorVerticalSpace(bool honor); void setAddExtraVerticalSpaceBetweenBraces(bool addExtraVerticalSpaceBetweenBraces); void setEmphasizeOptional(bool emphasizeOptional); // Only for Html format void setAddOptional(bool addOptional); @@ -103,6 +104,7 @@ private: bool m_addPlaceHolderPositions = false; bool m_addResultType = false; bool m_addSpaces = false; + bool m_honorVerticalSpace = true; bool m_addExtraVerticalSpaceBetweenBraces = false; bool m_emphasizeOptional = false; bool m_addOptional = false; diff --git a/tests/unit/unittest/completionchunkstotextconverter-test.cpp b/tests/unit/unittest/completionchunkstotextconverter-test.cpp index be911c7a765..e54161f8363 100644 --- a/tests/unit/unittest/completionchunkstotextconverter-test.cpp +++ b/tests/unit/unittest/completionchunkstotextconverter-test.cpp @@ -256,7 +256,7 @@ TEST_F(CompletionChunksToTextConverter, Enumeration) ASSERT_THAT(converter.text(), QStringLiteral("Class")); } -TEST_F(CompletionChunksToTextConverter, Switch) +TEST_F(CompletionChunksToTextConverter, SwitchAsKeyword) { CodeCompletionChunks completionChunks({switchName, leftParen, @@ -273,6 +273,22 @@ TEST_F(CompletionChunksToTextConverter, Switch) 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) { CodeCompletionChunks completionChunks({forName, From 7a77ac5dd1f02cc91c57f549b8711bbcc5ea5a71 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 23 Nov 2018 11:36:42 +0100 Subject: [PATCH 04/20] Do not search our own autosave files by default When doing a "Files in File System" search. Also make sure that the default filter is always available in the drop down. Fixes: QTCREATORBUG-21541 Change-Id: Id8b315691b78e5d956cebf73067683dea8f8ca51 Reviewed-by: David Schulz --- src/plugins/texteditor/basefilefind.cpp | 2 +- src/plugins/texteditor/findinfiles.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index fbbdaef8266..39e85f50311 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -427,7 +427,7 @@ void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaul syncComboWithSettings(d->m_filterCombo, d->m_filterSetting); QStringList exclusionFilters = settings->value("exclusionFilters").toStringList(); - if (exclusionFilters.isEmpty()) + if (!exclusionFilters.contains(defaultExclusionFilter)) exclusionFilters << defaultExclusionFilter; const QVariant currentExclusionFilter = settings->value("currentExclusionFilter"); d->m_exclusionSetting = currentExclusionFilter.isValid() ? currentExclusionFilter.toString() diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp index 7d7c1efb5ca..8d461038700 100644 --- a/src/plugins/texteditor/findinfiles.cpp +++ b/src/plugins/texteditor/findinfiles.cpp @@ -220,7 +220,7 @@ void FindInFiles::writeSettings(QSettings *settings) void FindInFiles::readSettings(QSettings *settings) { settings->beginGroup(QLatin1String("FindInFiles")); - readCommonSettings(settings, "*.cpp,*.h", "*/.git/*,*/.cvs/*,*/.svn/*"); + readCommonSettings(settings, "*.cpp,*.h", "*/.git/*,*/.cvs/*,*/.svn/*,*.autosave"); settings->endGroup(); } From b79c0628e5e117d6795ecaaf1028b544a1f4727d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 10 Dec 2018 08:26:05 +0100 Subject: [PATCH 05/20] Bump version to 4.8.1 Change-Id: Ic5447ccb1e0a5e9b181d4210b2c84b526681c6da Reviewed-by: Eike Ziller --- qbs/modules/qtc/qtc.qbs | 4 ++-- qtcreator.pri | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 9bfcc77a98f..5c3afa9c1e0 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -4,10 +4,10 @@ import qbs.FileInfo import "qtc.js" as HelperFunctions Module { - property string qtcreator_display_version: '4.8.0' + property string qtcreator_display_version: '4.8.1' property string ide_version_major: '4' property string ide_version_minor: '8' - property string ide_version_release: '0' + property string ide_version_release: '1' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release diff --git a/qtcreator.pri b/qtcreator.pri index d65ede07de7..bfc49972784 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -1,10 +1,10 @@ !isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included") QTCREATOR_PRI_INCLUDED = 1 -QTCREATOR_VERSION = 4.8.0 +QTCREATOR_VERSION = 4.8.1 QTCREATOR_COMPAT_VERSION = 4.8.0 VERSION = $$QTCREATOR_VERSION -QTCREATOR_DISPLAY_VERSION = 4.8.0 +QTCREATOR_DISPLAY_VERSION = 4.8.1 QTCREATOR_COPYRIGHT_YEAR = 2018 BINARY_ARTIFACTS_BRANCH = 4.8 From 3a4a53ee1cfe595f959e9bcc90beb760db980533 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 3 Dec 2018 09:35:44 +0100 Subject: [PATCH 06/20] Utils: Do not crash when clicking in empty line of HistoryCompleter Removing lines from a HistoryCompleter can result in a crash if the mouse click happens on an empty line. Change-Id: I02ee7c4705e1a4bc6b63ccdae207b5078b03360e Reviewed-by: Eike Ziller --- src/libs/utils/historycompleter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/historycompleter.cpp b/src/libs/utils/historycompleter.cpp index 8657374f776..fa037ddd612 100644 --- a/src/libs/utils/historycompleter.cpp +++ b/src/libs/utils/historycompleter.cpp @@ -117,8 +117,11 @@ private: if (layoutDirection() == Qt::LeftToRight) rr = viewport()->width() - event->x(); if (rr < clearButtonSize.width()) { - model->removeRow(indexAt(event->pos()).row()); - return; + const QModelIndex index = indexAt(event->pos()); + if (index.isValid()) { + model->removeRow(indexAt(event->pos()).row()); + return; + } } } QListView::mousePressEvent(event); From 318b83587ffd3a4ca15c527228ca47c412dd593a Mon Sep 17 00:00:00 2001 From: David Schulz Date: Tue, 4 Dec 2018 09:56:59 +0100 Subject: [PATCH 07/20] TextEditor: fix painting annotations The painting of annotations for one line will be aborted as soon as we hit the first text mark that returns an empty bounding rect for the annotation. This results in no painting at all when having a line with multiple text marks with and without annotation. Prefilter the text marks to make sure we only try to paint text marks with an annotation. Change-Id: I4f07127fafe935b2ad4ed418b326b6f2ab5b1c50 Fixes: QTCREATORBUG-21628 Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 47beba57068..8b03581a403 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4106,12 +4106,12 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data, if (!blockUserData) return; - TextMarks marks = blockUserData->marks(); - - const bool annotationsVisible = Utils::anyOf(marks, [](const TextMark* mark) { + TextMarks marks = Utils::filtered(blockUserData->marks(), [](const TextMark* mark){ return !mark->lineAnnotation().isEmpty(); }); + const bool annotationsVisible = !marks.isEmpty(); + if (updateAnnotationBounds(blockUserData, data.documentLayout, annotationsVisible) || !annotationsVisible) { return; From 0eafe28bd16f5b2507f0fe219e37f18d21e98cf1 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 6 Dec 2018 07:46:54 +0100 Subject: [PATCH 08/20] Tests: Correct expectation Broke with 84576d30986f. Change-Id: Ib03a44f9864c1e2072ecd4b98eb3c2ffef5741d3 Reviewed-by: Orgad Shaneh Reviewed-by: hjk --- tests/auto/debugger/tst_dumpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 89d54ab1bba..76b23814bb7 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -1990,7 +1990,7 @@ void tst_Dumpers::dumper_data() + CoreProfile() + Check("f1", "a (1)", TypeDef("QFlags", "FooFlags")) % CdbEngine + Check("f1", "a (0x0001)", "FooFlags") % NoCdbEngine - + Check("f2", "a | b (0x0003)", "FooFlags") % GdbEngine; + + Check("f2", "(a | b) (0x0003)", "FooFlags") % GdbEngine; QTest::newRow("QDateTime") << Data("#include \n", From 4cb4b7ba993575ce43e0786454625501012d5500 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 30 Nov 2018 01:25:17 +0200 Subject: [PATCH 09/20] GDB: Fix address resolving for typedefed types Reported upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=23936 Fixes: QTCREATORBUG-21602 Change-Id: I0592679a6b5c4821175ef8e97e2206e0ac0be44d Reviewed-by: hjk --- share/qtcreator/debugger/gdbbridge.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index cdde71b3ff3..c6e6adc55fe 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -246,17 +246,13 @@ class Dumper(DumperBase): #warn('TARGET TYPE: %s' % targetType) if targetType.code == gdb.TYPE_CODE_ARRAY: val = self.Value(self) - val.laddress = toInteger(nativeValue.address) - val.nativeValue = nativeValue else: # Cast may fail (e.g for arrays, see test for Bug5799) val = self.fromNativeValue(nativeValue.cast(targetType)) - val.type = self.fromNativeType(nativeType) - val.nativeValue = nativeValue #warn('CREATED TYPEDEF: %s' % val) - return val + else: + val = self.Value(self) - val = self.Value(self) val.nativeValue = nativeValue if not nativeValue.address is None: val.laddress = toInteger(nativeValue.address) From f1e929f0e75a928650c1b257783fd0a9eb8b450c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 10 Dec 2018 10:36:28 +0100 Subject: [PATCH 10/20] Color schemes: Fix wrong colors for unset values Defaulting to C_TEXT in that case is correct, but the values for C_TEXT are set via the palette, so other display features like the current line highlighting and the block visualization, which are painted _below_ the text, are not overridden. So, the correct way for a style to set the same foreground and background colors as C_TEXT, is to leave these colors unset. Fixes: QTCREATORBUG-21661 Change-Id: I8cdb73e8edc5e3883e1ef107bd1c2b29e6d75b9c Reviewed-by: Marco Bubke Reviewed-by: David Schulz --- src/plugins/texteditor/fontsettings.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp index 9c6667d00c5..bc8d8c4d1a8 100644 --- a/src/plugins/texteditor/fontsettings.cpp +++ b/src/plugins/texteditor/fontsettings.cpp @@ -406,12 +406,9 @@ bool FontSettings::loadColorScheme(const QString &fileName, if (!m_scheme.contains(id)) { Format format; const Format &descFormat = desc.format(); - if (descFormat == format && m_scheme.contains(C_TEXT)) { - // Default format -> Text - const Format textFormat = m_scheme.formatFor(C_TEXT); - format.setForeground(textFormat.foreground()); - format.setBackground(textFormat.background()); - } else { + // Default fallback for background and foreground is C_TEXT, which is set through + // the editor's palette, i.e. we leave these as invalid colors in that case + if (descFormat != format || !m_scheme.contains(C_TEXT)) { format.setForeground(descFormat.foreground()); format.setBackground(descFormat.background()); } From 84f3e174336100365c5c2c51873c3425533d544f Mon Sep 17 00:00:00 2001 From: Haxor Leet Date: Mon, 10 Dec 2018 17:02:22 +0300 Subject: [PATCH 11/20] Fix typo in russian translation of 'Empty qmake Project' Change-Id: I4e0d4da98de94a0649ec5319d3e6e71319b778c2 Reviewed-by: Ivan Donchevskii Reviewed-by: Oswald Buddenhagen --- share/qtcreator/translations/qtcreator_ru.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index c2dc93dd48a..12099db2d0a 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -28666,7 +28666,7 @@ Preselects a desktop Qt for building the application if available. Empty qmake Project - Пустрой проект qmake + Пустой проект qmake Define Project Details From 77ad54a6efad72e4c968d52198ad79e1ce540dc6 Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Mon, 10 Dec 2018 04:07:31 -0800 Subject: [PATCH 12/20] Debugger: Remove obsolete function declation Change-Id: Ic528f0a97341773093822089bcc66f096f5e2327 Reviewed-by: hjk --- src/plugins/debugger/debuggerplugin.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index c17863dc8f6..3f7b01d2bdd 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -706,7 +706,6 @@ public: void runScheduled(); void attachCore(); - void runControlFinished(DebuggerRunTool *runTool); void remoteCommand(const QStringList &options); void dumpLog(); From 867befc5aed42f9b3e57231e14a6a0aa430c5591 Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Sat, 8 Dec 2018 00:01:42 -0800 Subject: [PATCH 13/20] Debugger: Fix switching to previous mode on exit This behavior was broken with refactoring done in commit 3b5ecac238b87615b44b27375cef0b4f1d4637e4. This has two main components: 1. Perspective::select() needs to call EngineManager::activateDebugMode() in order to save the previous mode. 2. The contents of the previous function DebuggerPluginPrivate::activatePreviousMode() was placed in EngineManager::deactivateDebugMode() and is called in doFinishDebugger(). Task-number: QTCREATORBUG-21415 Change-Id: Ibca188ba740027769c497e25ea695af8e218ea4e Reviewed-by: hjk --- src/plugins/debugger/debuggerengine.cpp | 2 ++ src/plugins/debugger/debuggermainwindow.cpp | 3 ++- src/plugins/debugger/enginemanager.cpp | 12 ++++++++++++ src/plugins/debugger/enginemanager.h | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index eaafa9b9d3f..8ced94f4ba3 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -418,6 +418,8 @@ public: m_watchHandler.cleanup(); m_engine->showMessage(tr("Debugger finished."), StatusBar); m_engine->setState(DebuggerFinished); // Also destroys views. + if (boolSetting(SwitchModeOnExit)) + EngineManager::deactivateDebugMode(); } void scheduleResetLocation() diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 18cfd421f03..2607c1fbd0b 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -26,6 +26,7 @@ #include "debuggermainwindow.h" #include "debuggerconstants.h" #include "debuggerinternalconstants.h" +#include "enginemanager.h" #include #include @@ -696,7 +697,7 @@ void Perspective::addWindow(QWidget *widget, void Perspective::select() { - ModeManager::activateMode(Debugger::Constants::MODE_DEBUG); + Debugger::Internal::EngineManager::activateDebugMode(); if (Perspective::currentPerspective() == this) return; theMainWindow->d->selectPerspective(this); diff --git a/src/plugins/debugger/enginemanager.cpp b/src/plugins/debugger/enginemanager.cpp index 68f800c5b1e..8bb62ede9db 100644 --- a/src/plugins/debugger/enginemanager.cpp +++ b/src/plugins/debugger/enginemanager.cpp @@ -421,6 +421,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) { int count = 0; diff --git a/src/plugins/debugger/enginemanager.h b/src/plugins/debugger/enginemanager.h index a41f13183aa..a1ee76c60b9 100644 --- a/src/plugins/debugger/enginemanager.h +++ b/src/plugins/debugger/enginemanager.h @@ -49,6 +49,7 @@ public: static void unregisterEngine(DebuggerEngine *engine); static void activateEngine(DebuggerEngine *engine); static void activateDebugMode(); + static void deactivateDebugMode(); static bool isLastOf(const QString &type); static QList > engines(); From aa70799795223367a983a1cce0fcf2d165a8b0cc Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Wed, 5 Dec 2018 10:36:24 +0100 Subject: [PATCH 14/20] Clang: Always force the built-in includes order C++ includes must always come first, then clang resource directory and then everything else. This prevents both c++ standard headers and intrinsics issues. Change-Id: Ia21bfa2fe99884c9adf58f7ef6beba1bede1724b Reviewed-by: Marco Bubke --- .../cpptools/compileroptionsbuilder.cpp | 65 +++++----- .../unittest/compileroptionsbuilder-test.cpp | 112 ++++++++++-------- 2 files changed, 94 insertions(+), 83 deletions(-) diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index 9ae36b75517..bc1b8639a10 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -221,39 +221,43 @@ static QString clangIncludeDirectory(const QString &clangVersion, #endif } -static int lastIncludeIndex(const QStringList &options, const QRegularExpression &includePathRegEx) -{ - int index = options.lastIndexOf(includePathRegEx); - - while (index > 0 && options[index - 1] != "-I" && options[index - 1] != "-isystem") - index = options.lastIndexOf(includePathRegEx, index - 1); - - if (index == 0) - index = -1; - - return index; -} - -static int includeIndexForResourceDirectory(const QStringList &options, bool isMacOs = false) +static QStringList insertResourceDirectory(const QStringList &options, + const QString &resourceDir, + bool isMacOs = false) { // include/c++, include/g++, libc++\include and libc++abi\include static const QString cppIncludes = R"((.*[\/\\]include[\/\\].*(g\+\+|c\+\+).*))" R"(|(.*libc\+\+[\/\\]include))" R"(|(.*libc\+\+abi[\/\\]include))"; - static const QRegularExpression includeRegExp("\\A(" + cppIncludes + ")\\z"); - // The same as includeRegExp but also matches /usr/local/include - static const QRegularExpression includeRegExpMac( - "\\A(" + cppIncludes + R"(|([\/\\]usr[\/\\]local[\/\\]include))" + ")\\z"); + QStringList optionsBeforeResourceDirectory; + QStringList optionsAfterResourceDirectory; + 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, isMacOs - ? includeRegExpMac - : includeRegExp); + for (const QString &option : options) { + if (option == "-isystem") + continue; - if (cppIncludeIndex > 0) - return cppIncludeIndex + 1; + if (includeRegExp.match(option).hasMatch()) { + optionsBeforeResourceDirectory.push_back("-isystem"); + optionsBeforeResourceDirectory.push_back(option); + } else { + optionsAfterResourceDirectory.push_back("-isystem"); + optionsAfterResourceDirectory.push_back(option); + } + } - return -1; + optionsBeforeResourceDirectory.push_back("-isystem"); + optionsBeforeResourceDirectory.push_back(resourceDir); + + return optionsBeforeResourceDirectory + optionsAfterResourceDirectory; } void CompilerOptionsBuilder::insertWrappedQtHeaders() @@ -325,16 +329,11 @@ void CompilerOptionsBuilder::addHeaderPathOptions() const QString clangIncludePath = clangIncludeDirectory(m_clangVersion, m_clangResourceDirectory); - int includeIndexForResourceDir = includeIndexForResourceDirectory( - builtInIncludes, m_projectPart.toolChainTargetTriple.contains("darwin")); - if (includeIndexForResourceDir >= 0) { - builtInIncludes.insert(includeIndexForResourceDir, clangIncludePath); - builtInIncludes.insert(includeIndexForResourceDir, "-isystem"); - } else { - builtInIncludes.prepend(clangIncludePath); - builtInIncludes.prepend("-isystem"); - } + builtInIncludes = insertResourceDirectory(builtInIncludes, + clangIncludePath, + m_projectPart.toolChainTargetTriple.contains( + "darwin")); } m_options.append(builtInIncludes); diff --git a/tests/unit/unittest/compileroptionsbuilder-test.cpp b/tests/unit/unittest/compileroptionsbuilder-test.cpp index 097efd58032..b7a4ace9e60 100644 --- a/tests/unit/unittest/compileroptionsbuilder-test.cpp +++ b/tests/unit/unittest/compileroptionsbuilder-test.cpp @@ -231,50 +231,16 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux) } TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderNoVersion) -{ - projectPart.headerPaths = {HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include", HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++", HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32", HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward", HeaderPathType::BuiltIn} - }; - projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu"; - CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, - CppTools::UseSystemHeader::No, - CppTools::SkipBuiltIn::No, - CppTools::SkipLanguageDefines::Yes, - "7.0.0", - ""); - - compilerOptionsBuilder.addHeaderPathOptions(); - - ASSERT_THAT(compilerOptionsBuilder.options(), - ElementsAre("-nostdinc", - "-nostdlibinc", - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include"), - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++"), - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\i686-w64-mingw32"), - "-isystem", QDir::toNativeSeparators("C:\\Qt\\Tools\\mingw530_32\\i686-w64-mingw32\\include\\c++\\backward"), - "-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""))); -} - -TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) { projectPart.headerPaths = { - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android", - HeaderPathType::BuiltIn}, - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++\\include", - HeaderPathType::BuiltIn}, - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include", - HeaderPathType::BuiltIn}, - HeaderPath{ - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include", - HeaderPathType::BuiltIn}, - HeaderPath{"C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include", + 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 = "i686-linux-android"; + projectPart.toolChainTargetTriple = "x86_64-w64-windows-gnu"; CppTools::CompilerOptionsBuilder compilerOptionsBuilder(projectPart, CppTools::UseSystemHeader::No, CppTools::SkipBuiltIn::No, @@ -290,22 +256,68 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderAndroidClang) "-nostdinc", "-nostdlibinc", "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include\\i686-linux-android"), + QDir::toNativeSeparators("C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++"), "-isystem", 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", QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\android\\support\\include"), - "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sources\\cxx-stl\\llvm-libc++abi\\include"), + "C:/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward"), "-isystem", QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), "-isystem", - QDir::toNativeSeparators( - "C:\\Users\\test\\AppData\\Local\\Android\\sdk\\ndk-bundle\\sysroot\\usr\\include"))); + QDir::toNativeSeparators("C:/Qt/Tools/mingw530_32/i686-w64-mingw32/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::SkipBuiltIn::No, + CppTools::SkipLanguageDefines::Yes, + "7.0.0", + ""); + + compilerOptionsBuilder.addHeaderPathOptions(); + + ASSERT_THAT( + compilerOptionsBuilder.options(), + ElementsAre("-nostdinc", + "-nostdlibinc", + "-isystem", + QDir::toNativeSeparators("C:/Users/test/AppData/Local/Android/sdk/ndk-" + "bundle/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) From f635af8908b865635326f828c2606a1e684f4510 Mon Sep 17 00:00:00 2001 From: Aaron Barany Date: Mon, 10 Dec 2018 21:08:38 -0800 Subject: [PATCH 15/20] GDB: Don't reset breakpoint when line numbers differ When the breakpoint is put on a non-code line, it will be moved to the next line that has debuggable code on it. When attempting to reset the breakpoint to the originally requested line, this causes an infinite loop of removing and re-adding the breakpoint. Fixes: QTCREATORBUG-21611 Fixes: QTCREATORBUG-21616 Change-Id: I8943de0eae991644eb6728f491010599f62192ff Reviewed-by: Orgad Shaneh Reviewed-by: hjk --- src/plugins/debugger/gdb/gdbengine.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index b4d104509e8..2ecbf285349 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -2488,15 +2488,17 @@ void GdbEngine::updateBreakpoint(const Breakpoint &bp) QTC_ASSERT(state2 == BreakpointUpdateProceeding, qDebug() << state2); DebuggerCommand cmd; - if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) { - // The only way to change this seems to be to re-set the bp completely. - cmd.function = "-break-delete " + bpnr; - cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); }; - } else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) { - // The only way to change this seems to be to re-set the bp completely. - cmd.function = "-break-delete " + bpnr; - cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; - } else if (requested.command != bp->command()) { + // FIXME: See QTCREATORBUG-21611, QTCREATORBUG-21616 +// if (!bp->isPending() && requested.threadSpec != bp->threadSpec()) { +// // The only way to change this seems to be to re-set the bp completely. +// cmd.function = "-break-delete " + bpnr; +// cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakThreadSpec(r, bp); }; +// } else if (!bp->isPending() && requested.lineNumber != bp->lineNumber()) { +// // The only way to change this seems to be to re-set the bp completely. +// cmd.function = "-break-delete " + bpnr; +// cmd.callback = [this, bp](const DebuggerResponse &r) { handleBreakLineNumber(r, bp); }; +// } else if + if (requested.command != bp->command()) { cmd.function = "-break-commands " + bpnr; for (QString command : requested.command.split('\n')) { if (!command.isEmpty()) { From d4e79230d83f44790345115efddd0252f892e292 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 9 Nov 2018 16:19:12 +0100 Subject: [PATCH 16/20] Debugger: Make LLDB startup failures more verbose Fixes: QTCREATORBUG-19612 Change-Id: I7c8ebe3ec734265c8df8a684ccd6bb8991ea8390 Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller --- share/qtcreator/debugger/lldbbridge.py | 7 +++++++ src/plugins/debugger/lldb/lldbengine.cpp | 22 ++++++++++++++-------- src/plugins/debugger/lldb/lldbengine.h | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 6cccd84fba7..6093b94f78a 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -2275,3 +2275,10 @@ def __lldb_init_module(debugger, internal_dict): if not __name__ == 'qt': # Make available under global 'qt' name for consistency internal_dict['qt'] = internal_dict[__name__] + + +if __name__ == "lldbbridge": + try: + theDumper = Dumper() + except Exception as error: + print('@\nstate="enginesetupfailed",error="{}"@\n'.format(error)) diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 70daef5ac5d..6df9fb6a31e 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -191,6 +191,11 @@ void LldbEngine::abortDebuggerProcess() notifyEngineShutdownFinished(); } +static QString adapterStartFailed() +{ + return LldbEngine::tr("Adapter start failed."); +} + void LldbEngine::setupEngine() { QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state()); @@ -211,7 +216,7 @@ void LldbEngine::setupEngine() notifyEngineSetupFailed(); showMessage("ADAPTER START FAILED"); if (!msg.isEmpty()) - ICore::showWarningWithOptions(tr("Adapter start failed."), msg); + ICore::showWarningWithOptions(adapterStartFailed(), msg); return; } m_lldbProc.waitForReadyRead(1000); @@ -222,9 +227,8 @@ void LldbEngine::setupEngine() ICore::resourcePath().toLocal8Bit() + "/debugger/"; 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 print(dir())\n"); - m_lldbProc.write("script theDumper = Dumper()\n"); // This triggers reportState("enginesetupok") QString commands = nativeStartupCommands(); if (!commands.isEmpty()) @@ -384,7 +388,7 @@ void LldbEngine::handleResponse(const QString &response) cmd.callback(response); } } else if (name == "state") - handleStateNotification(item); + handleStateNotification(all); else if (name == "location") handleLocationNotification(item); 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") notifyInferiorRunOk(); else if (newState == "inferiorrunfailed") @@ -867,9 +871,11 @@ void LldbEngine::handleStateNotification(const GdbMi &reportedState) notifyInferiorIll(); else if (newState == "enginesetupok") notifyEngineSetupOk(); - else if (newState == "enginesetupfailed") + else if (newState == "enginesetupfailed") { + Core::AsynchronousMessageBox::critical(adapterStartFailed(), + item["error"].data()); notifyEngineSetupFailed(); - else if (newState == "enginerunfailed") + } else if (newState == "enginerunfailed") notifyEngineRunFailed(); else if (newState == "enginerunandinferiorrunok") { if (runParameters().continueAfterAttach) diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index aff71500556..f06798dd392 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -117,7 +117,7 @@ private: void readLldbStandardOutput(); void readLldbStandardError(); - void handleStateNotification(const GdbMi &state); + void handleStateNotification(const GdbMi &item); void handleLocationNotification(const GdbMi &location); void handleOutputNotification(const GdbMi &output); From d0e4f657c9810f8f938b14b61c8b27fd6a070547 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 16 Nov 2018 09:59:55 +0100 Subject: [PATCH 17/20] Squish: Adapt tst_git_local Committing has been made a 'bit less synchronous'. So, wait a short amount of time to have the expected output present, but fail if it does not appear within that time frame. Change-Id: I5f6c02dcec42800e876a4bae36e08596bedf0049 Reviewed-by: Robert Loehning --- tests/system/suite_tools/tst_git_local/test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_tools/tst_git_local/test.py b/tests/system/suite_tools/tst_git_local/test.py index 72943b3eb2e..cd9fed32e18 100644 --- a/tests/system/suite_tools/tst_git_local/test.py +++ b/tests/system/suite_tools/tst_git_local/test.py @@ -46,8 +46,9 @@ def commit(commitMessage, expectedLogMessage, uncheckUntracked=False): checkOrFixCommitterInformation('invalidEmailLabel', 'emailLineEdit', 'nobody@nowhere.com') clickButton(waitForObject(":splitter.Commit File(s)_VcsBase::QActionPushButton")) vcsLog = waitForObject("{type='QPlainTextEdit' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}").plainText - test.verify(expectedLogMessage in str(vcsLog), "Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog)) + "window=':Qt Creator_Core::Internal::MainWindow'}") + test.verify(waitFor('expectedLogMessage in str(vcsLog.plainText)', 2000), + "Searching for '%s' in log:\n%s " % (expectedLogMessage, vcsLog.plainText)) return commitMessage def verifyItemsInGit(commitMessages): From b382d83fabd70c325dc395cf18c3b7ecd1e89de9 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 15 Nov 2018 15:40:11 +0100 Subject: [PATCH 18/20] Squish: Adapt test to changed behavior 41d68f469a1e9 restored (partially) the old behavior which changes the '.' operator to '->' if all completions need it. Change-Id: I92c2183e7e7f1c0d839f2340c2abe7a9f7d73af2 Reviewed-by: Robert Loehning --- tests/system/suite_editors/tst_memberoperator/test.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py index 910e4b35c51..99e511049a3 100644 --- a/tests/system/suite_editors/tst_memberoperator/test.py +++ b/tests/system/suite_editors/tst_memberoperator/test.py @@ -77,8 +77,9 @@ def main(): proposalToolTips) correction = testData.field(record, "correction") if correction == 'all': - test.compare(len(needCorrection), len(proposalToolTips), - "Verifying whether all proposal need correction.") + __verifyLineUnderCursor__(cppwindow, record) + test.compare(len(needCorrection), 0, + "Verifying whether operator has been already corrected.") elif correction == 'mixed': test.verify(len(proposalToolTips) > len(needCorrection) > 0, "Verifying whether some of the proposals need correction.") From 4a693e91db2c16260577b9186ca458814f425012 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Tue, 11 Dec 2018 09:40:50 +0100 Subject: [PATCH 19/20] ClangFormat: Fix the return value for the line offset Return -1 for the lines which do not exist in the document. Change-Id: Ieccb2121f7db260bf72b36886d1f820af01cca0d Reviewed-by: Marco Bubke --- src/libs/utils/textutils.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/utils/textutils.cpp b/src/libs/utils/textutils.cpp index d102de794ad..f72dd89321c 100644 --- a/src/libs/utils/textutils.cpp +++ b/src/libs/utils/textutils.cpp @@ -142,6 +142,9 @@ QTextCursor wordStartCursor(const QTextCursor &textCursor) int utf8NthLineOffset(const QTextDocument *textDocument, const QByteArray &buffer, int line) { + if (textDocument->blockCount() < line) + return -1; + if (textDocument->characterCount() == buffer.size() + 1) return textDocument->findBlockByNumber(line - 1).position(); From 5cd4a73acab1ee3782747d5de55c0ae734bfba2f Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 10 Dec 2018 13:21:46 +0100 Subject: [PATCH 20/20] CppTools: Return proper tab settings We are always interested in currentTabSettings(). Fixes: QTCREATORBUG-21280 Change-Id: I5b739b516eb985074c27410113c244787dd8b52d Reviewed-by: Marco Bubke --- src/plugins/cpptools/cppcodestylesettings.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/cpptools/cppcodestylesettings.cpp b/src/plugins/cpptools/cppcodestylesettings.cpp index f6347491646..565c9696893 100644 --- a/src/plugins/cpptools/cppcodestylesettings.cpp +++ b/src/plugins/cpptools/cppcodestylesettings.cpp @@ -242,7 +242,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentProjectTabSettings() TextEditor::ICodeStylePreferences *codeStylePreferences = editorConfiguration->codeStyle(CppTools::Constants::CPP_SETTINGS_ID); QTC_ASSERT(codeStylePreferences, return currentGlobalTabSettings()); - return codeStylePreferences->tabSettings(); + return codeStylePreferences->currentTabSettings(); } TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings() @@ -251,7 +251,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings() = CppTools::CppToolsSettings::instance()->cppCodeStyle(); QTC_ASSERT(cppCodeStylePreferences, return TextEditor::TabSettings()); - return cppCodeStylePreferences->tabSettings(); + return cppCodeStylePreferences->currentTabSettings(); }