aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-03-01 12:20:57 +0200
committerOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-03-01 13:06:57 +0200
commitcbfc6e522dced7516dbfa036197476796ca1dcf8 (patch)
treee78aa7f496b1986d127e991da685bcc3382fa1f9
parent89831854059144613279affc4c37eb65dbcbf6e7 (diff)
parentaa14e396f03232ce97a723aaf18ab89f7dfad698 (diff)
Merge remote-tracking branch 'origin/4.9'
-rw-r--r--dist/changes-4.8.2.md13
-rw-r--r--doc/images/qtcreator-autotests-options.pngbin28078 -> 7194 bytes
-rw-r--r--doc/src/howto/creator-only/creator-autotest.qdoc55
-rw-r--r--doc/src/qtquick/qtquick-components.qdoc12
-rw-r--r--doc/src/qtquick/qtquick-properties.qdoc2
-rw-r--r--doc/src/qtquick/qtquick-states.qdoc8
-rw-r--r--qbs/modules/libclang/functions.js4
-rw-r--r--qbs/modules/qbsbuildconfig/qbsbuildconfig.qbs2
-rw-r--r--share/qtcreator/debugger/cdbbridge.py4
-rw-r--r--share/qtcreator/debugger/stdtypes.py15
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp4
-rw-r--r--share/qtcreator/translations/translations.pro3
-rw-r--r--src/libs/clangsupport/baseserverproxy.cpp29
-rw-r--r--src/libs/clangsupport/baseserverproxy.h3
-rw-r--r--src/libs/clangsupport/clangcodemodelclientproxy.cpp33
-rw-r--r--src/libs/clangsupport/clangcodemodelclientproxy.h3
-rw-r--r--src/libs/clangsupport/clangcodemodelconnectionclient.cpp12
-rw-r--r--src/libs/clangsupport/clangcodemodelconnectionclient.h2
-rw-r--r--src/libs/clangsupport/clangcodemodelserverproxy.cpp5
-rw-r--r--src/libs/clangsupport/clangcodemodelserverproxy.h1
-rw-r--r--src/libs/clangsupport/clangsupport_global.h10
-rw-r--r--src/libs/clangsupport/connectionclient.h2
-rw-r--r--src/libs/clangsupport/pchmanagerclientproxy.cpp38
-rw-r--r--src/libs/clangsupport/pchmanagerclientproxy.h8
-rw-r--r--src/libs/clangsupport/pchmanagerserverproxy.cpp5
-rw-r--r--src/libs/clangsupport/pchmanagerserverproxy.h1
-rw-r--r--src/libs/clangsupport/progresscounter.h2
-rw-r--r--src/libs/clangsupport/progressmessage.h12
-rw-r--r--src/libs/clangsupport/refactoringclientproxy.cpp38
-rw-r--r--src/libs/clangsupport/refactoringclientproxy.h6
-rw-r--r--src/libs/clangsupport/refactoringserverproxy.cpp8
-rw-r--r--src/libs/clangsupport/refactoringserverproxy.h2
-rw-r--r--src/libs/clangsupport/writemessageblock.cpp24
-rw-r--r--src/libs/clangsupport/writemessageblock.h8
-rw-r--r--src/libs/cplusplus/pp-engine.cpp14
-rw-r--r--src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp2
-rw-r--r--src/plugins/clangcodemodel/clangdiagnosticfilter.h2
-rw-r--r--src/plugins/clangcodemodel/clangfollowsymbol.cpp23
-rw-r--r--src/plugins/clangformat/clangformat.qbs1
-rw-r--r--src/plugins/clangformat/clangformat_dependencies.pri2
-rw-r--r--src/plugins/clangformat/clangformatbaseindenter.cpp26
-rw-r--r--src/plugins/clangformat/clangformatbaseindenter.h1
-rw-r--r--src/plugins/clangformat/clangformatconfigwidget.cpp136
-rw-r--r--src/plugins/clangformat/clangformatconfigwidget.h10
-rw-r--r--src/plugins/clangformat/clangformatconfigwidget.ui6
-rw-r--r--src/plugins/clangformat/clangformatindenter.cpp5
-rw-r--r--src/plugins/clangformat/clangformatutils.cpp72
-rw-r--r--src/plugins/clangpchmanager/clangpchmanagerplugin.cpp17
-rw-r--r--src/plugins/clangpchmanager/pchmanagerclient.cpp11
-rw-r--r--src/plugins/clangpchmanager/pchmanagerclient.h9
-rw-r--r--src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp4
-rw-r--r--src/plugins/clangpchmanager/pchmanagerconnectionclient.h2
-rw-r--r--src/plugins/clangpchmanager/progressmanager.h3
-rw-r--r--src/plugins/clangrefactoring/refactoringconnectionclient.cpp9
-rw-r--r--src/plugins/clangrefactoring/refactoringconnectionclient.h2
-rw-r--r--src/plugins/clangtools/clangfixitsrefactoringchanges.cpp3
-rw-r--r--src/plugins/cppeditor/cpphighlighter.cpp2
-rw-r--r--src/plugins/cppeditor/cpphighlighter.h8
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.cpp167
-rw-r--r--src/plugins/cpptools/cppcodestylesnippets.h190
-rw-r--r--src/plugins/cpptools/cppfilesettingspage.cpp4
-rw-r--r--src/plugins/cpptools/cpptools.pro1
-rw-r--r--src/plugins/cpptools/cpptools.qbs1
-rw-r--r--src/plugins/debugger/debuggermainwindow.cpp24
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp2
-rw-r--r--src/plugins/git/gitclient.cpp5
-rw-r--r--src/plugins/mercurial/mercurialclient.cpp1
-rw-r--r--src/plugins/perfprofiler/PerfProfiler.json.in1
-rw-r--r--src/plugins/projectexplorer/abiwidget.cpp4
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp32
-rw-r--r--src/plugins/projectexplorer/makestep.ui3
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp20
-rw-r--r--src/plugins/projectexplorer/projectmodels.cpp5
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.cpp9
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodes.h1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp8
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp26
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp4
-rw-r--r--src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp2
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp50
-rw-r--r--src/plugins/qmldesigner/components/propertyeditor/gradientmodel.h1
-rw-r--r--src/plugins/qmldesigner/designercore/model/rewriterview.cpp11
-rw-r--r--src/plugins/qmldesigner/designersettings.h1
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp3
-rw-r--r--src/plugins/qtsupport/profilereader.cpp1
-rw-r--r--src/plugins/qtsupport/qtoutputformatter.cpp2
-rw-r--r--src/plugins/texteditor/basefilefind.cpp74
-rw-r--r--src/plugins/texteditor/basefilefind.h7
-rw-r--r--src/plugins/texteditor/highlighter.cpp94
-rw-r--r--src/plugins/texteditor/highlighter.h10
-rw-r--r--src/plugins/texteditor/highlightersettings.cpp7
-rw-r--r--src/plugins/texteditor/highlightersettingspage.cpp3
-rw-r--r--src/plugins/texteditor/highlightersettingspage.ui24
-rw-r--r--src/plugins/texteditor/texteditor.cpp18
-rw-r--r--src/plugins/texteditor/texteditorconstants.h2
-rw-r--r--src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp7
-rw-r--r--src/plugins/vcsbase/vcsbasediffeditorcontroller.h1
-rw-r--r--src/shared/clang/clang_installation.pri42
-rw-r--r--src/shared/proparser/ioutils.cpp4
m---------src/shared/qbs0
-rw-r--r--src/tools/clangbackend/source/clangtooltipinfocollector.cpp5
-rw-r--r--src/tools/clangbackend/source/clangtype.cpp5
-rw-r--r--src/tools/clangbackend/source/clangtype.h1
-rw-r--r--src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp19
-rw-r--r--src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri1
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchcreator.h9
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchcreatorincludes.h40
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp7
-rw-r--r--src/tools/clangpchmanagerbackend/source/pchmanagerserver.h3
-rw-r--r--src/tools/clangrefactoringbackend/source/clangtool.cpp19
-rw-r--r--src/tools/clangrefactoringbackend/source/clangtool.h4
-rw-r--r--tests/auto/debugger/tst_dumpers.cpp4
-rw-r--r--tests/system/suite_APTW/tst_APTW03/test.py10
-rw-r--r--tests/system/suite_debugger/tst_cli_output_console/test.py2
-rw-r--r--tests/unit/unittest/clangformat-test.cpp13
-rw-r--r--tests/unit/unittest/commandlinebuilder-test.cpp14
-rw-r--r--tests/unit/unittest/creator_dependency.pri2
-rw-r--r--tests/unit/unittest/googletest.h1
-rw-r--r--tests/unit/unittest/gtest-creator-printing.cpp17
-rw-r--r--tests/unit/unittest/gtest-llvm-printing.cpp42
-rw-r--r--tests/unit/unittest/gtest-llvm-printing.h39
-rw-r--r--tests/unit/unittest/pchmanagerclient-test.cpp16
-rw-r--r--tests/unit/unittest/pchmanagerserver-test.cpp22
-rw-r--r--tests/unit/unittest/projectupdater-test.cpp6
-rw-r--r--tests/unit/unittest/readandwritemessageblock-test.cpp2
-rw-r--r--tests/unit/unittest/refactoringprojectupdater-test.cpp6
-rw-r--r--tests/unit/unittest/symbolindexer-test.cpp20
-rw-r--r--tests/unit/unittest/unittest.pro2
129 files changed, 1246 insertions, 702 deletions
diff --git a/dist/changes-4.8.2.md b/dist/changes-4.8.2.md
index 22a930d9a40..ef7316c7c73 100644
--- a/dist/changes-4.8.2.md
+++ b/dist/changes-4.8.2.md
@@ -7,6 +7,10 @@ you can check out from the public Git repository. For example:
git clone git://code.qt.io/qt-creator/qt-creator.git
git log --cherry-pick --pretty=oneline origin/v4.8.1..v4.8.2
+General
+
+* Fixed UI for choosing executable for external tools (QTCREATORBUG-21937)
+
Editing
* Fixed highlighting of search results of regular expression search
@@ -20,6 +24,10 @@ Autotools Projects
C++ Support
* Fixed crash when expanding macros (QTCREATORBUG-21642)
+* Fixed crash in preprocessor (QTCREATORBUG-21981)
+* Fixed infinite loop when resolving pointer types (QTCREATORBUG-22010)
+* Fixed cursor position after completion of functions without arguments
+ (QTCREATORBUG-21841)
QML Support
@@ -38,6 +46,7 @@ Debugging
Qt Quick Designer
* Added support for more JavaScript functions in `.ui.qml` files
+* Fixed crash with gradients and Qt Quick 5.12 (QDS-472)
Test Integration
@@ -55,16 +64,20 @@ macOS
Android
* Fixed upload of GDB server on some devices (QTCREATORBUG-21317)
+* Fixed crash on exiting debugger (QTCREATORBUG-21684)
Credits for these changes go to:
+Andre Hartmann
André Pönitz
Christian Kandeler
Christian Stenger
David Schulz
Eike Ziller
Ivan Donchevskii
+Kirill Burtsev
Leena Miettinen
Liang Qi
+Nikolai Kosjar
Oliver Wolff
Raoul Hecky
Robert Löhning
diff --git a/doc/images/qtcreator-autotests-options.png b/doc/images/qtcreator-autotests-options.png
index 9e1879bb55e..e880c8d6166 100644
--- a/doc/images/qtcreator-autotests-options.png
+++ b/doc/images/qtcreator-autotests-options.png
Binary files differ
diff --git a/doc/src/howto/creator-only/creator-autotest.qdoc b/doc/src/howto/creator-only/creator-autotest.qdoc
index d5d51edb641..80a8f91f6b5 100644
--- a/doc/src/howto/creator-only/creator-autotest.qdoc
+++ b/doc/src/howto/creator-only/creator-autotest.qdoc
@@ -242,9 +242,16 @@
You can add filters to specify the directories within the current project
to scan for tests. Select the \uicontrol {Global Filters} check box, and
- the select \uicontrol Add to specify paths to the directories to scan for
+ then select \uicontrol Add to specify paths to the directories to scan for
tests. Wildcards are not supported in the filter expressions.
+ In some special setups, \QC cannot deduce which executable or run
+ configuration it should use. If \QC repeatedly asks you to select the
+ tests to run when trying to execute tests, you can enable it to cache
+ your choices and use them were appropriate. The cached information is
+ cleared when you switch to another project, close the current one, or
+ select \uicontrol {Reset Cached Choices}.
+
To show or hide init and cleanup or data functions in the \uicontrol Tests
view, select \inlineimage filtericon.png
(\uicontrol {Filter Test Tree}), and then select \uicontrol {Show Init and
@@ -334,22 +341,9 @@
\li BENCH
\li Benchmark test.
\row
- \li BFAIL
- \li Blacklisted test case failed. Since Qt 5.4, you can
- provide a BLACKLIST file for tests. It is mainly used internally
- by the Qt CI system.
- \row
- \li BPASS
- \li Blacklisted test case passed.
- \row
\li DEBUG
\li Debug message.
\row
- \li XFAIL
- \li Test case is expected to fail, so it is marked by using the
- QEXPECT_FAIL macro. If the test case passes instead, an
- unexpected pass (XPASS) is written to the test log.
- \row
\li FAIL
\li Test case failed. Double-click the line for more information.
\row
@@ -372,11 +366,39 @@
\li SYSTEM
\li An error message received from or influenced by the OS.
\row
+ \li XFAIL
+ \li Test case is expected to fail, so it is marked by using the
+ QEXPECT_FAIL macro. If the test case passes instead, an
+ unexpected pass (XPASS) is written to the test log.
+ \row
\li XPASS
\li Test case passed even though it was expected to fail.
\row
\li WARN
\li Warning message.
+
+ \endtable
+
+ Since Qt 5.4, you can provide a BLACKLIST file for tests. It is mainly used
+ internally by the Qt CI system.
+
+ \table
+ \header
+ \li Result
+ \li Description
+ \row
+ \li BFAIL
+ \li Blacklisted test case failed.
+ \row
+ \li BPASS
+ \li Blacklisted test case passed.
+ \row
+ \li BXFAIL
+ \li Blacklisted test case failed but was marked to be expected to fail.
+ \row
+ \li BXPASS
+ \li Blacklisted test case passed even though it was expected to fail.
+
\endtable
To view only messages of a particular type, select
@@ -391,6 +413,11 @@
\uicontrol {Limit result output} check box. To disable automatic scrolling,
deselect the \uicontrol {Automatically scroll results} check box.
+ Test results can be grouped by the executable path that was used to run the
+ tests. This is useful if you have multiple test executables and run them all
+ at once. To enable this functionality you need to select the
+ \uicontrol {Group results by application} check box.
+
Internal messages and run configuration warnings for deduced configurations
are omitted by default. To view them, deselect the \uicontrol {Omit internal
messages} and \uicontrol {Omit run configuration warnings} check boxes.
diff --git a/doc/src/qtquick/qtquick-components.qdoc b/doc/src/qtquick/qtquick-components.qdoc
index 77e0a8c58a3..3b2185e95e6 100644
--- a/doc/src/qtquick/qtquick-components.qdoc
+++ b/doc/src/qtquick/qtquick-components.qdoc
@@ -163,7 +163,7 @@
Property bindings are created implicitly in QML whenever a property is
assigned a JavaScript expression. To set JavaScript expressions as values
- of properties in the Design mode, select the \uicontrol Nut menu next to
+ of properties in the Design mode, select the \uicontrol Settings menu next to
a property, and then select \uicontrol {Set Binding}.
\image qmldesigner-set-expression.png "Type properties context menu"
@@ -269,9 +269,9 @@
arranges its child items side by side, wrapping as necessary.
\endlist
- To lay out several items in a \uicontrol Column, \uicontrol Row,
+ To position several items in a \uicontrol Column, \uicontrol Row,
\uicontrol Grid, or \uicontrol Flow, select the items on the canvas, and
- then select \uicontrol Layout in the context menu.
+ then select \uicontrol Position in the context menu.
\section2 Using Layouts
@@ -284,8 +284,7 @@
\list
\li \l{Layout} provides attached properties for items pushed onto a
- \uicontrol {Column Layout}, \uicontrol {Row Layout}, or
- \uicontrol {Grid Layout}.
+ column, row, or grid layout.
\li \l{ColumnLayout}{Column Layout} provides a grid layout with only
one column.
\li \l{RowLayout}{Row Layout} provides a grid layout with only one row.
@@ -295,8 +294,7 @@
one item is visible at a time.
\endlist
- To lay out several items in a \uicontrol {Column Layout},
- \uicontrol {Row Layout}, \uicontrol {Grid Layout}, or
+ To lay out several items in a column, row, grid, or
\uicontrol {Stack Layout}, select the items in the \uicontrol {Form Editor},
and then select \uicontrol Layout in the context menu.
diff --git a/doc/src/qtquick/qtquick-properties.qdoc b/doc/src/qtquick/qtquick-properties.qdoc
index c9d134d15c7..41e1086f8ad 100644
--- a/doc/src/qtquick/qtquick-properties.qdoc
+++ b/doc/src/qtquick/qtquick-properties.qdoc
@@ -50,7 +50,7 @@
\uicontrol Properties pane, and enter the name of another QML type in the
field. If you have specified properties for the item that are not supported
for the new type, the type cannot be changed and an error message is
- displayed. Select the \uicontrol Nut menu next to the property name, and
+ displayed. Select the \uicontrol Settings menu next to the property name, and
then select \uicontrol Reset to remove the property values before trying
again.
diff --git a/doc/src/qtquick/qtquick-states.qdoc b/doc/src/qtquick/qtquick-states.qdoc
index f476026d55b..c316df4575c 100644
--- a/doc/src/qtquick/qtquick-states.qdoc
+++ b/doc/src/qtquick/qtquick-states.qdoc
@@ -63,12 +63,12 @@
\li Show a different view or screen.
\endlist
- The \uicontrol State pane displays the different \l{State}{states}
- of the component in the Design mode. The \uicontrol State pane is
+ The \uicontrol States pane displays the different \l{State}{states}
+ of the component in the Design mode. The \uicontrol States pane is
collapsed by default to save space. Select \uicontrol Expand in
the context menu to view the whole pane.
- \image qmldesigner-transitions.png "State pane"
+ \image qmldesigner-transitions.png "States pane"
To add states, click the \inlineimage plus.png
button. Then modify the new state in the editor. For example, to change the
@@ -81,7 +81,7 @@
\uicontrol {Set when Condition} in the menu and specify a
\l [QtQuick]{State::when}{when} property for the state.
- You can preview the states in the \uicontrol State pane and click them to
+ You can preview the states in the \uicontrol States pane and click them to
switch between states on the canvas.
\section1 Using States
diff --git a/qbs/modules/libclang/functions.js b/qbs/modules/libclang/functions.js
index 4d384d773e4..3a75fe1ead9 100644
--- a/qbs/modules/libclang/functions.js
+++ b/qbs/modules/libclang/functions.js
@@ -103,6 +103,10 @@ function extraLibraries(llvmConfig, targetOS)
function formattingLibs(llvmConfig, qtcFunctions, targetOS)
{
+ var llvmIncludeDir = includeDir(llvmConfig);
+ if (!File.exists(llvmIncludeDir.concat("/clang/Format/Format.h")))
+ return [];
+
var clangVersion = version(llvmConfig)
var libs = []
if (qtcFunctions.versionIsAtLeast(clangVersion, MinimumLLVMVersion)) {
diff --git a/qbs/modules/qbsbuildconfig/qbsbuildconfig.qbs b/qbs/modules/qbsbuildconfig/qbsbuildconfig.qbs
index 845ce4139c6..4a0d6cab1d0 100644
--- a/qbs/modules/qbsbuildconfig/qbsbuildconfig.qbs
+++ b/qbs/modules/qbsbuildconfig/qbsbuildconfig.qbs
@@ -25,7 +25,7 @@ Module {
property string relativeLibexecPath: FileInfo.relativePath('/' + appInstallDir,
'/' + libexecInstallDir)
property string relativePluginsPath: FileInfo.relativePath('/' + appInstallDir,
- '/' + pluginsInstallDir)
+ '/' + qtc.ide_plugin_path)
property string relativeSearchPath: FileInfo.relativePath('/' + appInstallDir,
'/' + resourcesInstallDir)
}
diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py
index 9b1dd07810a..1e59452ffd7 100644
--- a/share/qtcreator/debugger/cdbbridge.py
+++ b/share/qtcreator/debugger/cdbbridge.py
@@ -458,10 +458,6 @@ class Dumper(DumperBase):
def report(self, stuff):
sys.stdout.write(stuff + "\n")
- def loadDumpers(self, args):
- msg = self.setupDumpers()
- self.reportResult(msg, args)
-
def findValueByExpression(self, exp):
return cdbext.parseAndEvaluate(exp)
diff --git a/share/qtcreator/debugger/stdtypes.py b/share/qtcreator/debugger/stdtypes.py
index 154e0ad67e0..8810e099127 100644
--- a/share/qtcreator/debugger/stdtypes.py
+++ b/share/qtcreator/debugger/stdtypes.py
@@ -1024,7 +1024,20 @@ def qdump__std__basic_string(d, value):
def qdump__std____cxx11__basic_string(d, value):
innerType = value.type[0]
- (data, size) = value.split("pI")
+ try:
+ allocator = value.type[2].name
+ except:
+ allocator = ''
+ if allocator == 'std::allocator<%s>' % innerType.name:
+ (data, size) = value.split("pI")
+ else:
+ try:
+ data = value["_M_dataplus"]["_M_p"]
+ size = int(value["_M_string_length"])
+ except:
+ d.putEmptyValue()
+ d.putPlainChildren(value)
+ return
d.check(0 <= size) #and size <= alloc and alloc <= 100*1000*1000)
d.putCharArrayHelper(data, size, innerType, d.currentItemFormat())
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
index c13781558cb..dd4a0adbd10 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp
@@ -267,13 +267,13 @@ static bool isList(const QQmlProperty &property)
static bool isQJSValue(const QQmlProperty &property)
{
- return !strcmp(property.propertyTypeName(), "QJSValue");
+ return property.isValid() && !strcmp(property.propertyTypeName(), "QJSValue");
}
static bool isObject(const QQmlProperty &property)
{
/* QVariant and QJSValue can also store QObjects. Lets trust our model. */
- return (property.propertyTypeCategory() == QQmlProperty::Object
+ return property.isValid() && (property.propertyTypeCategory() == QQmlProperty::Object
|| !strcmp(property.propertyTypeName(), "QVariant")
|| isQJSValue(property));
}
diff --git a/share/qtcreator/translations/translations.pro b/share/qtcreator/translations/translations.pro
index 0df9762fccd..0df2d53ad4a 100644
--- a/share/qtcreator/translations/translations.pro
+++ b/share/qtcreator/translations/translations.pro
@@ -73,7 +73,8 @@ plugin_sources -= src/plugins/plugins.pro \
shared_sources = $$files($$IDE_SOURCE_TREE/src/shared/*)
shared_sources ~= s,^$$re_escape($$IDE_SOURCE_TREE/),,g$$i_flag
shared_sources -= \
- src/shared/qbs
+ src/shared/qbs \
+ src/shared/shared.pro
sources = src/app src/libs $$plugin_sources $$shared_sources share/qtcreator/qmldesigner
for(path, INCLUDEPATH): include_options *= -I$$shell_quote($$path)
diff --git a/src/libs/clangsupport/baseserverproxy.cpp b/src/libs/clangsupport/baseserverproxy.cpp
index 6f563ffd9de..0c565de269b 100644
--- a/src/libs/clangsupport/baseserverproxy.cpp
+++ b/src/libs/clangsupport/baseserverproxy.cpp
@@ -26,14 +26,25 @@
#include "baseserverproxy.h"
#include "messageenvelop.h"
-#include <QIODevice>
+#include <QLocalSocket>
namespace ClangBackEnd {
+BaseServerProxy::BaseServerProxy(IpcClientInterface *client, QLocalSocket *localSocket)
+ : m_writeMessageBlock(localSocket)
+ , m_readMessageBlock(localSocket)
+ , m_client(client)
+{
+ if (localSocket)
+ QObject::connect(localSocket, &QIODevice::readyRead, [this]() {
+ BaseServerProxy::readMessages();
+ });
+}
+
BaseServerProxy::BaseServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
- : m_writeMessageBlock(ioDevice),
- m_readMessageBlock(ioDevice),
- m_client(client)
+ : m_writeMessageBlock(ioDevice)
+ , m_readMessageBlock(ioDevice)
+ , m_client(client)
{
if (ioDevice)
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () { BaseServerProxy::readMessages(); });
@@ -51,11 +62,13 @@ void BaseServerProxy::resetState()
m_readMessageBlock.resetState();
}
-void BaseServerProxy::setIoDevice(QIODevice *ioDevice)
+void BaseServerProxy::setLocalSocket(QLocalSocket *localSocket)
{
- QObject::connect(ioDevice, &QIODevice::readyRead, [this] () { BaseServerProxy::readMessages(); });
- m_writeMessageBlock.setIoDevice(ioDevice);
- m_readMessageBlock.setIoDevice(ioDevice);
+ QObject::connect(localSocket, &QIODevice::readyRead, [this]() {
+ BaseServerProxy::readMessages();
+ });
+ m_writeMessageBlock.setLocalSocket(localSocket);
+ m_readMessageBlock.setIoDevice(localSocket);
}
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/baseserverproxy.h b/src/libs/clangsupport/baseserverproxy.h
index 246f0604ecf..797f02999dc 100644
--- a/src/libs/clangsupport/baseserverproxy.h
+++ b/src/libs/clangsupport/baseserverproxy.h
@@ -37,13 +37,14 @@ class CLANGSUPPORT_EXPORT BaseServerProxy
BaseServerProxy &operator=(const BaseServerProxy&) = delete;
public:
+ BaseServerProxy(IpcClientInterface *client, QLocalSocket *localSocket);
BaseServerProxy(IpcClientInterface *client, QIODevice *ioDevice);
void readMessages();
void resetState();
- void setIoDevice(QIODevice *ioDevice);
+ void setLocalSocket(QLocalSocket *localSocket);
protected:
~BaseServerProxy() = default;
diff --git a/src/libs/clangsupport/clangcodemodelclientproxy.cpp b/src/libs/clangsupport/clangcodemodelclientproxy.cpp
index 538677e6c1c..cf3e699e217 100644
--- a/src/libs/clangsupport/clangcodemodelclientproxy.cpp
+++ b/src/libs/clangsupport/clangcodemodelclientproxy.cpp
@@ -31,19 +31,34 @@
#include "messageenvelop.h"
#include <QDebug>
-#include <QIODevice>
+#include <QLocalSocket>
#include <QVariant>
#include <QVector>
namespace ClangBackEnd {
-ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice)
- : m_writeMessageBlock(ioDevice),
- m_readMessageBlock(ioDevice),
- m_server(server),
- m_ioDevice(ioDevice)
+ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server,
+ QLocalSocket *localSocket)
+ : m_writeMessageBlock(localSocket)
+ , m_readMessageBlock(localSocket)
+ , m_server(server)
+ , m_ioDevice(localSocket)
{
- QObject::connect(m_ioDevice, &QIODevice::readyRead, [this] () {ClangCodeModelClientProxy::readMessages();});
+ QObject::connect(m_ioDevice, &QIODevice::readyRead, [this]() {
+ ClangCodeModelClientProxy::readMessages();
+ });
+}
+
+ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server,
+ QIODevice *ioDevice)
+ : m_writeMessageBlock(ioDevice)
+ , m_readMessageBlock(ioDevice)
+ , m_server(server)
+ , m_ioDevice(ioDevice)
+{
+ QObject::connect(m_ioDevice, &QIODevice::readyRead, [this]() {
+ ClangCodeModelClientProxy::readMessages();
+ });
}
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelClientProxy &&other)
@@ -106,9 +121,9 @@ void ClangCodeModelClientProxy::readMessages()
m_server->dispatch(message);
}
-bool ClangCodeModelClientProxy::isUsingThatIoDevice(QIODevice *m_ioDevice) const
+bool ClangCodeModelClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const
{
- return this->m_ioDevice == m_ioDevice;
+ return m_ioDevice == ioDevice;
}
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/clangcodemodelclientproxy.h b/src/libs/clangsupport/clangcodemodelclientproxy.h
index 480cbe646e1..4b0e1f9d2a5 100644
--- a/src/libs/clangsupport/clangcodemodelclientproxy.h
+++ b/src/libs/clangsupport/clangcodemodelclientproxy.h
@@ -36,6 +36,7 @@
QT_BEGIN_NAMESPACE
class QLocalServer;
+class QLocalSocket;
class QIODevice;
QT_END_NAMESPACE
@@ -44,6 +45,8 @@ namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT ClangCodeModelClientProxy : public ClangCodeModelClientInterface
{
public:
+ explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server,
+ QLocalSocket *localSocket);
explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice);
ClangCodeModelClientProxy(const ClangCodeModelClientProxy&) = delete;
const ClangCodeModelClientProxy &operator=(const ClangCodeModelClientProxy&) = delete;
diff --git a/src/libs/clangsupport/clangcodemodelconnectionclient.cpp b/src/libs/clangsupport/clangcodemodelconnectionclient.cpp
index 56186e24dc6..618782d1d82 100644
--- a/src/libs/clangsupport/clangcodemodelconnectionclient.cpp
+++ b/src/libs/clangsupport/clangcodemodelconnectionclient.cpp
@@ -41,12 +41,10 @@ QString currentProcessId()
}
-ClangCodeModelConnectionClient::ClangCodeModelConnectionClient(
- ClangCodeModelClientInterface *client)
+ClangCodeModelConnectionClient::ClangCodeModelConnectionClient(ClangCodeModelClientInterface *client)
: ConnectionClient(Utils::TemporaryDirectory::masterDirectoryPath()
- + QStringLiteral("/ClangBackEnd-")
- + currentProcessId()),
- m_serverProxy(client, nullptr)
+ + QStringLiteral("/ClangBackEnd-") + currentProcessId())
+ , m_serverProxy(client)
{
m_processCreator.setTemporaryDirectoryPattern("clangbackend-XXXXXX");
m_processCreator.setArguments({connectionName()});
@@ -85,9 +83,9 @@ QString ClangCodeModelConnectionClient::outputName() const
return QStringLiteral("ClangCodeModelConnectionClient");
}
-void ClangCodeModelConnectionClient::newConnectedServer(QIODevice *ioDevice)
+void ClangCodeModelConnectionClient::newConnectedServer(QLocalSocket *localSocket)
{
- m_serverProxy.setIoDevice(ioDevice);
+ m_serverProxy.setLocalSocket(localSocket);
}
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/clangcodemodelconnectionclient.h b/src/libs/clangsupport/clangcodemodelconnectionclient.h
index c1618b06d95..9b0e49ae5b3 100644
--- a/src/libs/clangsupport/clangcodemodelconnectionclient.h
+++ b/src/libs/clangsupport/clangcodemodelconnectionclient.h
@@ -41,7 +41,7 @@ protected:
void sendEndCommand() override;
void resetState() override;
QString outputName() const override;
- void newConnectedServer(QIODevice *ioDevice) override;
+ void newConnectedServer(QLocalSocket *localSocket) override;
private:
ClangCodeModelServerProxy m_serverProxy;
diff --git a/src/libs/clangsupport/clangcodemodelserverproxy.cpp b/src/libs/clangsupport/clangcodemodelserverproxy.cpp
index 6d90f20016a..d77e27bffd0 100644
--- a/src/libs/clangsupport/clangcodemodelserverproxy.cpp
+++ b/src/libs/clangsupport/clangcodemodelserverproxy.cpp
@@ -32,6 +32,11 @@
namespace ClangBackEnd {
ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client,
+ QLocalSocket *localSocket)
+ : BaseServerProxy(client, localSocket)
+{}
+
+ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client,
QIODevice *ioDevice)
: BaseServerProxy(client, ioDevice)
{
diff --git a/src/libs/clangsupport/clangcodemodelserverproxy.h b/src/libs/clangsupport/clangcodemodelserverproxy.h
index e18fd37402d..0ea4b016729 100644
--- a/src/libs/clangsupport/clangcodemodelserverproxy.h
+++ b/src/libs/clangsupport/clangcodemodelserverproxy.h
@@ -46,6 +46,7 @@ class CLANGSUPPORT_EXPORT ClangCodeModelServerProxy : public BaseServerProxy,
public ClangCodeModelServerInterface
{
public:
+ ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QLocalSocket *localSocket = {});
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice);
void end() override;
diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h
index 59a4085deef..57ce18e195c 100644
--- a/src/libs/clangsupport/clangsupport_global.h
+++ b/src/libs/clangsupport/clangsupport_global.h
@@ -235,11 +235,5 @@ enum class SymbolTag : uchar
using SymbolTags = Utils::SizedArray<SymbolTag, 7>;
-enum class ProgressType
-{
- Invalid,
- PrecompiledHeader,
- Indexing
-};
-
-}
+enum class ProgressType { Invalid, PrecompiledHeader, Indexing, DependencyCreation };
+} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/connectionclient.h b/src/libs/clangsupport/connectionclient.h
index 8fbc73a06c9..c3ded380293 100644
--- a/src/libs/clangsupport/connectionclient.h
+++ b/src/libs/clangsupport/connectionclient.h
@@ -100,7 +100,7 @@ protected:
QString connectionName() const;
bool event(QEvent* event);
- virtual void newConnectedServer(QIODevice *ioDevice) = 0;
+ virtual void newConnectedServer(QLocalSocket *localSocket) = 0;
private:
static bool isProcessRunning(QProcess *process);
diff --git a/src/libs/clangsupport/pchmanagerclientproxy.cpp b/src/libs/clangsupport/pchmanagerclientproxy.cpp
index 595187d155b..a18ac166d2f 100644
--- a/src/libs/clangsupport/pchmanagerclientproxy.cpp
+++ b/src/libs/clangsupport/pchmanagerclientproxy.cpp
@@ -32,35 +32,29 @@
#include "progressmessage.h"
#include <QDebug>
-#include <QIODevice>
+#include <QLocalSocket>
namespace ClangBackEnd {
-PchManagerClientProxy::PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice)
- : writeMessageBlock(ioDevice),
- readMessageBlock(ioDevice),
- server(server),
- ioDevice(ioDevice)
-{
- QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {PchManagerClientProxy::readMessages();});
-}
-
-PchManagerClientProxy::PchManagerClientProxy(PchManagerClientProxy &&other)
- : writeMessageBlock(std::move(other.writeMessageBlock)),
- readMessageBlock(std::move(other.readMessageBlock)),
- server(std::move(other.server)),
- ioDevice(std::move(other.ioDevice))
+PchManagerClientProxy::PchManagerClientProxy(PchManagerServerInterface *server,
+ QLocalSocket *localSocket)
+ : writeMessageBlock(localSocket)
+ , readMessageBlock(localSocket)
+ , server(server)
{
+ QObject::connect(localSocket, &QIODevice::readyRead, [this]() {
+ PchManagerClientProxy::readMessages();
+ });
}
-PchManagerClientProxy &PchManagerClientProxy::operator=(PchManagerClientProxy &&other)
+PchManagerClientProxy::PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice)
+ : writeMessageBlock(ioDevice)
+ , readMessageBlock(ioDevice)
+ , server(server)
{
- writeMessageBlock = std::move(other.writeMessageBlock);
- readMessageBlock = std::move(other.readMessageBlock);
- server = std::move(other.server);
- ioDevice = std::move(other.ioDevice);
-
- return *this;
+ QObject::connect(ioDevice, &QIODevice::readyRead, [this]() {
+ PchManagerClientProxy::readMessages();
+ });
}
void PchManagerClientProxy::readMessages()
diff --git a/src/libs/clangsupport/pchmanagerclientproxy.h b/src/libs/clangsupport/pchmanagerclientproxy.h
index 8efacf504f0..516b2e3a86f 100644
--- a/src/libs/clangsupport/pchmanagerclientproxy.h
+++ b/src/libs/clangsupport/pchmanagerclientproxy.h
@@ -34,15 +34,16 @@ namespace ClangBackEnd {
class PchManagerServerInterface;
-class CLANGSUPPORT_EXPORT PchManagerClientProxy : public PchManagerClientInterface
+class CLANGSUPPORT_EXPORT PchManagerClientProxy final : public PchManagerClientInterface
{
public:
+ explicit PchManagerClientProxy(PchManagerServerInterface *server, QLocalSocket *localSocket);
explicit PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice);
PchManagerClientProxy(const PchManagerClientProxy&) = delete;
const PchManagerClientProxy &operator=(const PchManagerClientProxy&) = delete;
- PchManagerClientProxy(PchManagerClientProxy&&other);
- PchManagerClientProxy &operator=(PchManagerClientProxy&&other);
+ PchManagerClientProxy(PchManagerClientProxy &&other) = default;
+ PchManagerClientProxy &operator=(PchManagerClientProxy &&other) = default;
void readMessages();
@@ -54,7 +55,6 @@ private:
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
PchManagerServerInterface *server = nullptr;
- QIODevice *ioDevice = nullptr;
};
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/pchmanagerserverproxy.cpp b/src/libs/clangsupport/pchmanagerserverproxy.cpp
index dedbb23d50d..5f1fb03948a 100644
--- a/src/libs/clangsupport/pchmanagerserverproxy.cpp
+++ b/src/libs/clangsupport/pchmanagerserverproxy.cpp
@@ -38,6 +38,11 @@
namespace ClangBackEnd {
+PchManagerServerProxy::PchManagerServerProxy(PchManagerClientInterface *client,
+ QLocalSocket *localSocket)
+ : BaseServerProxy(client, localSocket)
+{}
+
PchManagerServerProxy::PchManagerServerProxy(PchManagerClientInterface *client, QIODevice *ioDevice)
: BaseServerProxy(client, ioDevice)
{
diff --git a/src/libs/clangsupport/pchmanagerserverproxy.h b/src/libs/clangsupport/pchmanagerserverproxy.h
index 570de91a03a..d13d88ee8e8 100644
--- a/src/libs/clangsupport/pchmanagerserverproxy.h
+++ b/src/libs/clangsupport/pchmanagerserverproxy.h
@@ -47,6 +47,7 @@ class CLANGSUPPORT_EXPORT PchManagerServerProxy final : public BaseServerProxy,
public PchManagerServerInterface
{
public:
+ explicit PchManagerServerProxy(PchManagerClientInterface *client, QLocalSocket *localSocket);
explicit PchManagerServerProxy(PchManagerClientInterface *client, QIODevice *ioDevice);
void end() override;
diff --git a/src/libs/clangsupport/progresscounter.h b/src/libs/clangsupport/progresscounter.h
index 449754f9149..21a8e13b777 100644
--- a/src/libs/clangsupport/progresscounter.h
+++ b/src/libs/clangsupport/progresscounter.h
@@ -84,7 +84,7 @@ public:
{
Lock lock(m_mutex);
- return m_total;
+ return m_progress;
}
private:
diff --git a/src/libs/clangsupport/progressmessage.h b/src/libs/clangsupport/progressmessage.h
index e4d79c84161..75902a90c3c 100644
--- a/src/libs/clangsupport/progressmessage.h
+++ b/src/libs/clangsupport/progressmessage.h
@@ -36,23 +36,27 @@ class ProgressMessage
public:
ProgressMessage() = default;
ProgressMessage(ProgressType progressType, int progress, int total)
- : progressType(progressType),
- progress(progress),
- total(total)
+ : progress(progress)
+ , total(total)
+ , progressType(progressType)
{}
friend QDataStream &operator<<(QDataStream &out, const ProgressMessage &message)
{
out << message.progress;
out << message.total;
+ out << static_cast<int>(message.progressType);
return out;
}
friend QDataStream &operator>>(QDataStream &in, ProgressMessage &message)
{
+ int progressTupe;
in >> message.progress;
in >> message.total;
+ in >> progressTupe;
+ message.progressType = static_cast<ProgressType>(progressTupe);
return in;
}
@@ -69,9 +73,9 @@ public:
}
public:
- ProgressType progressType = ProgressType::Invalid;
int progress = 0;
int total = 0;
+ ProgressType progressType = ProgressType::Invalid;
};
DECLARE_MESSAGE(ProgressMessage)
diff --git a/src/libs/clangsupport/refactoringclientproxy.cpp b/src/libs/clangsupport/refactoringclientproxy.cpp
index c2076418440..646cb0e161f 100644
--- a/src/libs/clangsupport/refactoringclientproxy.cpp
+++ b/src/libs/clangsupport/refactoringclientproxy.cpp
@@ -31,36 +31,28 @@
#include "clangrefactoringclientmessages.h"
#include <QDebug>
-#include <QIODevice>
+#include <QLocalSocket>
namespace ClangBackEnd {
-RefactoringClientProxy::RefactoringClientProxy(RefactoringServerInterface *server, QIODevice *ioDevice)
- : writeMessageBlock(ioDevice),
- readMessageBlock(ioDevice),
- server(server),
- ioDevice(ioDevice)
+RefactoringClientProxy::RefactoringClientProxy(RefactoringServerInterface *server,
+ QLocalSocket *localSocket)
+ : writeMessageBlock(localSocket)
+ , readMessageBlock(localSocket)
+ , server(server)
{
- QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {RefactoringClientProxy::readMessages();});
+ QObject::connect(localSocket, &QIODevice::readyRead, [this]() {
+ RefactoringClientProxy::readMessages();
+ });
}
-RefactoringClientProxy::RefactoringClientProxy(RefactoringClientProxy &&other)
- : writeMessageBlock(std::move(other.writeMessageBlock)),
- readMessageBlock(std::move(other.readMessageBlock)),
- server(std::move(other.server)),
- ioDevice(std::move(other.ioDevice))
+RefactoringClientProxy::RefactoringClientProxy(RefactoringServerInterface *server,
+ QIODevice *ioDevice)
+ : writeMessageBlock(ioDevice)
+ , readMessageBlock(ioDevice)
+ , server(server)
{
-
-}
-
-RefactoringClientProxy &RefactoringClientProxy::operator=(RefactoringClientProxy &&other)
-{
- writeMessageBlock = std::move(other.writeMessageBlock);
- readMessageBlock = std::move(other.readMessageBlock);
- server = std::move(other.server);
- ioDevice = std::move(other.ioDevice);
-
- return *this;
+ QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {RefactoringClientProxy::readMessages();});
}
void RefactoringClientProxy::readMessages()
diff --git a/src/libs/clangsupport/refactoringclientproxy.h b/src/libs/clangsupport/refactoringclientproxy.h
index 45ce029120c..07cba05e8d6 100644
--- a/src/libs/clangsupport/refactoringclientproxy.h
+++ b/src/libs/clangsupport/refactoringclientproxy.h
@@ -39,12 +39,13 @@ class RefactoringServerInterface;
class CLANGSUPPORT_EXPORT RefactoringClientProxy : public RefactoringClientInterface
{
public:
+ explicit RefactoringClientProxy(RefactoringServerInterface *server, QLocalSocket *localSocket);
explicit RefactoringClientProxy(RefactoringServerInterface *server, QIODevice *ioDevice);
RefactoringClientProxy(const RefactoringClientProxy&) = delete;
const RefactoringClientProxy &operator=(const RefactoringClientProxy&) = delete;
- RefactoringClientProxy(RefactoringClientProxy&&other);
- RefactoringClientProxy &operator=(RefactoringClientProxy&&other);
+ RefactoringClientProxy(RefactoringClientProxy &&other) = default;
+ RefactoringClientProxy &operator=(RefactoringClientProxy &&other) = default;
void readMessages();
@@ -60,7 +61,6 @@ private:
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
RefactoringServerInterface *server = nullptr;
- QIODevice *ioDevice = nullptr;
};
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/refactoringserverproxy.cpp b/src/libs/clangsupport/refactoringserverproxy.cpp
index 3bc8fe20af5..2208f3a0ce3 100644
--- a/src/libs/clangsupport/refactoringserverproxy.cpp
+++ b/src/libs/clangsupport/refactoringserverproxy.cpp
@@ -34,7 +34,13 @@
namespace ClangBackEnd {
-RefactoringServerProxy::RefactoringServerProxy(RefactoringClientInterface *client, QIODevice *ioDevice)
+RefactoringServerProxy::RefactoringServerProxy(RefactoringClientInterface *client,
+ QLocalSocket *localSocket)
+ : BaseServerProxy(client, localSocket)
+{}
+
+RefactoringServerProxy::RefactoringServerProxy(RefactoringClientInterface *client,
+ QIODevice *ioDevice)
: BaseServerProxy(client, ioDevice)
{
}
diff --git a/src/libs/clangsupport/refactoringserverproxy.h b/src/libs/clangsupport/refactoringserverproxy.h
index 55ae20d4416..34861767d85 100644
--- a/src/libs/clangsupport/refactoringserverproxy.h
+++ b/src/libs/clangsupport/refactoringserverproxy.h
@@ -47,6 +47,8 @@ class CLANGSUPPORT_EXPORT RefactoringServerProxy final : public BaseServerProxy,
public RefactoringServerInterface
{
public:
+ explicit RefactoringServerProxy(RefactoringClientInterface *client,
+ QLocalSocket *localSocket = {});
explicit RefactoringServerProxy(RefactoringClientInterface *client, QIODevice *ioDevice);
void end() override;
diff --git a/src/libs/clangsupport/writemessageblock.cpp b/src/libs/clangsupport/writemessageblock.cpp
index 999c63e9b1f..b3fe4a51edb 100644
--- a/src/libs/clangsupport/writemessageblock.cpp
+++ b/src/libs/clangsupport/writemessageblock.cpp
@@ -29,16 +29,19 @@
#include <QDataStream>
#include <QDebug>
-#include <QIODevice>
+#include <QLocalSocket>
#include <QVariant>
namespace ClangBackEnd {
WriteMessageBlock::WriteMessageBlock(QIODevice *ioDevice)
- : m_messageCounter(0),
- m_ioDevice(ioDevice)
-{
-}
+ : m_ioDevice(ioDevice)
+{}
+
+WriteMessageBlock::WriteMessageBlock(QLocalSocket *localSocket)
+ : m_ioDevice(localSocket)
+ , m_localSocket(localSocket)
+{}
void WriteMessageBlock::write(const MessageEnvelop &message)
{
@@ -74,10 +77,19 @@ void WriteMessageBlock::resetState()
void WriteMessageBlock::setIoDevice(QIODevice *ioDevice)
{
m_ioDevice = ioDevice;
+ if (m_localSocket != ioDevice)
+ m_localSocket = nullptr;
flushBlock();
}
+void WriteMessageBlock::setLocalSocket(QLocalSocket *localSocket)
+{
+ m_localSocket = localSocket;
+
+ setIoDevice(localSocket);
+}
+
void WriteMessageBlock::flushBlock()
{
if (m_ioDevice) {
@@ -85,6 +97,8 @@ void WriteMessageBlock::flushBlock()
m_block.clear();
if (bytesWritten == -1)
qWarning() << "Failed to write data:" << m_ioDevice->errorString();
+ if (m_localSocket)
+ m_localSocket->flush();
}
}
diff --git a/src/libs/clangsupport/writemessageblock.h b/src/libs/clangsupport/writemessageblock.h
index b75f0ce2944..8a126fed36e 100644
--- a/src/libs/clangsupport/writemessageblock.h
+++ b/src/libs/clangsupport/writemessageblock.h
@@ -32,6 +32,7 @@ QT_BEGIN_NAMESPACE
class QVariant;
class QDataStream;
class QIODevice;
+class QLocalSocket;
QT_END_NAMESPACE
namespace ClangBackEnd {
@@ -42,6 +43,7 @@ class WriteMessageBlock
{
public:
WriteMessageBlock(QIODevice *ioDevice = nullptr);
+ WriteMessageBlock(QLocalSocket *localSocket);
void write(const MessageEnvelop &message);
@@ -50,13 +52,15 @@ public:
void resetState();
void setIoDevice(QIODevice *ioDevice);
+ void setLocalSocket(QLocalSocket *localSocket);
void flushBlock();
private:
QByteArray m_block;
- qint64 m_messageCounter;
- QIODevice *m_ioDevice;
+ qint64 m_messageCounter = 0;
+ QIODevice *m_ioDevice = {};
+ QLocalSocket *m_localSocket = {};
};
} // namespace ClangBackEnd
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index a4bfea10b4a..f8874101fe8 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -764,7 +764,7 @@ QByteArray Preprocessor::run(const QString &fileName,
preprocessed.reserve(source.size() * 2); // multiply by 2 because we insert #gen lines.
preprocess(fileName, source, &preprocessed, &includeGuardMacroName, noLines,
markGeneratedTokens, false);
- if (!includeGuardMacroName.isEmpty())
+ if (m_client && !includeGuardMacroName.isEmpty())
m_client->markAsIncludeGuard(includeGuardMacroName);
return preprocessed;
}
@@ -986,10 +986,12 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
if (!expandFunctionlikeMacros()
// Still expand if this originally started with an object-like macro.
&& m_state.m_expansionStatus != Expanding) {
- m_client->notifyMacroReference(m_state.m_bytesOffsetRef + idTk.byteOffset,
- m_state.m_utf16charsOffsetRef + idTk.utf16charOffset,
- idTk.lineno,
- *macro);
+ if (m_client) {
+ m_client->notifyMacroReference(m_state.m_bytesOffsetRef + idTk.byteOffset,
+ m_state.m_utf16charsOffsetRef + idTk.utf16charOffset,
+ idTk.lineno,
+ *macro);
+ }
return false;
}
@@ -1793,7 +1795,7 @@ void Preprocessor::handleDefineDirective(PPToken *tk)
}
}
} else if (macroReference) {
- if (tk->is(T_LPAREN)) {
+ if (m_client && tk->is(T_LPAREN)) {
m_client->notifyMacroReference(previousBytesOffset, previousUtf16charsOffset,
previousLine, *macroReference);
}
diff --git a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
index d00d488586f..db34c904d46 100644
--- a/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
+++ b/src/plugins/clangcodemodel/clangcompletionassistprocessor.cpp
@@ -86,7 +86,7 @@ static void addFunctionOverloadAssistProposalItem(QList<AssistProposalItemInterf
const QString &name)
{
auto *item = static_cast<ClangAssistProposalItem *>(sameItem);
- item->setHasOverloadsWithParameters(true);
+ item->setHasOverloadsWithParameters(codeCompletion.hasParameters);
if (codeCompletion.completionKind == CodeCompletion::ConstructorCompletionKind) {
// It's the constructor, currently constructor definitions do not lead here.
// CLANG-UPGRADE-CHECK: Can we get here with constructor definition?
diff --git a/src/plugins/clangcodemodel/clangdiagnosticfilter.h b/src/plugins/clangcodemodel/clangdiagnosticfilter.h
index 0fe164ecf07..a61734718ea 100644
--- a/src/plugins/clangcodemodel/clangdiagnosticfilter.h
+++ b/src/plugins/clangcodemodel/clangdiagnosticfilter.h
@@ -49,7 +49,7 @@ private:
void filterFixits();
private:
- const QString &m_filePath;
+ const QString m_filePath;
QVector<ClangBackEnd::DiagnosticContainer> m_warningDiagnostics;
QVector<ClangBackEnd::DiagnosticContainer> m_errorDiagnostics;
diff --git a/src/plugins/clangcodemodel/clangfollowsymbol.cpp b/src/plugins/clangcodemodel/clangfollowsymbol.cpp
index 96df23ab20a..f1113de164d 100644
--- a/src/plugins/clangcodemodel/clangfollowsymbol.cpp
+++ b/src/plugins/clangcodemodel/clangfollowsymbol.cpp
@@ -28,6 +28,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanager.h>
+#include <cpptools/cppfollowsymbolundercursor.h>
#include <texteditor/texteditor.h>
#include <clangsupport/tokeninfocontainer.h>
@@ -183,12 +184,22 @@ void ClangFollowSymbol::findLink(const CppTools::CursorInEditor &data,
return processLinkCallback(Utils::Link());
if (!resolveTarget) {
- processLinkCallback(linkAtCursor(cursor,
- data.filePath().toString(),
- static_cast<uint>(line),
- static_cast<uint>(column),
- processor));
- return;
+ Utils::Link link = linkAtCursor(cursor,
+ data.filePath().toString(),
+ static_cast<uint>(line),
+ static_cast<uint>(column),
+ processor);
+ if (link == Utils::Link()) {
+ CppTools::FollowSymbolUnderCursor followSymbol;
+ return followSymbol.findLink(data,
+ std::move(processLinkCallback),
+ false,
+ snapshot,
+ documentFromSemanticInfo,
+ symbolFinder,
+ inNextSplit);
+ }
+ return processLinkCallback(link);
}
QFuture<CppTools::SymbolInfo> infoFuture
diff --git a/src/plugins/clangformat/clangformat.qbs b/src/plugins/clangformat/clangformat.qbs
index c7b9182373a..3e40832c577 100644
--- a/src/plugins/clangformat/clangformat.qbs
+++ b/src/plugins/clangformat/clangformat.qbs
@@ -15,6 +15,7 @@ QtcPlugin {
Depends { name: "Qt.widgets" }
condition: libclang.present
+ && libclang.llvmFormattingLibs.length
&& (!qbs.targetOS.contains("windows") || libclang.llvmBuildModeMatches)
cpp.cxxFlags: {
diff --git a/src/plugins/clangformat/clangformat_dependencies.pri b/src/plugins/clangformat/clangformat_dependencies.pri
index 5f3f81e1328..6822c5d66be 100644
--- a/src/plugins/clangformat/clangformat_dependencies.pri
+++ b/src/plugins/clangformat/clangformat_dependencies.pri
@@ -5,4 +5,4 @@ QTC_LIB_DEPENDS += \
QTC_PLUGIN_DEPENDS += \
cpptools \
projectexplorer \
- texteditor
+ cppeditor
diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp
index 7a87eabcd79..a53eb50adb2 100644
--- a/src/plugins/clangformat/clangformatbaseindenter.cpp
+++ b/src/plugins/clangformat/clangformatbaseindenter.cpp
@@ -136,7 +136,7 @@ int forceIndentWithExtraText(QByteArray &buffer, const QTextBlock &block, bool s
int utf8Offset = Utils::Text::utf8NthLineOffset(block.document(),
buffer,
block.blockNumber() + 1);
- if (firstNonWhitespace > 0)
+ if (firstNonWhitespace >= 0)
utf8Offset += firstNonWhitespace;
else
utf8Offset += blockText.length();
@@ -336,6 +336,7 @@ ClangFormatBaseIndenter::ClangFormatBaseIndenter(QTextDocument *doc)
TextEditor::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffer,
const QTextBlock &startBlock,
const QTextBlock &endBlock,
+ int cursorPositionInEditor,
ReplacementsToKeep replacementsToKeep,
const QChar &typedChar,
bool secondTry) const
@@ -353,17 +354,24 @@ TextEditor::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffer
if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore)
rangeStart = formattingRangeStart(startBlock, buffer, lastSaveRevision());
- if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore) {
- buffer.insert(utf8Offset - 1, " //");
- utf8Offset += 3;
- }
-
adjustFormatStyleForLineBreak(style, replacementsToKeep);
if (typedChar == QChar::Null) {
- for (int index = startBlock.blockNumber(); index <= endBlock.blockNumber(); ++index) {
+ if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore) {
+ if (utf8Offset > 0) {
+ buffer.insert(utf8Offset - 1, " //");
+ utf8Offset += 3;
+ }
utf8Length += forceIndentWithExtraText(buffer,
- m_doc->findBlockByNumber(index),
+ cursorPositionInEditor < 0
+ ? endBlock
+ : m_doc->findBlock(cursorPositionInEditor),
secondTry);
+ } else {
+ for (int index = startBlock.blockNumber(); index <= endBlock.blockNumber(); ++index) {
+ utf8Length += forceIndentWithExtraText(buffer,
+ m_doc->findBlockByNumber(index),
+ secondTry);
+ }
}
}
@@ -394,6 +402,7 @@ TextEditor::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffer
return replacements(originalBuffer,
startBlock,
endBlock,
+ cursorPositionInEditor,
replacementsToKeep,
typedChar,
true);
@@ -468,6 +477,7 @@ TextEditor::Replacements ClangFormatBaseIndenter::indentsFor(QTextBlock startBlo
return replacements(buffer,
startBlock,
endBlock,
+ cursorPositionInEditor,
replacementsToKeep,
typedChar);
}
diff --git a/src/plugins/clangformat/clangformatbaseindenter.h b/src/plugins/clangformat/clangformatbaseindenter.h
index ed63ff6efa3..b412b57d6d4 100644
--- a/src/plugins/clangformat/clangformatbaseindenter.h
+++ b/src/plugins/clangformat/clangformatbaseindenter.h
@@ -87,6 +87,7 @@ private:
TextEditor::Replacements replacements(QByteArray buffer,
const QTextBlock &startBlock,
const QTextBlock &endBlock,
+ int cursorPositionInEditor,
ReplacementsToKeep replacementsToKeep,
const QChar &typedChar = QChar::Null,
bool secondTry = false) const;
diff --git a/src/plugins/clangformat/clangformatconfigwidget.cpp b/src/plugins/clangformat/clangformatconfigwidget.cpp
index f0d4808cf5c..faaf6d937ff 100644
--- a/src/plugins/clangformat/clangformatconfigwidget.cpp
+++ b/src/plugins/clangformat/clangformatconfigwidget.cpp
@@ -23,10 +23,10 @@
**
****************************************************************************/
-
#include "clangformatconfigwidget.h"
#include "clangformatconstants.h"
+#include "clangformatindenter.h"
#include "clangformatsettings.h"
#include "clangformatutils.h"
#include "ui_clangformatconfigwidget.h"
@@ -34,10 +34,17 @@
#include <clang/Format/Format.h>
#include <coreplugin/icore.h>
+#include <cppeditor/cpphighlighter.h>
+#include <cpptools/cppcodestylesnippets.h>
#include <projectexplorer/project.h>
#include <projectexplorer/session.h>
+#include <texteditor/displaysettings.h>
+#include <texteditor/snippets/snippeteditor.h>
+#include <texteditor/textdocument.h>
+#include <texteditor/texteditorsettings.h>
#include <QFile>
+#include <QMessageBox>
#include <sstream>
@@ -45,79 +52,7 @@ using namespace ProjectExplorer;
namespace ClangFormat {
-static void readTable(QTableWidget *table, std::istringstream &stream)
-{
- table->horizontalHeader()->hide();
- table->verticalHeader()->hide();
-
- table->setColumnCount(2);
- table->setRowCount(0);
-
- std::string line;
- while (std::getline(stream, line)) {
- if (line == "---" || line == "...")
- continue;
-
- const size_t firstLetter = line.find_first_not_of(' ');
- if (firstLetter == std::string::npos || line.at(firstLetter) == '#')
- continue;
-
- // Increase indent where it already exists.
- if (firstLetter > 0 && firstLetter < 5)
- line = " " + line;
-
- table->insertRow(table->rowCount());
- const size_t colonPos = line.find_first_of(':');
- auto *keyItem = new QTableWidgetItem;
- auto *valueItem = new QTableWidgetItem;
-
- keyItem->setFlags(keyItem->flags() & ~Qt::ItemFlags(Qt::ItemIsEditable));
- table->setItem(table->rowCount() - 1, 0, keyItem);
- table->setItem(table->rowCount() - 1, 1, valueItem);
-
- if (colonPos == std::string::npos) {
- keyItem->setText(QString::fromStdString(line));
- valueItem->setFlags(valueItem->flags() & ~Qt::ItemFlags(Qt::ItemIsEditable));
- continue;
- }
-
- keyItem->setText(QString::fromStdString(line.substr(0, colonPos)));
-
- const size_t optionValueStart = line.find_first_not_of(' ', colonPos + 1);
- if (optionValueStart == std::string::npos)
- valueItem->setFlags(valueItem->flags() & ~Qt::ItemFlags(Qt::ItemIsEditable));
- else
- valueItem->setText(QString::fromStdString(line.substr(optionValueStart)));
- }
-
- table->resizeColumnToContents(0);
- table->resizeColumnToContents(1);
-}
-
-static QByteArray tableToYAML(QTableWidget *table)
-{
- QByteArray text;
- text += "---\n";
- for (int i = 0; i < table->rowCount(); ++i) {
- auto *keyItem = table->item(i, 0);
- auto *valueItem = table->item(i, 1);
-
- QByteArray itemText = keyItem->text().toUtf8();
- // Change the indent back to 2 spaces
- itemText.replace(" ", " ");
- if (!valueItem->text().isEmpty() || !itemText.trimmed().startsWith('-'))
- itemText += ": ";
- itemText += valueItem->text().toUtf8() + '\n';
-
- text += itemText;
- }
- text += "...\n";
-
- return text;
-}
-
-ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *project,
- QWidget *parent)
+ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *project, QWidget *parent)
: CodeStyleEditorWidget(parent)
, m_project(project)
, m_ui(std::make_unique<Ui::ClangFormatConfigWidget>())
@@ -153,6 +88,17 @@ void ClangFormatConfigWidget::initialize()
m_ui->applyButton->show();
hideGlobalCheckboxes();
+ m_preview = new TextEditor::SnippetEditorWidget(this);
+ m_ui->horizontalLayout_2->addWidget(m_preview);
+ m_preview->setPlainText(QLatin1String(CppTools::Constants::DEFAULT_CODE_STYLE_SNIPPETS[0]));
+ m_preview->textDocument()->setIndenter(new ClangFormatIndenter(m_preview->document()));
+ m_preview->textDocument()->setFontSettings(TextEditor::TextEditorSettings::fontSettings());
+ m_preview->textDocument()->setSyntaxHighlighter(new CppEditor::CppHighlighter);
+
+ TextEditor::DisplaySettings displaySettings = m_preview->displaySettings();
+ displaySettings.m_visualizeWhitespace = true;
+ m_preview->setDisplaySettings(displaySettings);
+
QLayoutItem *lastItem = m_ui->verticalLayout->itemAt(m_ui->verticalLayout->count() - 1);
if (lastItem->spacerItem())
m_ui->verticalLayout->removeItem(lastItem);
@@ -164,8 +110,7 @@ void ClangFormatConfigWidget::initialize()
m_ui->applyButton->hide();
m_ui->verticalLayout->addStretch(1);
- connect(m_ui->createFileButton, &QPushButton::clicked,
- this, [this]() {
+ connect(m_ui->createFileButton, &QPushButton::clicked, this, [this]() {
createStyleFileIfNeeded(false);
initialize();
});
@@ -174,9 +119,11 @@ void ClangFormatConfigWidget::initialize()
m_ui->createFileButton->hide();
+ Utils::FileName fileName;
if (m_project) {
m_ui->projectHasClangFormat->hide();
connect(m_ui->applyButton, &QPushButton::clicked, this, &ClangFormatConfigWidget::apply);
+ fileName = m_project->projectFilePath().appendPath("snippet.cpp");
} else {
const Project *currentProject = SessionManager::startupProject();
if (!currentProject
@@ -186,15 +133,27 @@ void ClangFormatConfigWidget::initialize()
m_ui->projectHasClangFormat->hide();
} else {
m_ui->projectHasClangFormat->setText(
- tr("Current project has its own .clang-format file "
- "and can be configured in Projects > Code Style > C++."));
+ tr("Current project has its own .clang-format file "
+ "and can be configured in Projects > Code Style > C++."));
}
createStyleFileIfNeeded(true);
showGlobalCheckboxes();
m_ui->applyButton->hide();
+ fileName = Utils::FileName::fromString(Core::ICore::userResourcePath())
+ .appendPath("snippet.cpp");
}
+ m_preview->textDocument()->indenter()->setFileName(fileName);
fillTable();
+ updatePreview();
+}
+
+void ClangFormatConfigWidget::updatePreview()
+{
+ QTextCursor cursor(m_preview->document());
+ cursor.setPosition(0);
+ cursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
+ m_preview->textDocument()->autoFormatOrIndent(cursor);
}
void ClangFormatConfigWidget::fillTable()
@@ -202,8 +161,7 @@ void ClangFormatConfigWidget::fillTable()
clang::format::FormatStyle style = m_project ? currentProjectStyle() : currentGlobalStyle();
std::string configText = clang::format::configurationAsText(style);
- std::istringstream stream(configText);
- readTable(m_ui->clangFormatOptionsTable, stream);
+ m_ui->clangFormatOptionsTable->setPlainText(QString::fromStdString(configText));
}
ClangFormatConfigWidget::~ClangFormatConfigWidget() = default;
@@ -218,7 +176,19 @@ void ClangFormatConfigWidget::apply()
settings.write();
}
- const QByteArray text = tableToYAML(m_ui->clangFormatOptionsTable);
+ const QString text = m_ui->clangFormatOptionsTable->toPlainText();
+ clang::format::FormatStyle style;
+ style.Language = clang::format::FormatStyle::LK_Cpp;
+ const std::error_code error = clang::format::parseConfiguration(text.toStdString(), &style);
+ if (error.value() != static_cast<int>(clang::format::ParseError::Success)) {
+ QMessageBox::warning(this,
+ tr("Error in ClangFormat configuration"),
+ QString::fromStdString(error.message()));
+ fillTable();
+ updatePreview();
+ return;
+ }
+
QString filePath;
if (m_project)
filePath = m_project->projectDirectory().appendPath(Constants::SETTINGS_FILE_NAME).toString();
@@ -228,8 +198,10 @@ void ClangFormatConfigWidget::apply()
if (!file.open(QFile::WriteOnly))
return;
- file.write(text);
+ file.write(text.toUtf8());
file.close();
+
+ updatePreview();
}
} // namespace ClangFormat
diff --git a/src/plugins/clangformat/clangformatconfigwidget.h b/src/plugins/clangformat/clangformatconfigwidget.h
index 7d3818b7a52..58570d9bf68 100644
--- a/src/plugins/clangformat/clangformatconfigwidget.h
+++ b/src/plugins/clangformat/clangformatconfigwidget.h
@@ -29,7 +29,12 @@
#include <memory>
-namespace ProjectExplorer { class Project; }
+namespace ProjectExplorer {
+class Project;
+}
+namespace TextEditor {
+class SnippetEditorWidget;
+}
namespace ClangFormat {
@@ -54,7 +59,10 @@ private:
void hideGlobalCheckboxes();
void showGlobalCheckboxes();
+ void updatePreview();
+
ProjectExplorer::Project *m_project;
+ TextEditor::SnippetEditorWidget *m_preview;
std::unique_ptr<Ui::ClangFormatConfigWidget> m_ui;
};
diff --git a/src/plugins/clangformat/clangformatconfigwidget.ui b/src/plugins/clangformat/clangformatconfigwidget.ui
index 2094bca1090..41e40ef1fdc 100644
--- a/src/plugins/clangformat/clangformatconfigwidget.ui
+++ b/src/plugins/clangformat/clangformatconfigwidget.ui
@@ -55,7 +55,11 @@
</widget>
</item>
<item>
- <widget class="QTableWidget" name="clangFormatOptionsTable"/>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QPlainTextEdit" name="clangFormatOptionsTable"/>
+ </item>
+ </layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
diff --git a/src/plugins/clangformat/clangformatindenter.cpp b/src/plugins/clangformat/clangformatindenter.cpp
index ef9dbf5d1ca..42cedb7b6c9 100644
--- a/src/plugins/clangformat/clangformatindenter.cpp
+++ b/src/plugins/clangformat/clangformatindenter.cpp
@@ -84,7 +84,10 @@ Utils::optional<TabSettings> ClangFormatIndenter::tabSettings() const
int ClangFormatIndenter::lastSaveRevision() const
{
- return qobject_cast<TextEditor::TextDocumentLayout *>(m_doc->documentLayout())->lastSaveRevision;
+ auto *layout = qobject_cast<TextEditor::TextDocumentLayout *>(m_doc->documentLayout());
+ if (!layout)
+ return 0;
+ return layout->lastSaveRevision;
}
bool ClangFormatIndenter::formatOnSave() const
diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp
index 6b151020d68..babe94da24f 100644
--- a/src/plugins/clangformat/clangformatutils.cpp
+++ b/src/plugins/clangformat/clangformatutils.cpp
@@ -106,19 +106,44 @@ static Utils::FileName globalPath()
return Utils::FileName::fromString(Core::ICore::userResourcePath());
}
-static bool configForFileExists(Utils::FileName fileName)
+static QString configForFile(Utils::FileName fileName)
{
+ Utils::FileName topProjectPath = projectPath();
+ if (topProjectPath.isEmpty())
+ return QString();
+
QDir projectDir(fileName.parentDir().toString());
while (!projectDir.exists(Constants::SETTINGS_FILE_NAME)
&& !projectDir.exists(Constants::SETTINGS_FILE_ALT_NAME)) {
- if (!projectDir.cdUp())
- return false;
+ if (projectDir.path() == topProjectPath.toString()
+ || !Utils::FileName::fromString(projectDir.path()).isChildOf(topProjectPath)
+ || !projectDir.cdUp()) {
+ return QString();
+ }
}
- return true;
+
+ if (projectDir.exists(Constants::SETTINGS_FILE_NAME))
+ return projectDir.filePath(Constants::SETTINGS_FILE_NAME);
+ return projectDir.filePath(Constants::SETTINGS_FILE_ALT_NAME);
}
-static clang::format::FormatStyle constructStyle(bool isGlobal)
+static clang::format::FormatStyle constructStyle(bool isGlobal,
+ const QByteArray &baseStyle = QByteArray())
{
+ if (!baseStyle.isEmpty()) {
+ // Try to get the style for this base style.
+ Expected<FormatStyle> style = getStyle(baseStyle.toStdString(),
+ "dummy.cpp",
+ baseStyle.toStdString());
+ if (style)
+ return *style;
+
+ handleAllErrors(style.takeError(), [](const ErrorInfoBase &) {
+ // do nothing
+ });
+ // Fallthrough to the default style.
+ }
+
FormatStyle style = getLLVMStyle();
style.BreakBeforeBraces = FormatStyle::BS_Custom;
@@ -151,18 +176,37 @@ void createStyleFileIfNeeded(bool isGlobal)
}
}
+static QByteArray configBaseStyleName(const QString &configFile)
+{
+ if (configFile.isEmpty())
+ return QByteArray();
+
+ QFile config(configFile);
+ if (!config.open(QIODevice::ReadOnly))
+ return QByteArray();
+
+ const QByteArray content = config.readAll();
+ const char basedOnStyle[] = "BasedOnStyle:";
+ int basedOnStyleIndex = content.indexOf(basedOnStyle);
+ if (basedOnStyleIndex < 0)
+ return QByteArray();
+
+ basedOnStyleIndex += sizeof(basedOnStyle) - 1;
+ const int endOfLineIndex = content.indexOf('\n', basedOnStyleIndex);
+ return content
+ .mid(basedOnStyleIndex, endOfLineIndex < 0 ? -1 : endOfLineIndex - basedOnStyleIndex)
+ .trimmed();
+}
+
clang::format::FormatStyle styleForFile(Utils::FileName fileName)
{
bool isGlobal = false;
- if (!configForFileExists(fileName)) {
- if (fileName.isChildOf(projectPath()) && CppCodeStyleSettings::currentProjectCodeStyle()) {
- fileName = projectPath();
- } else {
- fileName = globalPath();
- isGlobal = true;
- }
+ QString configFile = configForFile(fileName);
+ if (configFile.isEmpty()) {
+ Utils::FileName path = fileName = globalPath();
fileName.appendPath(Constants::SAMPLE_FILE_NAME);
- createStyleFileIfNeeded(isGlobal);
+ createStyleFileIfNeeded(true);
+ configFile = path.appendPath(Constants::SETTINGS_FILE_NAME).toString();
}
Expected<FormatStyle> style = format::getStyle("file",
@@ -175,7 +219,7 @@ clang::format::FormatStyle styleForFile(Utils::FileName fileName)
// do nothing
});
- return constructStyle(isGlobal);
+ return constructStyle(isGlobal, configBaseStyleName(configFile));
}
clang::format::FormatStyle currentProjectStyle()
diff --git a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp
index 90ba8f62bc0..8f7ea722426 100644
--- a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp
+++ b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp
@@ -65,12 +65,19 @@ public:
Sqlite::Database database{Utils::PathString{Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}, 1000ms};
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
- ClangPchManager::ProgressManager progressManager{
- [] (QFutureInterface<void> &promise) {
- auto title = QCoreApplication::translate("ClangPchProgressManager", "Creating PCHs", "PCH stands for precompiled header");
- Core::ProgressManager::addTask(promise.future(), title, "pch creation", nullptr);
+ ClangPchManager::ProgressManager pchCreationProgressManager{[](QFutureInterface<void> &promise) {
+ auto title = QCoreApplication::translate("ClangPchProgressManager",
+ "Creating PCHs",
+ "PCH stands for precompiled header");
+ Core::ProgressManager::addTask(promise.future(), title, "pch creation", nullptr);
}};
- PchManagerClient pchManagerClient{progressManager};
+ ClangPchManager::ProgressManager dependencyCreationProgressManager{
+ [](QFutureInterface<void> &promise) {
+ auto title = QCoreApplication::translate("ClangPchProgressManager",
+ "Creating Dependencies");
+ Core::ProgressManager::addTask(promise.future(), title, "dependency creation", nullptr);
+ }};
+ PchManagerClient pchManagerClient{pchCreationProgressManager, dependencyCreationProgressManager};
PchManagerConnectionClient connectionClient{&pchManagerClient};
QtCreatorProjectUpdater<PchManagerProjectUpdater> projectUpdate{connectionClient.serverProxy(),
pchManagerClient,
diff --git a/src/plugins/clangpchmanager/pchmanagerclient.cpp b/src/plugins/clangpchmanager/pchmanagerclient.cpp
index 56e64b2b56f..4b0b5430d7f 100644
--- a/src/plugins/clangpchmanager/pchmanagerclient.cpp
+++ b/src/plugins/clangpchmanager/pchmanagerclient.cpp
@@ -53,7 +53,16 @@ void PchManagerClient::precompiledHeadersUpdated(ClangBackEnd::PrecompiledHeader
void PchManagerClient::progress(ClangBackEnd::ProgressMessage &&message)
{
- m_progressManager.setProgress(message.progress, message.total);
+ switch (message.progressType) {
+ case ClangBackEnd::ProgressType::PrecompiledHeader:
+ m_pchCreationProgressManager.setProgress(message.progress, message.total);
+ break;
+ case ClangBackEnd::ProgressType::DependencyCreation:
+ m_dependencyCreationProgressManager.setProgress(message.progress, message.total);
+ break;
+ default:
+ break;
+ }
}
void PchManagerClient::precompiledHeaderRemoved(const QString &projectPartId)
diff --git a/src/plugins/clangpchmanager/pchmanagerclient.h b/src/plugins/clangpchmanager/pchmanagerclient.h
index d7c0b68f713..ccbd03299af 100644
--- a/src/plugins/clangpchmanager/pchmanagerclient.h
+++ b/src/plugins/clangpchmanager/pchmanagerclient.h
@@ -42,8 +42,10 @@ class CLANGPCHMANAGER_EXPORT PchManagerClient final : public ClangBackEnd::PchMa
{
friend class PchManagerNotifierInterface;
public:
- PchManagerClient(ProgressManagerInterface &progressManager)
- : m_progressManager(progressManager)
+ PchManagerClient(ProgressManagerInterface &pchCreationProgressManager,
+ ProgressManagerInterface &dependencyCreationProgressManager)
+ : m_pchCreationProgressManager(pchCreationProgressManager)
+ , m_dependencyCreationProgressManager(dependencyCreationProgressManager)
{}
void alive() override;
@@ -78,7 +80,8 @@ private:
ClangBackEnd::ProjectPartPchs m_projectPartPchs;
std::vector<PchManagerNotifierInterface*> m_notifiers;
PchManagerConnectionClient *m_connectionClient=nullptr;
- ProgressManagerInterface &m_progressManager;
+ ProgressManagerInterface &m_pchCreationProgressManager;
+ ProgressManagerInterface &m_dependencyCreationProgressManager;
};
} // namespace ClangPchManager
diff --git a/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp b/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp
index 812445610e6..6db0db09745 100644
--- a/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp
+++ b/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp
@@ -87,9 +87,9 @@ QString PchManagerConnectionClient::outputName() const
return QStringLiteral("PchManagerConnectionClient");
}
-void PchManagerConnectionClient::newConnectedServer(QIODevice *ioDevice)
+void PchManagerConnectionClient::newConnectedServer(QLocalSocket *localSocket)
{
- m_serverProxy.setIoDevice(ioDevice);
+ m_serverProxy.setLocalSocket(localSocket);
}
} // namespace ClangPchManager
diff --git a/src/plugins/clangpchmanager/pchmanagerconnectionclient.h b/src/plugins/clangpchmanager/pchmanagerconnectionclient.h
index 672b6ef7cff..7189c83c0b8 100644
--- a/src/plugins/clangpchmanager/pchmanagerconnectionclient.h
+++ b/src/plugins/clangpchmanager/pchmanagerconnectionclient.h
@@ -42,7 +42,7 @@ protected:
void sendEndCommand() override;
void resetState() override;
QString outputName() const override;
- void newConnectedServer(QIODevice *ioDevice) override;
+ void newConnectedServer(QLocalSocket *localSocket) override;
private:
ClangBackEnd::PchManagerServerProxy m_serverProxy;
diff --git a/src/plugins/clangpchmanager/progressmanager.h b/src/plugins/clangpchmanager/progressmanager.h
index cc6ab1946cb..9dc9fc03664 100644
--- a/src/plugins/clangpchmanager/progressmanager.h
+++ b/src/plugins/clangpchmanager/progressmanager.h
@@ -52,7 +52,8 @@ public:
if (!m_promise)
initialize();
- m_promise->setExpectedResultCount(maximumProgress);
+ if (m_promise->progressMaximum() != maximumProgress)
+ m_promise->setProgressRange(0, maximumProgress);
m_promise->setProgressValue(currentProgress);
if (currentProgress >= maximumProgress)
diff --git a/src/plugins/clangrefactoring/refactoringconnectionclient.cpp b/src/plugins/clangrefactoring/refactoringconnectionclient.cpp
index 865c9d53d13..ff66ec20cbf 100644
--- a/src/plugins/clangrefactoring/refactoringconnectionclient.cpp
+++ b/src/plugins/clangrefactoring/refactoringconnectionclient.cpp
@@ -44,9 +44,8 @@ QString currentProcessId()
RefactoringConnectionClient::RefactoringConnectionClient(RefactoringClientInterface *client)
: ConnectionClient(Utils::TemporaryDirectory::masterDirectoryPath()
- + QStringLiteral("/ClangRefactoringBackEnd-")
- + currentProcessId()),
- m_serverProxy(client, nullptr)
+ + QStringLiteral("/ClangRefactoringBackEnd-") + currentProcessId())
+ , m_serverProxy(client)
{
m_processCreator.setTemporaryDirectoryPattern("clangrefactoringbackend-XXXXXX");
m_processCreator.setArguments({connectionName(),
@@ -81,9 +80,9 @@ QString RefactoringConnectionClient::outputName() const
return QStringLiteral("RefactoringConnectionClient");
}
-void RefactoringConnectionClient::newConnectedServer(QIODevice *ioDevice)
+void RefactoringConnectionClient::newConnectedServer(QLocalSocket *localSocket)
{
- m_serverProxy.setIoDevice(ioDevice);
+ m_serverProxy.setLocalSocket(localSocket);
}
} // namespace ClangBackEnd
diff --git a/src/plugins/clangrefactoring/refactoringconnectionclient.h b/src/plugins/clangrefactoring/refactoringconnectionclient.h
index 16734f7ed97..3db871e6a21 100644
--- a/src/plugins/clangrefactoring/refactoringconnectionclient.h
+++ b/src/plugins/clangrefactoring/refactoringconnectionclient.h
@@ -44,7 +44,7 @@ protected:
void sendEndCommand() override;
void resetState() override;
QString outputName() const override;
- void newConnectedServer(QIODevice *ioDevice) override;
+ void newConnectedServer(QLocalSocket *localSocket) override;
private:
RefactoringServerProxy m_serverProxy;
diff --git a/src/plugins/clangtools/clangfixitsrefactoringchanges.cpp b/src/plugins/clangtools/clangfixitsrefactoringchanges.cpp
index 4be95a2744c..c3b6f4ac3ef 100644
--- a/src/plugins/clangtools/clangfixitsrefactoringchanges.cpp
+++ b/src/plugins/clangtools/clangfixitsrefactoringchanges.cpp
@@ -85,9 +85,6 @@ bool FixitsRefactoringFile::apply()
ICodeStylePreferencesFactory *factory = TextEditorSettings::codeStyleFactory(
CppTools::Constants::CPP_SETTINGS_ID);
- const TextEditor::TabSettings tabSettings
- = CppTools::CppCodeStyleSettings::currentProjectTabSettings();
-
// Apply changes
std::unique_ptr<TextEditor::Indenter> indenter;
QString lastFilename;
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 075791b021d..a7531acf1ed 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -35,7 +35,7 @@
#include <QTextDocument>
-using namespace CppEditor::Internal;
+using namespace CppEditor;
using namespace TextEditor;
using namespace CPlusPlus;
diff --git a/src/plugins/cppeditor/cpphighlighter.h b/src/plugins/cppeditor/cpphighlighter.h
index e43ce63172b..a982191b7ec 100644
--- a/src/plugins/cppeditor/cpphighlighter.h
+++ b/src/plugins/cppeditor/cpphighlighter.h
@@ -25,6 +25,8 @@
#pragma once
+#include "cppeditor_global.h"
+
#include <texteditor/syntaxhighlighter.h>
#include <cplusplus/Token.h>
@@ -33,10 +35,7 @@
namespace CppEditor {
-namespace Internal {
-
-
-class CppHighlighter : public TextEditor::SyntaxHighlighter
+class CPPEDITOR_EXPORT CppHighlighter : public TextEditor::SyntaxHighlighter
{
Q_OBJECT
@@ -58,5 +57,4 @@ private:
CPlusPlus::LanguageFeatures m_languageFeatures = CPlusPlus::LanguageFeatures::defaultFeatures();
};
-} // namespace Internal
} // namespace CppEditor
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp
index 39517e6e353..ef62ad1fa32 100644
--- a/src/plugins/cpptools/cppcodestylesettingspage.cpp
+++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp
@@ -26,6 +26,7 @@
#include "cppcodestylesettingspage.h"
#include "cppcodestylepreferences.h"
+#include "cppcodestylesnippets.h"
#include "cpppointerdeclarationformatter.h"
#include "cppqtstyleindenter.h"
#include "cpptoolsconstants.h"
@@ -49,170 +50,6 @@
#include <QTextBlock>
#include <QTextStream>
-static const char *defaultCodeStyleSnippets[] = {
- "#include <math.h>\n"
- "\n"
- "class Complex\n"
- " {\n"
- "public:\n"
- " Complex(double re, double im)\n"
- " : _re(re), _im(im)\n"
- " {}\n"
- " double modulus() const\n"
- " {\n"
- " return sqrt(_re * _re + _im * _im);\n"
- " }\n"
- "private:\n"
- " double _re;\n"
- " double _im;\n"
- " };\n"
- "\n"
- "void bar(int i)\n"
- " {\n"
- " static int counter = 0;\n"
- " counter += i;\n"
- " }\n"
- "\n"
- "namespace Foo\n"
- " {\n"
- " namespace Bar\n"
- " {\n"
- " void foo(int a, int b)\n"
- " {\n"
- " for (int i = 0; i < a; i++)\n"
- " {\n"
- " if (i < b)\n"
- " bar(i);\n"
- " else\n"
- " {\n"
- " bar(i);\n"
- " bar(b);\n"
- " }\n"
- " }\n"
- " }\n"
- " } // namespace Bar\n"
- " } // namespace Foo\n"
- ,
- "#include <math.h>\n"
- "\n"
- "class Complex\n"
- " {\n"
- "public:\n"
- " Complex(double re, double im)\n"
- " : _re(re), _im(im)\n"
- " {}\n"
- " double modulus() const\n"
- " {\n"
- " return sqrt(_re * _re + _im * _im);\n"
- " }\n"
- "private:\n"
- " double _re;\n"
- " double _im;\n"
- " };\n"
- "\n"
- "void bar(int i)\n"
- " {\n"
- " static int counter = 0;\n"
- " counter += i;\n"
- " }\n"
- "\n"
- "namespace Foo\n"
- " {\n"
- " namespace Bar\n"
- " {\n"
- " void foo(int a, int b)\n"
- " {\n"
- " for (int i = 0; i < a; i++)\n"
- " {\n"
- " if (i < b)\n"
- " bar(i);\n"
- " else\n"
- " {\n"
- " bar(i);\n"
- " bar(b);\n"
- " }\n"
- " }\n"
- " }\n"
- " } // namespace Bar\n"
- " } // namespace Foo\n"
- ,
- "namespace Foo\n"
- "{\n"
- "namespace Bar\n"
- "{\n"
- "class FooBar\n"
- " {\n"
- "public:\n"
- " FooBar(int a)\n"
- " : _a(a)\n"
- " {}\n"
- " int calculate() const\n"
- " {\n"
- " if (a > 10)\n"
- " {\n"
- " int b = 2 * a;\n"
- " return a * b;\n"
- " }\n"
- " return -a;\n"
- " }\n"
- "private:\n"
- " int _a;\n"
- " };\n"
- "}\n"
- "}\n"
- ,
- "#include \"bar.h\"\n"
- "\n"
- "int foo(int a)\n"
- " {\n"
- " switch (a)\n"
- " {\n"
- " case 1:\n"
- " bar(1);\n"
- " break;\n"
- " case 2:\n"
- " {\n"
- " bar(2);\n"
- " break;\n"
- " }\n"
- " case 3:\n"
- " default:\n"
- " bar(3);\n"
- " break;\n"
- " }\n"
- " return 0;\n"
- " }\n"
- ,
- "void foo() {\n"
- " if (a &&\n"
- " b)\n"
- " c;\n"
- "\n"
- " while (a ||\n"
- " b)\n"
- " break;\n"
- " a = b +\n"
- " c;\n"
- " myInstance.longMemberName +=\n"
- " foo;\n"
- " myInstance.longMemberName += bar +\n"
- " foo;\n"
- "}\n"
- ,
- "int *foo(const Bar &b1, Bar &&b2, int*, int *&rpi)\n"
- "{\n"
- " int*pi = 0;\n"
- " int*const*const cpcpi = &pi;\n"
- " int*const*pcpi = &pi;\n"
- " int**const cppi = &pi;\n"
- "\n"
- " void (*foo)(char *s) = 0;\n"
- " int (*bar)[] = 0;\n"
- "\n"
- " return pi;\n"
- "}\n"
-};
-
using namespace TextEditor;
namespace CppTools {
@@ -270,7 +107,7 @@ CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
<< m_ui->previewTextEditBraces << m_ui->previewTextEditSwitch
<< m_ui->previewTextEditPadding << m_ui->previewTextEditPointerReferences;
for (int i = 0; i < m_previews.size(); ++i)
- m_previews[i]->setPlainText(QLatin1String(defaultCodeStyleSnippets[i]));
+ m_previews[i]->setPlainText(QLatin1String(Constants::DEFAULT_CODE_STYLE_SNIPPETS[i]));
decorateEditors(TextEditorSettings::fontSettings());
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
diff --git a/src/plugins/cpptools/cppcodestylesnippets.h b/src/plugins/cpptools/cppcodestylesnippets.h
new file mode 100644
index 00000000000..b1f8ce199c5
--- /dev/null
+++ b/src/plugins/cpptools/cppcodestylesnippets.h
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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.
+**
+****************************************************************************/
+
+#pragma once
+
+namespace CppTools {
+namespace Constants {
+
+static const char *DEFAULT_CODE_STYLE_SNIPPETS[]
+ = {"#include <math.h>\n"
+ "\n"
+ "class Complex\n"
+ " {\n"
+ "public:\n"
+ " Complex(double re, double im)\n"
+ " : _re(re), _im(im)\n"
+ " {}\n"
+ " double modulus() const\n"
+ " {\n"
+ " return sqrt(_re * _re + _im * _im);\n"
+ " }\n"
+ "private:\n"
+ " double _re;\n"
+ " double _im;\n"
+ " };\n"
+ "\n"
+ "void bar(int i)\n"
+ " {\n"
+ " static int counter = 0;\n"
+ " counter += i;\n"
+ " }\n"
+ "\n"
+ "namespace Foo\n"
+ " {\n"
+ " namespace Bar\n"
+ " {\n"
+ " void foo(int a, int b)\n"
+ " {\n"
+ " for (int i = 0; i < a; i++)\n"
+ " {\n"
+ " if (i < b)\n"
+ " bar(i);\n"
+ " else\n"
+ " {\n"
+ " bar(i);\n"
+ " bar(b);\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ " } // namespace Bar\n"
+ " } // namespace Foo\n",
+ "#include <math.h>\n"
+ "\n"
+ "class Complex\n"
+ " {\n"
+ "public:\n"
+ " Complex(double re, double im)\n"
+ " : _re(re), _im(im)\n"
+ " {}\n"
+ " double modulus() const\n"
+ " {\n"
+ " return sqrt(_re * _re + _im * _im);\n"
+ " }\n"
+ "private:\n"
+ " double _re;\n"
+ " double _im;\n"
+ " };\n"
+ "\n"
+ "void bar(int i)\n"
+ " {\n"
+ " static int counter = 0;\n"
+ " counter += i;\n"
+ " }\n"
+ "\n"
+ "namespace Foo\n"
+ " {\n"
+ " namespace Bar\n"
+ " {\n"
+ " void foo(int a, int b)\n"
+ " {\n"
+ " for (int i = 0; i < a; i++)\n"
+ " {\n"
+ " if (i < b)\n"
+ " bar(i);\n"
+ " else\n"
+ " {\n"
+ " bar(i);\n"
+ " bar(b);\n"
+ " }\n"
+ " }\n"
+ " }\n"
+ " } // namespace Bar\n"
+ " } // namespace Foo\n",
+ "namespace Foo\n"
+ "{\n"
+ "namespace Bar\n"
+ "{\n"
+ "class FooBar\n"
+ " {\n"
+ "public:\n"
+ " FooBar(int a)\n"
+ " : _a(a)\n"
+ " {}\n"
+ " int calculate() const\n"
+ " {\n"
+ " if (a > 10)\n"
+ " {\n"
+ " int b = 2 * a;\n"
+ " return a * b;\n"
+ " }\n"
+ " return -a;\n"
+ " }\n"
+ "private:\n"
+ " int _a;\n"
+ " };\n"
+ "}\n"
+ "}\n",
+ "#include \"bar.h\"\n"
+ "\n"
+ "int foo(int a)\n"
+ " {\n"
+ " switch (a)\n"
+ " {\n"
+ " case 1:\n"
+ " bar(1);\n"
+ " break;\n"
+ " case 2:\n"
+ " {\n"
+ " bar(2);\n"
+ " break;\n"
+ " }\n"
+ " case 3:\n"
+ " default:\n"
+ " bar(3);\n"
+ " break;\n"
+ " }\n"
+ " return 0;\n"
+ " }\n",
+ "void foo() {\n"
+ " if (a &&\n"
+ " b)\n"
+ " c;\n"
+ "\n"
+ " while (a ||\n"
+ " b)\n"
+ " break;\n"
+ " a = b +\n"
+ " c;\n"
+ " myInstance.longMemberName +=\n"
+ " foo;\n"
+ " myInstance.longMemberName += bar +\n"
+ " foo;\n"
+ "}\n",
+ "int *foo(const Bar &b1, Bar &&b2, int*, int *&rpi)\n"
+ "{\n"
+ " int*pi = 0;\n"
+ " int*const*const cpcpi = &pi;\n"
+ " int*const*pcpi = &pi;\n"
+ " int**const cppi = &pi;\n"
+ "\n"
+ " void (*foo)(char *s) = 0;\n"
+ " int (*bar)[] = 0;\n"
+ "\n"
+ " return pi;\n"
+ "}\n"};
+
+} // namespace Constants
+} // namespace CppTools
diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp
index 5ff64b165da..187f5d5913e 100644
--- a/src/plugins/cpptools/cppfilesettingspage.cpp
+++ b/src/plugins/cpptools/cppfilesettingspage.cpp
@@ -37,6 +37,7 @@
#include <utils/environment.h>
#include <utils/fileutils.h>
+#include <utils/hostosinfo.h>
#include <utils/mimetypes/mimedatabase.h>
#include <QSettings>
@@ -173,7 +174,8 @@ static bool keyWordReplacement(const QString &keyWord,
return true;
}
if (keyWord == QLatin1String("%USER%")) {
- *value = QLatin1String("%{Env:USER}");
+ *value = Utils::HostOsInfo::isWindowsHost() ? QLatin1String("%{Env:USERNAME}")
+ : QLatin1String("%{Env:USER}");
return true;
}
// Environment variables (for example '%$EMAIL%').
diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro
index a55e805af4e..04b7ce1adcc 100644
--- a/src/plugins/cpptools/cpptools.pro
+++ b/src/plugins/cpptools/cpptools.pro
@@ -26,6 +26,7 @@ HEADERS += \
cppcodestylepreferencesfactory.h \
cppcodestylesettings.h \
cppcodestylesettingspage.h \
+ cppcodestylesnippets.h \
cppcompletionassist.h \
cppcompletionassistprocessor.h \
cppcompletionassistprovider.h \
diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs
index 89062d3a21c..85e086ddf92 100644
--- a/src/plugins/cpptools/cpptools.qbs
+++ b/src/plugins/cpptools/cpptools.qbs
@@ -82,6 +82,7 @@ Project {
"cppcodestylesettingspage.cpp",
"cppcodestylesettingspage.h",
"cppcodestylesettingspage.ui",
+ "cppcodestylesnippets.h",
"cppcompletionassist.cpp",
"cppcompletionassist.h",
"cppcompletionassistprocessor.cpp",
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index 76f6301db61..9acc34e6ab5 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -372,24 +372,16 @@ void DebuggerMainWindowPrivate::fixupLayoutIfNeeded()
{
// Evil workaround for QTCREATORBUG-21455: In some so far unknown situation
// the saveLayout/restoreLayout process leads to a situation where some docks
- // does not end up below the perspective toolbar even though they were there
+ // do not end up below the perspective toolbar even though they were there
// initially, leading to an awkward dock layout.
- // This here tries to detect the situation (no other dock directly below the
- // toolbar) and "corrects" that by restoring the default layout.
- const QRect toolbarRect = m_toolBarDock->geometry();
- const int targetX = toolbarRect.left();
- const int targetY = toolbarRect.bottom();
-
- const QList<QDockWidget *> docks = q->dockWidgets();
- for (QDockWidget *dock : docks) {
- const QRect dockRect = dock->geometry();
- // 10 for some decoration wiggle room. Found something below? Good.
- if (targetX == dockRect.left() && qAbs(targetY - dockRect.top()) < 10)
- return;
- }
+ // This here tries to detect the situation (sonmething else in the bottom
+ // area is at the right of the toolbar) "corrects" that by restoring the
+ // default layout.
- qDebug() << "Scrambled dock layout found. Resetting it.";
- resetCurrentPerspective();
+ if (m_toolBarDock->width() != q->width()) {
+ qDebug() << "Scrambled dock layout found. Resetting it.";
+ resetCurrentPerspective();
+ }
}
void DebuggerMainWindowPrivate::selectPerspective(Perspective *perspective)
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 648213c8626..fd1f92ec648 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -1410,7 +1410,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
m_perspective.addWindow(m_engineManagerWindow, Perspective::SplitVertical, nullptr);
m_perspective.addWindow(m_breakpointManagerWindow, Perspective::SplitHorizontal, m_engineManagerWindow);
- m_perspective.addWindow(m_globalLogWindow, Perspective::AddToTab, m_breakpointManagerWindow, false);
+ m_perspective.addWindow(m_globalLogWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea);
setInitialState();
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index d28c6bb2630..9fdd6a27905 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -291,6 +291,7 @@ GitDiffEditorController::GitDiffEditorController(IDocument *document, const QStr
{
connect(&m_decorator, &DescriptionWidgetDecorator::branchListRequested,
this, &GitDiffEditorController::updateBranchList);
+ setDisplayName("Git Diff");
}
void GitDiffEditorController::updateBranchList()
@@ -514,7 +515,9 @@ public:
GitDiffEditorController(document, dir),
m_id(id),
m_state(Idle)
- { }
+ {
+ setDisplayName("Git Show");
+ }
void reload() override;
void processCommandOutput(const QString &output) override;
diff --git a/src/plugins/mercurial/mercurialclient.cpp b/src/plugins/mercurial/mercurialclient.cpp
index 4e3f6e37e35..f311d824c3f 100644
--- a/src/plugins/mercurial/mercurialclient.cpp
+++ b/src/plugins/mercurial/mercurialclient.cpp
@@ -68,6 +68,7 @@ protected:
MercurialDiffEditorController::MercurialDiffEditorController(IDocument *document, const QString &workingDirectory):
VcsBaseDiffEditorController(document, MercurialPlugin::client(), workingDirectory)
{
+ setDisplayName("Hg Diff");
}
void MercurialDiffEditorController::runCommand(const QList<QStringList> &args, QTextCodec *codec)
diff --git a/src/plugins/perfprofiler/PerfProfiler.json.in b/src/plugins/perfprofiler/PerfProfiler.json.in
index 7a0d175bc12..af54edf5499 100644
--- a/src/plugins/perfprofiler/PerfProfiler.json.in
+++ b/src/plugins/perfprofiler/PerfProfiler.json.in
@@ -3,7 +3,6 @@
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"Revision\" : \"$$QTC_PLUGIN_REVISION\",
- \"DisabledByDefault\" : true,
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) $$QTCREATOR_COPYRIGHT_YEAR The Qt Company Ltd\",
\"License\" : [ \"Commercial Usage\",
diff --git a/src/plugins/projectexplorer/abiwidget.cpp b/src/plugins/projectexplorer/abiwidget.cpp
index 835dff757de..7135f2891af 100644
--- a/src/plugins/projectexplorer/abiwidget.cpp
+++ b/src/plugins/projectexplorer/abiwidget.cpp
@@ -140,10 +140,12 @@ AbiWidget::AbiWidget(QWidget *parent) : QWidget(parent),
d->m_wordWidthComboBox = new QComboBox(this);
layout->addWidget(d->m_wordWidthComboBox);
+ d->m_wordWidthComboBox->addItem(Abi::toString(16), 16);
d->m_wordWidthComboBox->addItem(Abi::toString(32), 32);
d->m_wordWidthComboBox->addItem(Abi::toString(64), 64);
d->m_wordWidthComboBox->addItem(Abi::toString(0), 0);
- d->m_wordWidthComboBox->setCurrentIndex(2);
+ // Setup current word width of 0 by default.
+ d->m_wordWidthComboBox->setCurrentIndex(d->m_wordWidthComboBox->count() - 1);
connect(d->m_wordWidthComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &AbiWidget::customComboBoxesChanged);
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index f36a6b9440e..26763ed5d55 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -52,7 +52,6 @@
#include <QLoggingCategory>
#include <QRegularExpression>
-#include <algorithm>
#include <memory>
namespace {
@@ -343,6 +342,11 @@ bool GccToolChain::isValid() const
return fi.isExecutable();
}
+static bool isNetworkCompiler(const QString &dirPath)
+{
+ return dirPath.contains("icecc") || dirPath.contains("distcc");
+}
+
static Utils::FileName findLocalCompiler(const Utils::FileName &compilerPath,
const Environment &env)
{
@@ -351,21 +355,13 @@ static Utils::FileName findLocalCompiler(const Utils::FileName &compilerPath,
// Get the path to the compiler, ignoring direct calls to icecc and distcc as we cannot
// do anything about those.
- const Utils::FileName compilerDir = compilerPath.parentDir();
- const QString compilerDirString = compilerDir.toString();
- if (!compilerDirString.contains("icecc") && !compilerDirString.contains("distcc"))
+ if (!isNetworkCompiler(compilerPath.parentDir().toString()))
return compilerPath;
- FileNameList pathComponents = env.path();
- auto it = std::find_if(pathComponents.begin(), pathComponents.end(),
- [compilerDir](const FileName &p) {
- return p == compilerDir;
+ // Filter out network compilers
+ const FileNameList pathComponents = Utils::filtered(env.path(), [] (const FileName &dirPath) {
+ return !isNetworkCompiler(dirPath.toString());
});
- if (it != pathComponents.end()) {
- std::rotate(pathComponents.begin(), it, pathComponents.end());
- pathComponents.removeFirst(); // remove directory of compilerPath
- // No need to put it at the end again, it is in PATH anyway...
- }
// This effectively searches the PATH twice, once via pathComponents and once via PATH itself:
// searchInPath filters duplicates, so that will not hurt.
@@ -402,15 +398,7 @@ ToolChain::MacroInspectionRunner GccToolChain::createMacroInspectionRunner() con
|| a == "-gcc-toolchain" || a == "-target") {
if (++iArg < allFlags.length())
arguments << a << allFlags.at(iArg);
- } else if (a == "-m128bit-long-double" || a == "-m32" || a == "-m3dnow"
- || a == "-m3dnowa" || a == "-m64" || a == "-m96bit-long-double"
- || a == "-mabm" || a == "-maes" || a.startsWith("-march=") || a == "-mavx"
- || a.startsWith("-masm=") || a.startsWith("-mfloat-abi") || a == "-mcx16"
- || a == "-mfma" || a == "-mfma4" || a == "-mlwp" || a == "-mpclmul"
- || a == "-mpopcnt" || a == "-msse" || a == "-msse2" || a == "-msse2avx"
- || a == "-msse3" || a == "-msse4" || a == "-msse4.1" || a == "-msse4.2"
- || a == "-msse4a" || a == "-mssse3" || a.startsWith("-mtune=")
- || a == "-mxop" || a == "-Os" || a == "-O0" || a == "-O1" || a == "-O2"
+ } else if (a.startsWith("-m") || a == "-Os" || a == "-O0" || a == "-O1" || a == "-O2"
|| a == "-O3" || a == "-ffinite-math-only" || a == "-fshort-double"
|| a == "-fshort-wchar" || a == "-fsignaling-nans" || a == "-fno-inline"
|| a == "-fno-exceptions" || a == "-fstack-protector"
diff --git a/src/plugins/projectexplorer/makestep.ui b/src/plugins/projectexplorer/makestep.ui
index 0ce98f0bae4..b6ddcc68972 100644
--- a/src/plugins/projectexplorer/makestep.ui
+++ b/src/plugins/projectexplorer/makestep.ui
@@ -79,6 +79,9 @@
<property name="minimum">
<number>1</number>
</property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
</widget>
</item>
<item>
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index c3b5d688064..ad588a12bd9 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -44,6 +44,7 @@
#include "projectexplorersettingspage.h"
#include "projectmanager.h"
#include "removetaskhandler.h"
+#include "runconfigurationaspects.h"
#include "kitfeatureprovider.h"
#include "kitmanager.h"
#include "kitoptionspage.h"
@@ -1595,8 +1596,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
tr("The currently active run configuration's executable (if applicable)."),
[]() -> QString {
if (Target *target = activeTarget()) {
- if (RunConfiguration *rc = target->activeRunConfiguration())
- return rc->runnable().executable;
+ if (RunConfiguration *rc = target->activeRunConfiguration()) {
+ // TODO: This duplicates code and is not always correct, but see
+ // QTCREATORBUG-18317.
+ // Solution: Re-introduce RunConfiguration::executable()?
+ if (auto executableAspect = rc->aspect<ExecutableAspect>())
+ return executableAspect->executable().toString();
+ return QString();
+ }
}
return QString();
});
@@ -3459,15 +3466,12 @@ void ProjectExplorerPluginPrivate::removeProject()
Node *node = ProjectTree::findCurrentNode();
if (!node)
return;
- ProjectNode *subProjectNode = node->managingProject();
- if (!subProjectNode)
- return;
- ProjectNode *projectNode = subProjectNode->managingProject();
+ ProjectNode *projectNode = node->managingProject();
if (projectNode) {
- Utils::RemoveFileDialog removeFileDialog(subProjectNode->filePath().toString(), ICore::mainWindow());
+ Utils::RemoveFileDialog removeFileDialog(node->filePath().toString(), ICore::mainWindow());
removeFileDialog.setDeleteFileVisible(false);
if (removeFileDialog.exec() == QDialog::Accepted)
- projectNode->removeSubProject(subProjectNode->filePath().toString());
+ projectNode->removeSubProject(node->filePath().toString());
}
}
diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp
index ae0c72bdd2f..874b38df575 100644
--- a/src/plugins/projectexplorer/projectmodels.cpp
+++ b/src/plugins/projectexplorer/projectmodels.cpp
@@ -378,6 +378,8 @@ void FlatModel::saveExpandData()
void FlatModel::addFolderNode(WrapperNode *parent, FolderNode *folderNode, QSet<Node *> *seen)
{
for (Node *node : folderNode->nodes()) {
+ if (m_filterGeneratedFiles && node->isGenerated())
+ continue;
if (FolderNode *subFolderNode = node->asFolderNode()) {
const bool isHidden = m_filterProjects && !subFolderNode->showInSimpleTree();
if (!isHidden && !seen->contains(subFolderNode)) {
@@ -390,8 +392,7 @@ void FlatModel::addFolderNode(WrapperNode *parent, FolderNode *folderNode, QSet<
addFolderNode(parent, subFolderNode, seen);
}
} else if (FileNode *fileNode = node->asFileNode()) {
- const bool isHidden = m_filterGeneratedFiles && fileNode->isGenerated();
- if (!isHidden && !seen->contains(fileNode)) {
+ if (!seen->contains(fileNode)) {
seen->insert(fileNode);
parent->appendChild(new WrapperNode(fileNode));
}
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
index fc1cdc4e5ac..a3c06295aea 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp
@@ -132,7 +132,7 @@ bool QmakePriFileNode::supportsAction(ProjectAction action, const Node *node) co
break;
}
case ProjectType::SubDirsTemplate:
- if (action == AddSubProject || action == RemoveSubProject || action == AddExistingProject)
+ if (action == AddSubProject || action == AddExistingProject)
return true;
break;
default:
@@ -344,6 +344,13 @@ bool QmakeProFileNode::includedInExactParse() const
return pro && pro->includedInExactParse();
}
+bool QmakeProFileNode::supportsAction(ProjectAction action, const Node *node) const
+{
+ if (action == RemoveSubProject)
+ return parentProjectNode() && !parentProjectNode()->asContainerNode();
+ return QmakePriFileNode::supportsAction(action, node);
+}
+
FolderNode::AddNewInformation QmakeProFileNode::addNewInformation(const QStringList &files, Node *context) const
{
Q_UNUSED(files)
diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.h b/src/plugins/qmakeprojectmanager/qmakenodes.h
index 6b2f79131da..0f25f134745 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodes.h
+++ b/src/plugins/qmakeprojectmanager/qmakenodes.h
@@ -90,6 +90,7 @@ public:
bool isQtcRunnable() const;
bool includedInExactParse() const;
+ bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override;
bool showInSimpleTree() const override;
QString buildKey() const override;
diff --git a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
index adba361c154..5e7f1e78803 100644
--- a/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakenodetreebuilder.cpp
@@ -168,8 +168,12 @@ static void createTree(const QmakePriFile *pri, QmakePriFileNode *node, const Fi
int eid = vfs->idForFileName(file.toString(), QMakeVfs::VfsExact);
vfs->readFile(eid, &contents, &errorMessage);
}
- vfolder->addNode(std::make_unique<ResourceEditor::ResourceTopLevelNode>
- (file, vfolder->filePath(), contents));
+ auto topLevel = std::make_unique<ResourceEditor::ResourceTopLevelNode>
+ (file, vfolder->filePath(), contents);
+ const QString baseName = file.toFileInfo().completeBaseName();
+ topLevel->setIsGenerated(baseName.startsWith("qmake_")
+ || baseName.endsWith("_qmlcache"));
+ vfolder->addNode(std::move(topLevel));
}
} else {
for (const FileName &fn : newFilePaths) {
diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
index c0034972d65..1a401ee953b 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp
@@ -1246,6 +1246,7 @@ static bool evaluateOne(const QmakeEvalInput &input, ProFile *pro,
QStringList basecfgs = reader->values(build + QLatin1String(".CONFIG"));
basecfgs += build;
basecfgs += QLatin1String("build_pass");
+ basecfgs += "qtc_run";
basevars[QLatin1String("BUILD_PASS")] = QStringList(build);
QStringList buildname = reader->values(build + QLatin1String(".name"));
basevars[QLatin1String("BUILD_NAME")] = (buildname.isEmpty() ? QStringList(build) : buildname);
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp
index b5a29ba6208..d440818d4c0 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectimporter.cpp
@@ -265,19 +265,30 @@ void QmakeProjectImporter::deleteDirectoryData(void *directoryData) const
delete static_cast<DirectoryData *>(directoryData);
}
-static ToolChain *preferredToolChain(BaseQtVersion *qtVersion, const FileName &ms,
- const QMakeStepConfig::TargetArchConfig &archConfig)
+static const QList<ToolChain *> preferredToolChains(BaseQtVersion *qtVersion, const FileName &ms,
+ const QMakeStepConfig::TargetArchConfig &archConfig)
{
const FileName spec = ms.isEmpty() ? qtVersion->mkspec() : ms;
const QList<ToolChain *> toolchains = ToolChainManager::toolChains();
QList<Abi> qtAbis = qtVersion->qtAbis();
- return findOr(toolchains, toolchains.isEmpty() ? nullptr : toolchains.first(),
- [&](ToolChain *tc) {
+ const auto matcher = [&](const ToolChain *tc) {
return qtAbis.contains(tc->targetAbi())
- && tc->suggestedMkspecList().contains(spec)
- && QMakeStepConfig::targetArchFor(tc->targetAbi(), qtVersion) == archConfig;
+ && tc->suggestedMkspecList().contains(spec)
+ && QMakeStepConfig::targetArchFor(tc->targetAbi(), qtVersion) == archConfig;
+ };
+ ToolChain * const cxxToolchain = findOrDefault(toolchains, [matcher](const ToolChain *tc) {
+ return tc->language() == ProjectExplorer::Constants::CXX_LANGUAGE_ID && matcher(tc);
});
+ ToolChain * const cToolchain = findOrDefault(toolchains, [matcher](const ToolChain *tc) {
+ return tc->language() == ProjectExplorer::Constants::C_LANGUAGE_ID && matcher(tc);
+ });
+ QList<ToolChain *> chosenToolchains;
+ for (ToolChain * const tc : {cxxToolchain, cToolchain}) {
+ if (tc)
+ chosenToolchains << tc;
+ };
+ return chosenToolchains;
}
Kit *QmakeProjectImporter::createTemporaryKit(const QtProjectImporter::QtVersionData &data,
@@ -288,7 +299,8 @@ Kit *QmakeProjectImporter::createTemporaryKit(const QtProjectImporter::QtVersion
Q_UNUSED(osType); // TODO use this to select the right toolchain?
return QtProjectImporter::createTemporaryKit(data,
[&data, parsedSpec, archConfig](Kit *k) -> void {
- ToolChainKitAspect::setToolChain(k, preferredToolChain(data.qt, parsedSpec, archConfig));
+ for (ToolChain * const tc : preferredToolChains(data.qt, parsedSpec, archConfig))
+ ToolChainKitAspect::setToolChain(k, tc);
if (parsedSpec != data.qt->mkspec())
QmakeKitAspect::setMkspec(k, parsedSpec);
});
diff --git a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
index aa46476ae03..83217ce2bf3 100644
--- a/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/libraryparameters.cpp
@@ -32,6 +32,8 @@
#include <QTextStream>
#include <QStringList>
+#include <cstring>
+
namespace QmakeProjectManager {
namespace Internal {
@@ -150,7 +152,7 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t,
}
QTC_ASSERT(nameIndex != -1, continue);
sourceStr << '\n' << namespaceIndent << signature.left(nameIndex);
- if (signature.at(nameIndex - 1) != ' ')
+ if (!std::strchr("&* ", signature.at(nameIndex - 1).toLatin1()))
sourceStr << ' ';
sourceStr << unqualifiedClassName << "::" << signature.mid(nameIndex) << '\n';
sourceStr << namespaceIndent << "{\n" << indent
diff --git a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
index 0381e2670a6..2aed6d43cd0 100644
--- a/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
+++ b/src/plugins/qmakeprojectmanager/wizards/librarywizarddialog.cpp
@@ -56,7 +56,7 @@ using QSL = QStringList;
static const PluginBaseClasses pluginBaseClasses[] =
{
{"QAccessiblePlugin", "QtGui",
- QSL{"QAccessibleInterface * create(const QString &key, QObject *object)"},
+ QSL{"QAccessibleInterface *create(const QString &key, QObject *object)"},
"QtCore", "accessible", "QAccessibleFactoryInterface"},
{"QGenericPlugin", "QtGui", QSL{"QObject *create(const QString &name, const QString &spec)"},
"QtCore", "generic", "QGenericPluginFactoryInterface"},
diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp
index 8c0c3228580..a6616cf05fe 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp
+++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp
@@ -104,28 +104,29 @@ int GradientModel::addStop(qreal position, const QColor &color)
return -1;
if (m_itemNode.modelNode().hasNodeProperty(gradientPropertyName().toUtf8())) {
- //QmlDesigner::RewriterTransaction transaction = m_itemNode.modelNode().view()->beginRewriterTransaction();
- //### TODO does not work
+ int properPos = 0;
+ try {
- QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
+ QmlDesigner::ModelNode gradientNode = m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
- QmlDesigner::ModelNode gradientStopNode =
- m_itemNode.modelNode().view()->createModelNode("QtQuick.GradientStop",
- m_itemNode.modelNode().view()->majorQtQuickVersion(), 0);
- gradientStopNode.variantProperty("position").setValue(position);
- gradientStopNode.variantProperty("color").setValue(color);
- gradientNode.nodeListProperty("stops").reparentHere(gradientStopNode);
+ QmlDesigner::ModelNode gradientStopNode = createGradientStopNode();
- const QList<QmlDesigner::ModelNode> stopNodes = gradientNode.nodeListProperty("stops").toModelNodeList();
+ gradientStopNode.variantProperty("position").setValue(position);
+ gradientStopNode.variantProperty("color").setValue(color);
+ gradientNode.nodeListProperty("stops").reparentHere(gradientStopNode);
- int properPos = 0;
- for (int i = 0; i < stopNodes.count(); i++) {
- if (QmlDesigner::QmlObjectNode(stopNodes.at(i)).modelValue("position").toReal() < position)
- properPos = i + 1;
- }
- gradientNode.nodeListProperty("stops").slide(stopNodes.count() - 1, properPos);
+ const QList<QmlDesigner::ModelNode> stopNodes = gradientNode.nodeListProperty("stops").toModelNodeList();
- setupModel();
+ for (int i = 0; i < stopNodes.count(); i++) {
+ if (QmlDesigner::QmlObjectNode(stopNodes.at(i)).modelValue("position").toReal() < position)
+ properPos = i + 1;
+ }
+ gradientNode.nodeListProperty("stops").slide(stopNodes.count() - 1, properPos);
+
+ setupModel();
+ } catch (const QmlDesigner::Exception &e) {
+ e.showException();
+ }
return properPos;
}
@@ -155,12 +156,12 @@ void GradientModel::addGradient()
m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).reparentHere(gradientNode);
- QmlDesigner::ModelNode gradientStopNode = view()->createModelNode("QtQuick.GradientStop", view()->majorQtQuickVersion(), 0);
+ QmlDesigner::ModelNode gradientStopNode = createGradientStopNode();
gradientStopNode.variantProperty("position").setValue(0.0);
gradientStopNode.variantProperty("color").setValue(color);
gradientNode.nodeListProperty("stops").reparentHere(gradientStopNode);
- gradientStopNode = view()->createModelNode("QtQuick.GradientStop", view()->majorQtQuickVersion(), 0);
+ gradientStopNode = createGradientStopNode();
gradientStopNode.variantProperty("position").setValue(1.0);
gradientStopNode.variantProperty("color").setValue(QColor(Qt::black));
gradientNode.nodeListProperty("stops").reparentHere(gradientStopNode);
@@ -459,6 +460,17 @@ QmlDesigner::ModelNode GradientModel::createGradientNode()
return gradientNode;
}
+QmlDesigner::ModelNode GradientModel::createGradientStopNode()
+{
+ QByteArray fullTypeName = "QtQuick.GradientStop";
+ auto metaInfo = model()->metaInfo(fullTypeName);
+
+ int minorVersion = metaInfo.minorVersion();
+ int majorVersion = metaInfo.majorVersion();
+
+ return view()->createModelNode(fullTypeName, majorVersion, minorVersion);
+}
+
void GradientModel::setGradientProperty(const QString &propertyName, qreal value)
{
QTC_ASSERT(m_itemNode.isValid(), return);
diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.h b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.h
index ecb9ba53fdd..804731c1e24 100644
--- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.h
+++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.h
@@ -86,6 +86,7 @@ private:
bool hasGradient() const;
bool locked() const;
QmlDesigner::ModelNode createGradientNode();
+ QmlDesigner::ModelNode createGradientStopNode();
private:
QmlDesigner::QmlItemNode m_itemNode;
diff --git a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
index f4cd9c7e796..2b22844bb9c 100644
--- a/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
+++ b/src/plugins/qmldesigner/designercore/model/rewriterview.cpp
@@ -486,6 +486,8 @@ QString RewriterView::auxiliaryDataAsQML() const
QString str = "Designer {\n ";
+ QTC_ASSERT(!m_canonicalIntModelNode.isEmpty(), return {});
+
int columnCount = 0;
for (const auto &node : allModelNodes()) {
QHash<PropertyName, QVariant> data = node.auxiliaryData();
@@ -727,8 +729,11 @@ void RewriterView::setupCanonicalHashes() const
using myPair = std::pair<ModelNode,int>;
std::vector<myPair> data;
- for (const ModelNode &node : allModelNodes())
- data.emplace_back(std::make_pair(node, nodeOffset(node)));
+ for (const ModelNode &node : allModelNodes()) {
+ int offset = nodeOffset(node);
+ QTC_ASSERT(offset > 0, qDebug() << Q_FUNC_INFO << "no offset" << node; return);
+ data.emplace_back(std::make_pair(node, offset));
+ }
std::sort(data.begin(), data.end(), [](myPair a, myPair b) {
return a.second < b.second;
@@ -1066,6 +1071,8 @@ void RewriterView::restoreAuxiliaryData()
setupCanonicalHashes();
+ QTC_ASSERT(!m_canonicalIntModelNode.isEmpty(), return);
+
const QString text = m_textModifier->text();
int startIndex = text.indexOf(annotationsStart());
diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h
index bdaa22bb4b2..9b73dc1faf8 100644
--- a/src/plugins/qmldesigner/designersettings.h
+++ b/src/plugins/qmldesigner/designersettings.h
@@ -65,6 +65,7 @@ const char REFORMAT_UI_QML_FILES[] = "ReformatUiQmlFiles"; /* These setti
const char IGNORE_DEVICE_PIXEL_RATIO[] = "IgnoreDevicePixelRaio"; /* The settings can be used to turn off the feature, if there are serious issues */
const char STANDALONE_MODE[] = "StandAloneMode";
const char ENABLE_TIMELINEVIEW[] = "EnableTimelineView";
+const char ENABLE_TIMELINEVIEW_ENVVAR[] = "QTC_ENABLE_QTQUICKTIMELINE_EDITOR";
}
class DesignerSettings : public QHash<QByteArray, QVariant>
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 84b95cccc3b..09e10c3b0c1 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -194,7 +194,8 @@ bool QmlDesignerPlugin::delayedInitialize()
d->settings.fromSettings(Core::ICore::settings());
d->viewManager.registerViewTakingOwnership(new QmlDesigner::Internal::ConnectionView);
- if (DesignerSettings::getValue(DesignerSettingsKey::ENABLE_TIMELINEVIEW).toBool())
+ if (DesignerSettings::getValue(DesignerSettingsKey::ENABLE_TIMELINEVIEW).toBool()
+ || qEnvironmentVariableIsSet(DesignerSettingsKey::ENABLE_TIMELINEVIEW_ENVVAR))
d->viewManager.registerViewTakingOwnership(new QmlDesigner::TimelineView);
d->viewManager.registerFormEditorToolTakingOwnership(new QmlDesigner::SourceTool);
d->viewManager.registerFormEditorToolTakingOwnership(new QmlDesigner::ColorTool);
diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp
index ba0eb7dd902..9c04012b056 100644
--- a/src/plugins/qtsupport/profilereader.cpp
+++ b/src/plugins/qtsupport/profilereader.cpp
@@ -79,6 +79,7 @@ ProFileReader::ProFileReader(QMakeGlobals *option, QMakeVfs *vfs)
, ProFileEvaluator(option, this, vfs, this)
, m_ignoreLevel(0)
{
+ setExtraConfigs(QStringList("qtc_run"));
}
ProFileReader::~ProFileReader()
diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp
index c5a4d7a427b..cb98654858c 100644
--- a/src/plugins/qtsupport/qtoutputformatter.cpp
+++ b/src/plugins/qtsupport/qtoutputformatter.cpp
@@ -228,7 +228,7 @@ void QtOutputFormatter::handleLink(const QString &href)
if (qmlLineMatch.hasMatch()) {
const QUrl fileUrl = QUrl(qmlLineMatch.captured(1));
const int line = qmlLineMatch.captured(2).toInt();
- openEditor(d->projectFinder.findFile(d->projectFinder.findFile(fileUrl)), line);
+ openEditor(d->projectFinder.findFile(fileUrl), line);
return;
}
diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp
index 39e85f50311..a910de019c0 100644
--- a/src/plugins/texteditor/basefilefind.cpp
+++ b/src/plugins/texteditor/basefilefind.cpp
@@ -65,18 +65,17 @@ public:
InternalEngine() : m_widget(new QWidget) {}
~InternalEngine() override { delete m_widget;}
QString title() const override { return TextEditor::SearchEngine::tr("Internal"); }
- QString toolTip() const override { return QString(); }
+ QString toolTip() const override { return {}; }
QWidget *widget() const override { return m_widget; }
- QVariant parameters() const override { return QVariant(); }
+ QVariant parameters() const override { return {}; }
void readSettings(QSettings * /*settings*/) override {}
void writeSettings(QSettings * /*settings*/) const override {}
QFuture<Utils::FileSearchResultList> executeSearch(
const TextEditor::FileFindParameters &parameters,
BaseFileFind *baseFileFind) override
{
- auto func = parameters.flags & FindRegularExpression
- ? Utils::findInFilesRegExp
- : Utils::findInFiles;
+ const auto func = parameters.flags & FindRegularExpression ? Utils::findInFilesRegExp
+ : Utils::findInFiles;
return func(parameters.text,
baseFileFind->files(parameters.nameFilters, parameters.exclusionFilters,
@@ -112,7 +111,8 @@ public:
class BaseFileFindPrivate
{
public:
- ~BaseFileFindPrivate() { delete m_internalSearchEngine; }
+ BaseFileFindPrivate() : m_internalSearchEngine(std::make_unique<InternalEngine>()) {}
+
QPointer<IFindSupport> m_currentFindSupport;
QLabel *m_resultLabel = nullptr;
@@ -125,7 +125,7 @@ public:
QPointer<QComboBox> m_filterCombo;
QPointer<QComboBox> m_exclusionCombo;
QVector<SearchEngine *> m_searchEngines;
- SearchEngine *m_internalSearchEngine;
+ std::unique_ptr<SearchEngine> m_internalSearchEngine;
int m_currentSearchEngineIndex = -1;
};
@@ -182,8 +182,7 @@ void SearchEngine::setEnabled(bool enabled)
BaseFileFind::BaseFileFind() : d(new BaseFileFindPrivate)
{
- d->m_internalSearchEngine = new InternalEngine;
- addSearchEngine(d->m_internalSearchEngine);
+ addSearchEngine(d->m_internalSearchEngine.get());
}
BaseFileFind::~BaseFileFind()
@@ -200,14 +199,14 @@ QStringList BaseFileFind::fileNameFilters() const
{
if (d->m_filterCombo)
return splitFilterUiText(d->m_filterCombo->currentText());
- return QStringList();
+ return {};
}
QStringList BaseFileFind::fileExclusionFilters() const
{
if (d->m_exclusionCombo)
return splitFilterUiText(d->m_exclusionCombo->currentText());
- return QStringList();
+ return {};
}
SearchEngine *BaseFileFind::currentSearchEngine() const
@@ -233,11 +232,11 @@ void BaseFileFind::setCurrentSearchEngine(int index)
static void displayResult(QFutureWatcher<FileSearchResultList> *watcher,
SearchResult *search, int index)
{
- FileSearchResultList results = watcher->resultAt(index);
+ const FileSearchResultList results = watcher->resultAt(index);
QList<SearchResultItem> items;
- foreach (const FileSearchResult &result, results) {
+ for (const FileSearchResult &result : results) {
SearchResultItem item;
- item.path = QStringList() << QDir::toNativeSeparators(result.fileName);
+ item.path = QStringList(QDir::toNativeSeparators(result.fileName));
item.mainRange.begin.line = result.lineNumber;
item.mainRange.begin.column = result.matchStart;
item.mainRange.end = item.mainRange.begin;
@@ -258,7 +257,7 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
updateComboEntries(d->m_filterCombo, true);
if (d->m_exclusionCombo)
updateComboEntries(d->m_exclusionCombo, true);
- QString tooltip = toolTip();
+ const QString tooltip = toolTip();
SearchResult *search = SearchResultWindow::instance()->startNewSearch(
label(),
@@ -276,20 +275,26 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
parameters.searchEngineParameters = currentSearchEngine()->parameters();
parameters.searchEngineIndex = d->m_currentSearchEngineIndex;
search->setUserData(qVariantFromValue(parameters));
- connect(search, &SearchResult::activated, this, &BaseFileFind::openEditor);
+ connect(search, &SearchResult::activated, this, [this, search](const SearchResultItem &item) {
+ openEditor(search, item);
+ });
if (searchMode == SearchResultWindow::SearchAndReplace)
connect(search, &SearchResult::replaceButtonClicked, this, &BaseFileFind::doReplace);
connect(search, &SearchResult::visibilityChanged, this, &BaseFileFind::hideHighlightAll);
- connect(search, &SearchResult::searchAgainRequested, this, &BaseFileFind::searchAgain);
+ connect(search, &SearchResult::searchAgainRequested, this, [this, search] {
+ searchAgain(search);
+ });
connect(this, &BaseFileFind::enabledChanged, search, &SearchResult::requestEnabledCheck);
- connect(search, &SearchResult::requestEnabledCheck, this, &BaseFileFind::recheckEnabled);
+ connect(search, &SearchResult::requestEnabledCheck, this, [this, search] {
+ recheckEnabled(search);
+ });
runSearch(search);
}
void BaseFileFind::runSearch(SearchResult *search)
{
- FileFindParameters parameters = search->userData().value<FileFindParameters>();
+ const FileFindParameters parameters = search->userData().value<FileFindParameters>();
auto label = new CountingLabel;
connect(search, &SearchResult::countChanged, label, &CountingLabel::updateCount);
auto statusLabel = new CountingLabel;
@@ -341,7 +346,7 @@ void BaseFileFind::doReplace(const QString &text,
const QList<SearchResultItem> &items,
bool preserveCase)
{
- QStringList files = replaceAll(text, items, preserveCase);
+ const QStringList files = replaceAll(text, items, preserveCase);
if (!files.isEmpty()) {
Utils::FadingIndicator::showText(ICore::mainWindow(),
tr("%n occurrences replaced.", nullptr, items.size()),
@@ -391,7 +396,7 @@ QList<QPair<QWidget *, QWidget *>> BaseFileFind::createPatternWidgets()
void BaseFileFind::writeCommonSettings(QSettings *settings)
{
- std::function<QStringList(const QStringList &)> fromNativeSeparators = [](const QStringList &files) {
+ const auto fromNativeSeparators = [](const QStringList &files) -> QStringList {
return Utils::transform(files, &QDir::fromNativeSeparators);
};
@@ -404,7 +409,7 @@ void BaseFileFind::writeCommonSettings(QSettings *settings)
settings->setValue("currentExclusionFilter",
QDir::fromNativeSeparators(d->m_exclusionCombo->currentText()));
- foreach (SearchEngine *searchEngine, d->m_searchEngines)
+ for (const SearchEngine *searchEngine : qAsConst(d->m_searchEngines))
searchEngine->writeSettings(settings);
settings->setValue("currentSearchEngineIndex", d->m_currentSearchEngineIndex);
}
@@ -412,13 +417,13 @@ void BaseFileFind::writeCommonSettings(QSettings *settings)
void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaultFilter,
const QString &defaultExclusionFilter)
{
- std::function<QStringList(const QStringList &)> toNativeSeparators = [](const QStringList &files) {
+ const auto toNativeSeparators = [](const QStringList &files) -> QStringList {
return Utils::transform(files, &QDir::toNativeSeparators);
};
- QStringList filters = settings->value("filters").toStringList();
- if (filters.isEmpty())
- filters << defaultFilter;
+ const QStringList filterSetting = settings->value("filters").toStringList();
+ const QStringList filters = filterSetting.isEmpty() ? QStringList(defaultFilter)
+ : filterSetting;
const QVariant currentFilter = settings->value("currentFilter");
d->m_filterSetting = currentFilter.isValid() ? currentFilter.toString()
: filters.first();
@@ -436,16 +441,15 @@ void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaul
if (d->m_exclusionCombo)
syncComboWithSettings(d->m_exclusionCombo, d->m_exclusionSetting);
- foreach (SearchEngine* searchEngine, d->m_searchEngines)
+ for (SearchEngine* searchEngine : qAsConst(d->m_searchEngines))
searchEngine->readSettings(settings);
const int currentSearchEngineIndex = settings->value("currentSearchEngineIndex", 0).toInt();
syncSearchEngineCombo(currentSearchEngineIndex);
}
-void BaseFileFind::openEditor(const SearchResultItem &item)
+void BaseFileFind::openEditor(SearchResult *result, const SearchResultItem &item)
{
- auto result = qobject_cast<SearchResult *>(sender());
- FileFindParameters parameters = result->userData().value<FileFindParameters>();
+ const FileFindParameters parameters = result->userData().value<FileFindParameters>();
IEditor *openedEditor =
d->m_searchEngines[parameters.searchEngineIndex]->openEditor(item, parameters);
if (!openedEditor)
@@ -468,16 +472,14 @@ void BaseFileFind::hideHighlightAll(bool visible)
d->m_currentFindSupport->clearHighlights();
}
-void BaseFileFind::searchAgain()
+void BaseFileFind::searchAgain(SearchResult *search)
{
- auto search = qobject_cast<SearchResult *>(sender());
search->restart();
runSearch(search);
}
-void BaseFileFind::recheckEnabled()
+void BaseFileFind::recheckEnabled(SearchResult *search)
{
- auto search = qobject_cast<SearchResult *>(sender());
if (!search)
return;
search->setSearchAgainEnabled(isEnabled());
@@ -493,7 +495,7 @@ QStringList BaseFileFind::replaceAll(const QString &text,
RefactoringChanges refactoring;
QHash<QString, QList<SearchResultItem> > changes;
- foreach (const SearchResultItem &item, items)
+ for (const SearchResultItem &item : items)
changes[QDir::fromNativeSeparators(item.path.first())].append(item);
// Checking for files without write permissions
@@ -523,7 +525,7 @@ QStringList BaseFileFind::replaceAll(const QString &text,
ChangeSet changeSet;
RefactoringFilePtr file = refactoring.file(fileName);
QSet<QPair<int, int> > processed;
- foreach (const SearchResultItem &item, changeItems) {
+ for (const SearchResultItem &item : changeItems) {
const QPair<int, int> &p = qMakePair(item.mainRange.begin.line,
item.mainRange.begin.column);
if (processed.contains(p))
diff --git a/src/plugins/texteditor/basefilefind.h b/src/plugins/texteditor/basefilefind.h
index 32595b0398b..1297e1a2ace 100644
--- a/src/plugins/texteditor/basefilefind.h
+++ b/src/plugins/texteditor/basefilefind.h
@@ -67,6 +67,7 @@ class TEXTEDITOR_EXPORT SearchEngine : public QObject
public:
SearchEngine(QObject *parent = nullptr);
~SearchEngine() override;
+
virtual QString title() const = 0;
virtual QString toolTip() const = 0; // add %1 placeholder where the find flags should be put
virtual QWidget *widget() const = 0;
@@ -132,13 +133,13 @@ signals:
void currentSearchEngineChanged();
private:
- void openEditor(const Core::SearchResultItem &item);
+ void openEditor(Core::SearchResult *result, const Core::SearchResultItem &item);
void doReplace(const QString &txt,
const QList<Core::SearchResultItem> &items,
bool preserveCase);
void hideHighlightAll(bool visible);
- void searchAgain();
- void recheckEnabled();
+ void searchAgain(Core::SearchResult *search);
+ void recheckEnabled(Core::SearchResult *search);
void runNewSearch(const QString &txt, Core::FindFlags findFlags,
Core::SearchResultWindow::SearchMode searchMode);
diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp
index 857c0f88cc7..b21af3644c8 100644
--- a/src/plugins/texteditor/highlighter.cpp
+++ b/src/plugins/texteditor/highlighter.cpp
@@ -43,6 +43,10 @@
using namespace TextEditor;
+static const char kDefinitionForMimeType[] = "definitionForMimeType";
+static const char kDefinitionForExtension[] = "definitionForExtension";
+static const char kDefinitionForFilePath[] = "definitionForFilePath";
+
KSyntaxHighlighting::Repository *highlightRepository()
{
static KSyntaxHighlighting::Repository *repository = nullptr;
@@ -107,18 +111,24 @@ Highlighter::Definition Highlighter::definitionForDocument(const TextDocument *d
if (mimeType.isValid())
definition = Highlighter::definitionForMimeType(mimeType.name());
if (!definition.isValid())
- definition = Highlighter::definitionForFileName(document->filePath().fileName());
+ definition = Highlighter::definitionForFilePath(document->filePath());
return definition;
}
Highlighter::Definition Highlighter::definitionForMimeType(const QString &mimeType)
{
+ const Definitions definitions = definitionsForMimeType(mimeType);
+ if (definitions.size() == 1)
+ return definitions.first();
return highlightRepository()->definitionForMimeType(mimeType);
}
-Highlighter::Definition Highlighter::definitionForFileName(const QString &fileName)
+Highlighter::Definition Highlighter::definitionForFilePath(const Utils::FileName &fileName)
{
- return highlightRepository()->definitionForFileName(fileName);
+ const Definitions definitions = definitionsForFileName(fileName);
+ if (definitions.size() == 1)
+ return definitions.first();
+ return highlightRepository()->definitionForFileName(fileName.fileName());
}
Highlighter::Definition Highlighter::definitionForName(const QString &name)
@@ -133,18 +143,88 @@ Highlighter::Definitions Highlighter::definitionsForDocument(const TextDocument
if (mimeType.isValid())
definitions = Highlighter::definitionsForMimeType(mimeType.name());
if (definitions.isEmpty())
- definitions = Highlighter::definitionsForFileName(document->filePath().fileName());
+ definitions = Highlighter::definitionsForFileName(document->filePath());
return definitions;
}
+static Highlighter::Definition definitionForSetting(const QString &settingsKey,
+ const QString &mapKey)
+{
+ QSettings *settings = Core::ICore::settings();
+ settings->beginGroup(Constants::HIGHLIGHTER_SETTINGS_CATEGORY);
+ const QString &definitionName = settings->value(settingsKey).toMap().value(mapKey).toString();
+ settings->endGroup();
+ return Highlighter::definitionForName(definitionName);
+}
+
Highlighter::Definitions Highlighter::definitionsForMimeType(const QString &mimeType)
{
- return highlightRepository()->definitionsForMimeType(mimeType).toList();
+ Definitions definitions = highlightRepository()->definitionsForMimeType(mimeType).toList();
+ if (definitions.size() > 1) {
+ const Definition &rememberedDefinition = definitionForSetting(kDefinitionForMimeType,
+ mimeType);
+ if (rememberedDefinition.isValid() && definitions.contains(rememberedDefinition))
+ definitions = {rememberedDefinition};
+ }
+ return definitions;
+}
+
+Highlighter::Definitions Highlighter::definitionsForFileName(const Utils::FileName &fileName)
+{
+ Definitions definitions
+ = highlightRepository()->definitionsForFileName(fileName.fileName()).toList();
+
+ if (definitions.size() > 1) {
+ const QString &fileExtension = fileName.toFileInfo().completeSuffix();
+ const Definition &rememberedDefinition
+ = fileExtension.isEmpty()
+ ? definitionForSetting(kDefinitionForFilePath,
+ fileName.toFileInfo().canonicalFilePath())
+ : definitionForSetting(kDefinitionForExtension, fileExtension);
+ if (rememberedDefinition.isValid() && definitions.contains(rememberedDefinition))
+ definitions = {rememberedDefinition};
+ }
+
+ return definitions;
+}
+
+void Highlighter::rememberDefintionForDocument(const Highlighter::Definition &definition,
+ const TextDocument *document)
+{
+ if (!definition.isValid())
+ return;
+ const QString &mimeType = document->mimeType();
+ const QString &fileExtension = document->filePath().toFileInfo().completeSuffix();
+ const QString &path = document->filePath().toFileInfo().canonicalFilePath();
+ QSettings *settings = Core::ICore::settings();
+ settings->beginGroup(Constants::HIGHLIGHTER_SETTINGS_CATEGORY);
+ if (!mimeType.isEmpty()) {
+ const QString id(kDefinitionForMimeType);
+ QMap<QString, QVariant> map = settings->value(id).toMap();
+ map.insert(mimeType, definition.name());
+ settings->setValue(id, map);
+ } else if (!fileExtension.isEmpty()) {
+ const QString id(kDefinitionForExtension);
+ QMap<QString, QVariant> map = settings->value(id).toMap();
+ map.insert(fileExtension, definition.name());
+ settings->setValue(id, map);
+ } else if (!path.isEmpty()) {
+ const QString id(kDefinitionForFilePath);
+ QMap<QString, QVariant> map = settings->value(id).toMap();
+ map.insert(document->filePath().toFileInfo().absoluteFilePath(), definition.name());
+ settings->setValue(id, map);
+ }
+ settings->endGroup();
}
-Highlighter::Definitions Highlighter::definitionsForFileName(const QString &fileName)
+void Highlighter::clearDefintionForDocumentCache()
{
- return highlightRepository()->definitionsForFileName(fileName).toList();
+ QSettings *settings = Core::ICore::settings();
+ settings->beginGroup(Constants::HIGHLIGHTER_SETTINGS_CATEGORY);
+ settings->remove(kDefinitionForMimeType);
+ settings->remove(kDefinitionForExtension);
+ settings->remove(kDefinitionForFilePath);
+ settings->endGroup();
}
void Highlighter::addCustomHighlighterPath(const Utils::FileName &path)
diff --git a/src/plugins/texteditor/highlighter.h b/src/plugins/texteditor/highlighter.h
index 776f92faf35..92e7e136c18 100644
--- a/src/plugins/texteditor/highlighter.h
+++ b/src/plugins/texteditor/highlighter.h
@@ -38,6 +38,8 @@ class TextDocument;
class Highlighter : public SyntaxHighlighter, public KSyntaxHighlighting::AbstractHighlighter
{
+ Q_OBJECT
+ Q_INTERFACES(KSyntaxHighlighting::AbstractHighlighter)
public:
using Definition = KSyntaxHighlighting::Definition;
using Definitions = QList<Definition>;
@@ -45,12 +47,16 @@ public:
static Definition definitionForDocument(const TextDocument *document);
static Definition definitionForMimeType(const QString &mimeType);
- static Definition definitionForFileName(const QString &fileName);
+ static Definition definitionForFilePath(const Utils::FileName &fileName);
static Definition definitionForName(const QString &name);
static Definitions definitionsForDocument(const TextDocument *document);
static Definitions definitionsForMimeType(const QString &mimeType);
- static Definitions definitionsForFileName(const QString &fileName);
+ static Definitions definitionsForFileName(const Utils::FileName &fileName);
+
+ static void rememberDefintionForDocument(const Definition &definition,
+ const TextDocument *document);
+ static void clearDefintionForDocumentCache();
static void addCustomHighlighterPath(const Utils::FileName &path);
static void updateDefinitions(std::function<void()> callback = nullptr);
diff --git a/src/plugins/texteditor/highlightersettings.cpp b/src/plugins/texteditor/highlightersettings.cpp
index 76b88b063ab..84afbd79ded 100644
--- a/src/plugins/texteditor/highlightersettings.cpp
+++ b/src/plugins/texteditor/highlightersettings.cpp
@@ -25,6 +25,8 @@
#include "highlightersettings.h"
+#include "texteditorconstants.h"
+
#include <coreplugin/icore.h>
#include <utils/hostosinfo.h>
#include <utils/synchronousprocess.h>
@@ -97,7 +99,6 @@ namespace {
static const QLatin1String kDefinitionFilesPath("UserDefinitionFilesPath");
static const QLatin1String kIgnoredFilesPatterns("IgnoredFilesPatterns");
-static const QLatin1String kGroupPostfix("HighlighterSettings");
QString groupSpecifier(const QString &postFix, const QString &category)
{
@@ -113,7 +114,7 @@ using namespace Internal;
void HighlighterSettings::toSettings(const QString &category, QSettings *s) const
{
- const QString &group = groupSpecifier(kGroupPostfix, category);
+ const QString &group = groupSpecifier(Constants::HIGHLIGHTER_SETTINGS_CATEGORY, category);
s->beginGroup(group);
s->setValue(kDefinitionFilesPath, m_definitionFilesPath);
s->setValue(kIgnoredFilesPatterns, ignoredFilesPatterns());
@@ -122,7 +123,7 @@ void HighlighterSettings::toSettings(const QString &category, QSettings *s) cons
void HighlighterSettings::fromSettings(const QString &category, QSettings *s)
{
- const QString &group = groupSpecifier(kGroupPostfix, category);
+ const QString &group = groupSpecifier(Constants::HIGHLIGHTER_SETTINGS_CATEGORY, category);
s->beginGroup(group);
m_definitionFilesPath = s->value(kDefinitionFilesPath, QString()).toString();
if (!s->contains(kDefinitionFilesPath))
diff --git a/src/plugins/texteditor/highlightersettingspage.cpp b/src/plugins/texteditor/highlightersettingspage.cpp
index ec9d34ee65c..86a1a7fdbf3 100644
--- a/src/plugins/texteditor/highlightersettingspage.cpp
+++ b/src/plugins/texteditor/highlightersettingspage.cpp
@@ -112,6 +112,9 @@ QWidget *HighlighterSettingsPage::widget()
label->setText(tr("Update finished"));
});
});
+ connect(m_d->m_page->resetCache, &QPushButton::clicked, []() {
+ Highlighter::clearDefintionForDocumentCache();
+ });
settingsToUI();
}
diff --git a/src/plugins/texteditor/highlightersettingspage.ui b/src/plugins/texteditor/highlightersettingspage.ui
index bcc5d5fe11b..fcd4919b128 100644
--- a/src/plugins/texteditor/highlightersettingspage.ui
+++ b/src/plugins/texteditor/highlightersettingspage.ui
@@ -110,6 +110,30 @@
</item>
</layout>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="resetCache">
+ <property name="text">
+ <string>Reset Remembered Definitions</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 559617ac2d8..36abfc01e29 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -613,6 +613,7 @@ public:
void reconfigure();
void updateSyntaxInfoBar(const Highlighter::Definitions &definitions, const QString &fileName);
void configureGenericHighlighter(const KSyntaxHighlighting::Definition &definition);
+ void rememberCurrentSyntaxDefinition();
public:
TextEditorWidget *q;
@@ -3306,6 +3307,11 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions
this->configureGenericHighlighter(Highlighter::definitionForName(definition));
});
+ info.setCustomButtonInfo(BaseTextEditor::tr("Remember My Choice"), [multiple, this]() {
+ m_document->infoBar()->removeInfo(multiple);
+ rememberCurrentSyntaxDefinition();
+ });
+
infoBar->removeInfo(missing);
infoBar->addInfo(info);
} else {
@@ -3333,6 +3339,16 @@ void TextEditorWidgetPrivate::configureGenericHighlighter(
m_document->setFontSettings(TextEditorSettings::fontSettings());
}
+void TextEditorWidgetPrivate::rememberCurrentSyntaxDefinition()
+{
+ auto highlighter = qobject_cast<Highlighter *>(m_document->syntaxHighlighter());
+ if (!highlighter)
+ return;
+ const Highlighter::Definition &definition = highlighter->definition();
+ if (definition.isValid())
+ Highlighter::rememberDefintionForDocument(definition, m_document.data());
+}
+
bool TextEditorWidget::codeFoldingVisible() const
{
return d->m_codeFoldingVisible;
@@ -8539,7 +8555,7 @@ QString TextEditorWidget::textAt(int from, int to) const
void TextEditorWidget::configureGenericHighlighter()
{
- const Highlighter::Definitions definitions = Highlighter::definitionsForDocument(textDocument());
+ Highlighter::Definitions definitions = Highlighter::definitionsForDocument(textDocument());
d->configureGenericHighlighter(definitions.isEmpty() ? Highlighter::Definition()
: definitions.first());
d->updateSyntaxInfoBar(definitions, textDocument()->filePath().fileName());
diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h
index 949b4934570..78c9c1cb714 100644
--- a/src/plugins/texteditor/texteditorconstants.h
+++ b/src/plugins/texteditor/texteditorconstants.h
@@ -214,6 +214,8 @@ const char TEXT_EDITOR_DISPLAY_SETTINGS[] = "D.DisplaySettings";
const char TEXT_EDITOR_HIGHLIGHTER_SETTINGS[] = "E.HighlighterSettings";
const char TEXT_EDITOR_SNIPPETS_SETTINGS[] = "F.SnippetsSettings";
+const char HIGHLIGHTER_SETTINGS_CATEGORY[] = "HighlighterSettings";
+
const char SNIPPET_EDITOR_ID[] = "TextEditor.SnippetEditor";
const char TEXT_SNIPPET_GROUP_ID[] = "Text";
diff --git a/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp b/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp
index 6ece9c8b9d9..cb41e7e7d25 100644
--- a/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp
+++ b/src/plugins/vcsbase/vcsbasediffeditorcontroller.cpp
@@ -98,6 +98,7 @@ public:
const QString m_directory;
QString m_startupFile;
QString m_output;
+ QString m_displayName;
QPointer<VcsCommand> m_command;
QPointer<VcsCommandResultProxy> m_commandResultProxy;
QFutureWatcher<QList<FileData>> *m_processWatcher = nullptr;
@@ -251,6 +252,7 @@ void VcsBaseDiffEditorController::runCommand(const QList<QStringList> &args, uns
d->cancelReload();
d->m_command = new VcsCommand(workingDirectory(), d->m_client->processEnvironment());
+ d->m_command->setDisplayName(d->m_displayName);
d->m_command->setCodec(codec ? codec : EditorManager::defaultTextCodec());
d->m_commandResultProxy = new VcsCommandResultProxy(d->m_command.data(), d);
d->m_command->addFlags(flags);
@@ -289,6 +291,11 @@ QString VcsBaseDiffEditorController::startupFile() const
return d->m_startupFile;
}
+void VcsBaseDiffEditorController::setDisplayName(const QString &displayName)
+{
+ d->m_displayName = displayName;
+}
+
} // namespace VcsBase
#include "vcsbasediffeditorcontroller.moc"
diff --git a/src/plugins/vcsbase/vcsbasediffeditorcontroller.h b/src/plugins/vcsbase/vcsbasediffeditorcontroller.h
index eb6e97157f0..8b4668dbf05 100644
--- a/src/plugins/vcsbase/vcsbasediffeditorcontroller.h
+++ b/src/plugins/vcsbase/vcsbasediffeditorcontroller.h
@@ -53,6 +53,7 @@ protected:
QString workingDirectory() const;
void setStartupFile(const QString &startupFile);
QString startupFile() const;
+ void setDisplayName(const QString &displayName);
private:
friend class VcsBaseDiffEditorControllerPrivate;
diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri
index 4629aedaab4..6c820dc36d9 100644
--- a/src/shared/clang/clang_installation.pri
+++ b/src/shared/clang/clang_installation.pri
@@ -150,25 +150,6 @@ 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
- ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions -lclangTooling -lclangToolingCore \
- -lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
- -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
- -lclangASTMatchers -lclangAST -lclangLex -lclangBasic
- } else:versionIsAtLeast($$LLVM_VERSION, 6, 0, 0): {
- CLANGFORMAT_LIBS=-lclangFormat -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
- ALL_CLANG_LIBS=-lclangFormat -lclangTooling -lclangToolingCore \
- -lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
- -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
- -lclangASTMatchers -lclangAST -lclangLex -lclangBasic
- }
-
- win32:CLANGFORMAT_LIBS += -lversion
- win32:ALL_CLANG_LIBS += -lversion
-}
-
isEmpty(LLVM_VERSION) {
$$llvmWarningOrError(\
"Cannot determine clang version. Set LLVM_INSTALL_DIR to build the Clang Code Model",\
@@ -204,6 +185,25 @@ isEmpty(LLVM_VERSION) {
LLVM_STATIC_LIBS = $$split(LLVM_STATIC_LIBS_STRING, " ")
+ CLANGFORMAT_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang/Format/Format.h
+ exists($$CLANGFORMAT_MAIN_HEADER) {
+ versionIsAtLeast($$LLVM_VERSION, 7, 0, 0): {
+ CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
+ ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions -lclangTooling -lclangToolingCore \
+ -lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
+ -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
+ -lclangASTMatchers -lclangAST -lclangLex -lclangBasic
+ } else:versionIsAtLeast($$LLVM_VERSION, 6, 0, 0): {
+ CLANGFORMAT_LIBS=-lclangFormat -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic
+ ALL_CLANG_LIBS=-lclangFormat -lclangTooling -lclangToolingCore \
+ -lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \
+ -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \
+ -lclangASTMatchers -lclangAST -lclangLex -lclangBasic
+ }
+ win32:CLANGFORMAT_LIBS += -lversion
+ }
+ win32:ALL_CLANG_LIBS += -lversion
+
LIBCLANG_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang-c/Index.h
!exists($$LIBCLANG_MAIN_HEADER) {
$$llvmWarningOrError(\
@@ -231,7 +231,9 @@ isEmpty(LLVM_VERSION) {
warning("Clang LibTooling is disabled. Set QTC_ENABLE_CLANG_LIBTOOLING to enable it.")
}
- CLANGFORMAT_LIBS = -L$${LLVM_LIBDIR} $$CLANGFORMAT_LIBS $$LLVM_STATIC_LIBS
+ !isEmpty(CLANGFORMAT_LIBS) {
+ CLANGFORMAT_LIBS = -L$${LLVM_LIBDIR} $$CLANGFORMAT_LIBS $$LLVM_STATIC_LIBS
+ }
ALL_CLANG_LIBS = -L$${LLVM_LIBDIR} $$ALL_CLANG_LIBS $$CLANG_LIB $$LLVM_STATIC_LIBS
contains(QMAKE_DEFAULT_INCDIRS, $$LLVM_INCLUDEPATH): LLVM_INCLUDEPATH =
diff --git a/src/shared/proparser/ioutils.cpp b/src/shared/proparser/ioutils.cpp
index f678ea9fb03..302811cac44 100644
--- a/src/shared/proparser/ioutils.cpp
+++ b/src/shared/proparser/ioutils.cpp
@@ -106,8 +106,8 @@ QString IoUtils::resolvePath(const QString &baseDir, const QString &fileName)
return QDir::cleanPath(fileName);
#ifdef Q_OS_WIN // Add drive to otherwise-absolute path:
if (fileName.at(0).unicode() == '/' || fileName.at(0).unicode() == '\\') {
- Q_ASSERT(isAbsolutePath(baseDir));
- return QDir::cleanPath(baseDir.left(2) + fileName);
+ return isAbsolutePath(baseDir) ? QDir::cleanPath(baseDir.left(2) + fileName)
+ : QDir::cleanPath(fileName);
}
#endif // Q_OS_WIN
return QDir::cleanPath(baseDir + QLatin1Char('/') + fileName);
diff --git a/src/shared/qbs b/src/shared/qbs
-Subproject bceae1097f6a57f1339ea3a4e6827d6195860d3
+Subproject 50eb4d183ccb526874cefe73c7f4c2129769aa4
diff --git a/src/tools/clangbackend/source/clangtooltipinfocollector.cpp b/src/tools/clangbackend/source/clangtooltipinfocollector.cpp
index 8eb15eb89e0..beecf63bb66 100644
--- a/src/tools/clangbackend/source/clangtooltipinfocollector.cpp
+++ b/src/tools/clangbackend/source/clangtooltipinfocollector.cpp
@@ -36,6 +36,7 @@
#include <clangsupport/sourcerangecontainer.h>
#include <utils/qtcassert.h>
#include <utils/textfileformat.h>
+#include <utils/qtcassert.h>
#include <utf8string.h>
@@ -392,7 +393,7 @@ static bool isBuiltinOrPointerToBuiltin(const Type &type)
// TODO: Simplify
// TODO: Test with **
- while (theType.pointeeType().isValid()) {
+ while (theType.pointeeType().isValid() && theType != theType.pointeeType()) {
theType = theType.pointeeType();
if (theType.isBuiltinType())
return true;
@@ -436,7 +437,7 @@ ToolTipInfo ToolTipInfoCollector::qDocInfo(const Cursor &cursor) const
}
Type type = cursor.type();
- while (type.pointeeType().isValid())
+ while (type.pointeeType().isValid() && type != type.pointeeType())
type = type.pointeeType();
const Cursor typeCursor = type.declaration();
diff --git a/src/tools/clangbackend/source/clangtype.cpp b/src/tools/clangbackend/source/clangtype.cpp
index 46ed23d54c0..af58f715959 100644
--- a/src/tools/clangbackend/source/clangtype.cpp
+++ b/src/tools/clangbackend/source/clangtype.cpp
@@ -245,6 +245,11 @@ bool operator==(Type first, Type second)
return clang_equalTypes(first.m_cxType, second.m_cxType);
}
+bool operator!=(Type first, Type second)
+{
+ return !operator==(first, second);
+}
+
std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind)
{
ClangString typeKindSpelling(clang_getTypeKindSpelling(typeKind));
diff --git a/src/tools/clangbackend/source/clangtype.h b/src/tools/clangbackend/source/clangtype.h
index ed6977ee73e..53953392e36 100644
--- a/src/tools/clangbackend/source/clangtype.h
+++ b/src/tools/clangbackend/source/clangtype.h
@@ -81,6 +81,7 @@ private:
};
bool operator==(Type first, Type second);
+bool operator!=(Type first, Type second);
std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind);
std::ostream &operator<<(std::ostream &os, const Type &type);
diff --git a/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp b/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp
index f4afaf9210d..17af1a2bc31 100644
--- a/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp
+++ b/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp
@@ -224,12 +224,19 @@ struct Data // because we have a cycle dependency
clangPchManagerServer,
includeWatcher};
PrecompiledHeaderStorage<> preCompiledHeaderStorage{database};
- ClangBackEnd::ProgressCounter progressCounter{[&](int progress, int total) {
- executeInLoop([&] { clangPchManagerServer.setProgress(progress, total); });
+ ClangBackEnd::ProgressCounter pchCreationProgressCounter{[&](int progress, int total) {
+ executeInLoop([&] {
+ clangPchManagerServer.setPchCreationProgress(progress, total);
+ });
+ }};
+ ClangBackEnd::ProgressCounter dependencyCreationProgressCounter{[&](int progress, int total) {
+ executeInLoop([&] {
+ clangPchManagerServer.setDependencyCreationProgress(progress, total);
+ });
}};
ClangBackEnd::PchTaskQueue pchTaskQueue{systemTaskScheduler,
projectTaskScheduler,
- progressCounter,
+ pchCreationProgressCounter,
preCompiledHeaderStorage,
database};
ClangBackEnd::PchTasksMerger pchTaskMerger{pchTaskQueue};
@@ -248,19 +255,19 @@ struct Data // because we have a cycle dependency
database};
ClangBackEnd::PchTaskGenerator pchTaskGenerator{buildDependencyProvider,
pchTaskMerger,
- progressCounter};
+ dependencyCreationProgressCounter};
PchManagerServer clangPchManagerServer{includeWatcher,
pchTaskGenerator,
projectParts,
generatedFiles};
TaskScheduler systemTaskScheduler{pchCreatorManager,
pchTaskQueue,
- progressCounter,
+ pchCreationProgressCounter,
std::thread::hardware_concurrency(),
ClangBackEnd::CallDoInMainThreadAfterFinished::No};
TaskScheduler projectTaskScheduler{pchCreatorManager,
pchTaskQueue,
- progressCounter,
+ pchCreationProgressCounter,
std::thread::hardware_concurrency(),
ClangBackEnd::CallDoInMainThreadAfterFinished::Yes};
};
diff --git a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri
index fa8d6e527a6..94d9540beae 100644
--- a/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri
+++ b/src/tools/clangpchmanagerbackend/source/clangpchmanagerbackend-source.pri
@@ -9,6 +9,7 @@ SOURCES += \
$$PWD/pchtaskqueue.cpp
HEADERS += \
+ $$PWD/pchcreatorincludes.h \
$$PWD/pchmanagerserver.h \
$$PWD/clangpchmanagerbackend_global.h \
$$PWD/pchnotcreatederror.h \
diff --git a/src/tools/clangpchmanagerbackend/source/pchcreator.h b/src/tools/clangpchmanagerbackend/source/pchcreator.h
index 7c736dd2342..73f185176d7 100644
--- a/src/tools/clangpchmanagerbackend/source/pchcreator.h
+++ b/src/tools/clangpchmanagerbackend/source/pchcreator.h
@@ -27,6 +27,7 @@
#include "pchcreatorinterface.h"
+#include "pchcreatorincludes.h"
#include "idpaths.h"
#include "sourceentry.h"
#include "clangtool.h"
@@ -49,14 +50,6 @@ class GeneratedFiles;
class PchManagerClientInterface;
class ClangPathWatcherInterface;
-class PchCreatorIncludes
-{
-public:
- FilePathIds includeIds;
- FilePathIds topIncludeIds;
- FilePathIds topSystemIncludeIds;
-};
-
class PchCreator final : public PchCreatorInterface
{
public:
diff --git a/src/tools/clangpchmanagerbackend/source/pchcreatorincludes.h b/src/tools/clangpchmanagerbackend/source/pchcreatorincludes.h
new file mode 100644
index 00000000000..6854c599070
--- /dev/null
+++ b/src/tools/clangpchmanagerbackend/source/pchcreatorincludes.h
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <filepathid.h>
+
+namespace ClangBackEnd {
+
+class PchCreatorIncludes
+{
+public:
+ FilePathIds includeIds;
+ FilePathIds topIncludeIds;
+ FilePathIds topSystemIncludeIds;
+};
+
+} // namespace ClangBackEnd
diff --git a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp
index 06adccff5b4..999da264488 100644
--- a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp
+++ b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.cpp
@@ -132,9 +132,14 @@ void PchManagerServer::pathsChanged(const FilePathIds &/*filePathIds*/)
{
}
-void PchManagerServer::setProgress(int progress, int total)
+void PchManagerServer::setPchCreationProgress(int progress, int total)
{
client()->progress({ProgressType::PrecompiledHeader, progress, total});
}
+void PchManagerServer::setDependencyCreationProgress(int progress, int total)
+{
+ client()->progress({ProgressType::DependencyCreation, progress, total});
+}
+
} // namespace ClangBackEnd
diff --git a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h
index 0c4bd0cc663..bf6b5bd7e76 100644
--- a/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h
+++ b/src/tools/clangpchmanagerbackend/source/pchmanagerserver.h
@@ -60,7 +60,8 @@ public:
void pathsWithIdsChanged(const Utils::SmallStringVector &ids) override;
void pathsChanged(const FilePathIds &filePathIds) override;
- void setProgress(int progress, int total);
+ void setPchCreationProgress(int progress, int total);
+ void setDependencyCreationProgress(int progress, int total);
private:
ClangPathWatcherInterface &m_fileSystemWatcher;
diff --git a/src/tools/clangrefactoringbackend/source/clangtool.cpp b/src/tools/clangrefactoringbackend/source/clangtool.cpp
index 1798504a692..b96f479a81e 100644
--- a/src/tools/clangrefactoringbackend/source/clangtool.cpp
+++ b/src/tools/clangrefactoringbackend/source/clangtool.cpp
@@ -31,21 +31,6 @@
namespace ClangBackEnd {
-namespace {
-
-// use std::filesystem::path if it is supported by all compilers
-
-template <typename String>
-String toNativePath(String &&path)
-{
-#ifdef _WIN32
- std::replace(path.begin(), path.end(), '/', '\\');
-#endif
-
- return std::move(path);
-}
-}
-
void ClangTool::addFile(FilePath &&filePath,
Utils::SmallString &&content,
Utils::SmallStringVector &&commandLine)
@@ -72,7 +57,7 @@ void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
m_unsavedFileContents.reserve(m_unsavedFileContents.size() + unsavedFiles.size());
auto convertToUnsavedFileContent = [](const V2::FileContainer &unsavedFile) {
- return UnsavedFileContent{NativeFilePath{unsavedFile.filePath},
+ return UnsavedFileContent{unsavedFile.filePath.clone(),
unsavedFile.unsavedFileContent.clone()};
};
@@ -83,7 +68,7 @@ void ClangTool::addUnsavedFiles(const V2::FileContainers &unsavedFiles)
}
namespace {
-template <typename String>
+template<typename String>
llvm::StringRef toStringRef(const String &string)
{
return llvm::StringRef(string.data(), string.size());
diff --git a/src/tools/clangrefactoringbackend/source/clangtool.h b/src/tools/clangrefactoringbackend/source/clangtool.h
index 2abad0f49b5..1f266e86ebf 100644
--- a/src/tools/clangrefactoringbackend/source/clangtool.h
+++ b/src/tools/clangrefactoringbackend/source/clangtool.h
@@ -55,12 +55,12 @@ struct FileContent
struct UnsavedFileContent
{
- UnsavedFileContent(NativeFilePath &&filePath, Utils::SmallString &&content)
+ UnsavedFileContent(FilePath &&filePath, Utils::SmallString &&content)
: filePath(std::move(filePath))
, content(std::move(content))
{}
- NativeFilePath filePath;
+ FilePath filePath;
Utils::SmallString content;
};
diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp
index 63f0f25bf40..91d1918de6f 100644
--- a/tests/auto/debugger/tst_dumpers.cpp
+++ b/tests/auto/debugger/tst_dumpers.cpp
@@ -2828,8 +2828,8 @@ void tst_Dumpers::dumper_data()
+ Check("ob", "\"An Object\"", "@QWidget")
+ Check("ob1", "\"Another Object\"", "@QObject")
+ Check("ob2", "\"A Subobject\"", "@QObject")
- + Check("ob.[extra].[connections].0.0.receiver", "\"Another Object\"",
- "@QObject") % NoCdbEngine;
+ + Check("ob.[extra].[connections].@1.0.0.receiver", "\"Another Object\"",
+ "@QObject") % NoCdbEngine % QtVersion(0x50b00);
QString senderData =
diff --git a/tests/system/suite_APTW/tst_APTW03/test.py b/tests/system/suite_APTW/tst_APTW03/test.py
index bab90c9459d..521a3f1772e 100644
--- a/tests/system/suite_APTW/tst_APTW03/test.py
+++ b/tests/system/suite_APTW/tst_APTW03/test.py
@@ -85,11 +85,7 @@ def main():
checkSimpleCppLib("SampleApp1", False)
checkSimpleCppLib("SampleApp2", True)
- pluginTargets = Targets.desktopTargetClasses()
- pluginTargets.remove(Targets.DESKTOP_4_8_7_DEFAULT)
- if platform.system() in ('Microsoft', 'Windows'):
- # No C++11 in GCC 4.9
- pluginTargets.remove(Targets.DESKTOP_5_4_1_GCC)
+ pluginTargets = (Targets.DESKTOP_5_6_1_DEFAULT, Targets.DESKTOP_5_10_1_DEFAULT)
projectName, className = createNewQtPlugin(tempDir(), "SampleApp3", "MyPlugin", pluginTargets)
virtualFunctionsAdded = False
for kit, config in iterateBuildConfigs("Debug"):
@@ -103,7 +99,7 @@ def main():
continue
editor = getEditorForFileSuffix("%s.cpp" % className.lower())
initialContent = str(editor.plainText)
- test.verify("QObject * %s::create(" % className in initialContent,
+ test.verify("QObject *%s::create(" % className in initialContent,
"Verifying whether pure virtual function has been added to the source file.")
if not openDocument("%s.Headers.%s\.h" % (projectName, className.lower())):
test.fatal("Could not open %s.h - continuing." % className.lower())
@@ -131,7 +127,7 @@ def main():
"Verifying whether event() definition has been added to the source file.")
# add return to not run into build issues of missing return values
addReturn(editor, "bool %s::event.*" % className, "true")
- addReturn(editor, "QObject \* %s::create.*" % className, "0")
+ addReturn(editor, "QObject \*%s::create.*" % className, "0")
placeCursorToLine(editor, 'static_assert\(false, .*', True)
invokeContextMenuItem(editor, "Toggle Comment Selection")
virtualFunctionsAdded = True
diff --git a/tests/system/suite_debugger/tst_cli_output_console/test.py b/tests/system/suite_debugger/tst_cli_output_console/test.py
index c1f6b2d595a..9774ea59b23 100644
--- a/tests/system/suite_debugger/tst_cli_output_console/test.py
+++ b/tests/system/suite_debugger/tst_cli_output_console/test.py
@@ -85,7 +85,7 @@ def main():
test.log("Debugging application")
isMsvc = isMsvcConfig(kit)
- invokeMenuItem("Debug", "Start Debugging", "Start debugging of \"%s\"" % project)
+ invokeMenuItem("Debug", "Start Debugging", "Start debugging of startup project")
handleDebuggerWarnings(config, isMsvc)
ensureChecked(":Qt Creator_AppOutput_Core::Internal::OutputPaneToggleButton")
outputWindow = waitForObject(":Qt Creator_Core::OutputWindow")
diff --git a/tests/unit/unittest/clangformat-test.cpp b/tests/unit/unittest/clangformat-test.cpp
index c0ff7dcd2ce..115ecaf763e 100644
--- a/tests/unit/unittest/clangformat-test.cpp
+++ b/tests/unit/unittest/clangformat-test.cpp
@@ -496,6 +496,19 @@ TEST_F(ClangFormat, IndentAndFormatCompleteStatementOnClosingScope)
"}"));
}
+TEST_F(ClangFormat, IndentAndFormatWithEmptyLines)
+{
+ insertLines({"foo(a,",
+ " ",
+ ")"});
+
+ extendedIndenter.indentBlock(doc.findBlockByNumber(2), QChar::Null, TextEditor::TabSettings());
+
+ ASSERT_THAT(documentLines(), ElementsAre("foo(a,",
+ "",
+ " )"));
+}
+
TEST_F(ClangFormat, FormatBasicFile)
{
insertLines({"int main()",
diff --git a/tests/unit/unittest/commandlinebuilder-test.cpp b/tests/unit/unittest/commandlinebuilder-test.cpp
index 8eb7fafa3c3..a75c8d8a35c 100644
--- a/tests/unit/unittest/commandlinebuilder-test.cpp
+++ b/tests/unit/unittest/commandlinebuilder-test.cpp
@@ -155,7 +155,13 @@ TYPED_TEST(CommandLineBuilder, CSource)
Builder<TypeParam> builder{this->emptyProjectInfo, {}, InputFileType::Source, "/source/file.c"};
ASSERT_THAT(builder.commandLine,
- ElementsAre("clang", "-DNOMINMAX", "-x", "c", "-std=c11", "-nostdinc", "/source/file.c"));
+ ElementsAre("clang",
+ "-DNOMINMAX",
+ "-x",
+ "c",
+ "-std=c11",
+ "-nostdinc",
+ toNativePath("/source/file.c").path()));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCHeader)
@@ -191,7 +197,7 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCSource)
"objective-c",
"-std=c11",
"-nostdinc",
- "/source/file.c"));
+ toNativePath("/source/file.c").path()));
}
TYPED_TEST(CommandLineBuilder, CppHeader)
@@ -227,7 +233,7 @@ TYPED_TEST(CommandLineBuilder, CppSource)
"-std=c++98",
"-nostdinc",
"-nostdinc++",
- "/source/file.cpp"));
+ toNativePath("/source/file.cpp").path()));
}
TYPED_TEST(CommandLineBuilder, ObjectiveCppHeader)
@@ -265,7 +271,7 @@ TYPED_TEST(CommandLineBuilder, ObjectiveCppSource)
"-std=c++98",
"-nostdinc",
"-nostdinc++",
- "/source/file.cpp"));
+ toNativePath("/source/file.cpp").path()));
}
TYPED_TEST(CommandLineBuilder, Cpp98)
diff --git a/tests/unit/unittest/creator_dependency.pri b/tests/unit/unittest/creator_dependency.pri
index 41ddd5bae1d..46d936d9c3e 100644
--- a/tests/unit/unittest/creator_dependency.pri
+++ b/tests/unit/unittest/creator_dependency.pri
@@ -19,7 +19,7 @@ include(cplusplus.pri)
include($$PWD/../../../src/shared/clang/clang_defines.pri)
include($$PWD/../../../src/tools/clangbackend/source/clangbackendclangipc-source.pri)
include($$PWD/../../../src/plugins/clangcodemodel/clangcodemodelunittestfiles.pri)
-include($$PWD/../../../src/plugins/clangformat/clangformat-source.pri)
+!isEmpty(CLANGFORMAT_LIBS): include($$PWD/../../../src/plugins/clangformat/clangformat-source.pri)
} else {
DEFINES += CLANG_VERSION=\\\"6.0.0\\\"
DEFINES += "\"CLANG_RESOURCE_DIR=\\\"/usr/include\\\"\""
diff --git a/tests/unit/unittest/googletest.h b/tests/unit/unittest/googletest.h
index b685b83c78f..0b9bf2d2fa1 100644
--- a/tests/unit/unittest/googletest.h
+++ b/tests/unit/unittest/googletest.h
@@ -40,6 +40,7 @@
#include "conditionally-disabled-tests.h"
#include "gtest-qt-printing.h"
#include "gtest-creator-printing.h"
+#include "gtest-llvm-printing.h"
#ifdef CLANG_UNIT_TESTS
# include "gtest-clang-printing.h"
#endif
diff --git a/tests/unit/unittest/gtest-creator-printing.cpp b/tests/unit/unittest/gtest-creator-printing.cpp
index 30660376e1f..8427e79af8a 100644
--- a/tests/unit/unittest/gtest-creator-printing.cpp
+++ b/tests/unit/unittest/gtest-creator-printing.cpp
@@ -41,10 +41,11 @@
#include <clangreferencescollector.h>
#include <filestatus.h>
#include <filepath.h>
+#include <filepathcaching.h>
#include <fulltokeninfo.h>
#include <includesearchpath.h>
#include <nativefilepath.h>
-#include <pchcreator.h>
+#include <pchcreatorincludes.h>
#include <pchtask.h>
#include <precompiledheadersupdatedmessage.h>
#include <projectpartartefact.h>
@@ -69,24 +70,10 @@
#include <coreplugin/find/searchresultitem.h>
#include <coreplugin/locator/ilocatorfilter.h>
-#include <clang/Tooling/CompilationDatabase.h>
-
namespace {
ClangBackEnd::FilePathCaching *filePathCache = nullptr;
}
-namespace clang {
-namespace tooling {
-struct CompileCommand;
-
-std::ostream &operator<<(std::ostream &out, const CompileCommand &command)
-{
- return out << "(" << command.Directory << ", " << command.Filename << ", "
- << command.CommandLine << ", " << command.Output << ")";
-}
-} // namespace tooling
-} // namespace clang
-
void PrintTo(const Utf8String &text, ::std::ostream *os)
{
*os << text;
diff --git a/tests/unit/unittest/gtest-llvm-printing.cpp b/tests/unit/unittest/gtest-llvm-printing.cpp
new file mode 100644
index 00000000000..c78b4f9eea5
--- /dev/null
+++ b/tests/unit/unittest/gtest-llvm-printing.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <gtest/gtest-printers.h>
+
+#include <utils/smallstringio.h>
+
+#include <clang/Tooling/CompilationDatabase.h>
+
+namespace clang {
+namespace tooling {
+struct CompileCommand;
+
+std::ostream &operator<<(std::ostream &out, const CompileCommand &command)
+{
+ return out << "(" << command.Directory << ", " << command.Filename << ", "
+ << command.CommandLine << ", " << command.Output << ")";
+}
+} // namespace tooling
+} // namespace clang
diff --git a/tests/unit/unittest/gtest-llvm-printing.h b/tests/unit/unittest/gtest-llvm-printing.h
new file mode 100644
index 00000000000..167f9341d0e
--- /dev/null
+++ b/tests/unit/unittest/gtest-llvm-printing.h
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <gtest/gtest-printers.h>
+
+#include <iosfwd>
+
+namespace clang {
+namespace tooling {
+struct CompileCommand;
+
+std::ostream &operator<<(std::ostream &out, const CompileCommand &command);
+
+} // namespace tooling
+} // namespace clang
diff --git a/tests/unit/unittest/pchmanagerclient-test.cpp b/tests/unit/unittest/pchmanagerclient-test.cpp
index d35e595b04b..bd482d73c16 100644
--- a/tests/unit/unittest/pchmanagerclient-test.cpp
+++ b/tests/unit/unittest/pchmanagerclient-test.cpp
@@ -53,9 +53,11 @@ using testing::Not;
class PchManagerClient : public ::testing::Test
{
protected:
- NiceMock<MockProgressManager> mockProgressManager;
+ NiceMock<MockProgressManager> mockPchCreationProgressManager;
+ NiceMock<MockProgressManager> mockDependencyCreationProgressManager;
+ ClangPchManager::PchManagerClient client{mockPchCreationProgressManager,
+ mockDependencyCreationProgressManager};
NiceMock<MockPchManagerServer> mockPchManagerServer;
- ClangPchManager::PchManagerClient client{mockProgressManager};
NiceMock<MockPchManagerNotifier> mockPchManagerNotifier{client};
Sqlite::Database database{":memory:", Sqlite::JournalMode::Memory};
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> initializer{database};
@@ -158,11 +160,17 @@ TEST_F(PchManagerClient, ProjectPartPchForProjectPartIdIsUpdated)
42);
}
-TEST_F(PchManagerClient, SetProgress)
+TEST_F(PchManagerClient, SetPchCreationProgress)
{
- EXPECT_CALL(mockProgressManager, setProgress(10, 20));
+ EXPECT_CALL(mockPchCreationProgressManager, setProgress(10, 20));
client.progress({ClangBackEnd::ProgressType::PrecompiledHeader, 10, 20});
}
+TEST_F(PchManagerClient, SetDependencyCreationProgress)
+{
+ EXPECT_CALL(mockDependencyCreationProgressManager, setProgress(30, 40));
+
+ client.progress({ClangBackEnd::ProgressType::DependencyCreation, 30, 40});
}
+} // namespace
diff --git a/tests/unit/unittest/pchmanagerserver-test.cpp b/tests/unit/unittest/pchmanagerserver-test.cpp
index 0cb6e3d1baf..5a2ca172c00 100644
--- a/tests/unit/unittest/pchmanagerserver-test.cpp
+++ b/tests/unit/unittest/pchmanagerserver-test.cpp
@@ -176,12 +176,26 @@ TEST_F(PchManagerServer, UpdateProjectPartQueueByPathIds)
server.pathsWithIdsChanged({projectPartId1});
}
-TEST_F(PchManagerServer, SetProgress)
+TEST_F(PchManagerServer, SetPchCreationProgress)
{
- EXPECT_CALL(mockPchManagerClient, progress(AllOf(Field(&ClangBackEnd::ProgressMessage::progress, 20),
- Field(&ClangBackEnd::ProgressMessage::total, 30))));
+ EXPECT_CALL(mockPchManagerClient,
+ progress(AllOf(Field(&ClangBackEnd::ProgressMessage::progressType,
+ ClangBackEnd::ProgressType::PrecompiledHeader),
+ Field(&ClangBackEnd::ProgressMessage::progress, 20),
+ Field(&ClangBackEnd::ProgressMessage::total, 30))));
- server.setProgress(20, 30);
+ server.setPchCreationProgress(20, 30);
+}
+
+TEST_F(PchManagerServer, SetDependencyCreationProgress)
+{
+ EXPECT_CALL(mockPchManagerClient,
+ progress(AllOf(Field(&ClangBackEnd::ProgressMessage::progressType,
+ ClangBackEnd::ProgressType::DependencyCreation),
+ Field(&ClangBackEnd::ProgressMessage::progress, 20),
+ Field(&ClangBackEnd::ProgressMessage::total, 30))));
+
+ server.setDependencyCreationProgress(20, 30);
}
TEST_F(PchManagerServer, RemoveToolChainsArguments)
diff --git a/tests/unit/unittest/projectupdater-test.cpp b/tests/unit/unittest/projectupdater-test.cpp
index 0ae47387d61..f41ddf89d4e 100644
--- a/tests/unit/unittest/projectupdater-test.cpp
+++ b/tests/unit/unittest/projectupdater-test.cpp
@@ -135,8 +135,10 @@ protected:
Sqlite::Database database{":memory:", Sqlite::JournalMode::Memory};
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> initializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
- NiceMock<MockProgressManager> mockProgressManager;
- ClangPchManager::PchManagerClient pchManagerClient{mockProgressManager};
+ NiceMock<MockProgressManager> mockPchCreationProgressManager;
+ NiceMock<MockProgressManager> mockDependencyCreationProgressManager;
+ ClangPchManager::PchManagerClient pchManagerClient{mockPchCreationProgressManager,
+ mockDependencyCreationProgressManager};
MockPchManagerNotifier mockPchManagerNotifier{pchManagerClient};
NiceMock<MockPchManagerServer> mockPchManagerServer;
ClangPchManager::ProjectUpdater updater{mockPchManagerServer, filePathCache};
diff --git a/tests/unit/unittest/readandwritemessageblock-test.cpp b/tests/unit/unittest/readandwritemessageblock-test.cpp
index 1cedd2b5a40..a13def699d0 100644
--- a/tests/unit/unittest/readandwritemessageblock-test.cpp
+++ b/tests/unit/unittest/readandwritemessageblock-test.cpp
@@ -138,7 +138,7 @@ TEST_F(ReadAndWriteMessageBlock, WriteMessagesToWriteBlockWithoutIoDeviceAndSetI
writeMessageBlock.write(ClangBackEnd::EndMessage());
writeMessageBlock.write(ClangBackEnd::EndMessage());
- writeMessageBlock.setIoDevice(nullptr);
+ writeMessageBlock.setLocalSocket(nullptr);
buffer.seek(0);
ASSERT_THAT(readMessageBlock.readAll(), IsEmpty());
diff --git a/tests/unit/unittest/refactoringprojectupdater-test.cpp b/tests/unit/unittest/refactoringprojectupdater-test.cpp
index ceb6d4b15bf..bab2377993c 100644
--- a/tests/unit/unittest/refactoringprojectupdater-test.cpp
+++ b/tests/unit/unittest/refactoringprojectupdater-test.cpp
@@ -87,8 +87,10 @@ protected:
ClangBackEnd::RefactoringDatabaseInitializer<Sqlite::Database> initializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
NiceMock<MockRefactoringServer> mockRefactoringServer;
- NiceMock<MockProgressManager> mockProgressManager;
- ClangPchManager::PchManagerClient pchManagerClient{mockProgressManager};
+ NiceMock<MockProgressManager> mockPchCreationProgressManager;
+ NiceMock<MockProgressManager> mockDependencyCreationProgressManager;
+ ClangPchManager::PchManagerClient pchManagerClient{mockPchCreationProgressManager,
+ mockDependencyCreationProgressManager};
MockCppModelManager mockCppModelManager;
ClangRefactoring::RefactoringProjectUpdater updater{mockRefactoringServer, pchManagerClient, mockCppModelManager, filePathCache};
Utils::SmallString projectPartId;
diff --git a/tests/unit/unittest/symbolindexer-test.cpp b/tests/unit/unittest/symbolindexer-test.cpp
index 9283eea8b6c..0a7b6acba19 100644
--- a/tests/unit/unittest/symbolindexer-test.cpp
+++ b/tests/unit/unittest/symbolindexer-test.cpp
@@ -630,15 +630,15 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderButGetsAnErrorForCollectingS
"-DBAR=1",
"-DFOO=1",
"-I",
- "/project/includes",
+ toNativePath("/project/includes").path(),
"-I",
- "/other/project/includes",
+ toNativePath("/other/project/includes").path(),
"-isystem",
- TESTDATA_DIR,
+ toNativePath(TESTDATA_DIR).path(),
"-isystem",
- "/other/includes",
+ toNativePath("/other/includes").path(),
"-isystem",
- "/includes")));
+ toNativePath("/includes").path())));
EXPECT_CALL(mockCollector, collectSymbols()).WillOnce(Return(false));
EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()).Times(0);
EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(symbolEntries, sourceLocations)).Times(0);
@@ -752,15 +752,15 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrderButGetsAnErrorForCollectingSy
"-DBAR=1",
"-DFOO=1",
"-I",
- "/project/includes",
+ toNativePath("/project/includes").path(),
"-I",
- "/other/project/includes",
+ toNativePath("/other/project/includes").path(),
"-isystem",
- TESTDATA_DIR,
+ toNativePath(TESTDATA_DIR).path(),
"-isystem",
- "/other/includes",
+ toNativePath("/other/includes").path(),
"-isystem",
- "/includes")));
+ toNativePath("/includes").path())));
EXPECT_CALL(mockCollector, collectSymbols()).WillOnce(Return(false));
EXPECT_CALL(mockSqliteTransactionBackend, immediateBegin()).Times(0);
EXPECT_CALL(mockSymbolStorage, addSymbolsAndSourceLocations(symbolEntries, sourceLocations)).Times(0);
diff --git a/tests/unit/unittest/unittest.pro b/tests/unit/unittest/unittest.pro
index e3c9430acf0..6fccdebcc7c 100644
--- a/tests/unit/unittest/unittest.pro
+++ b/tests/unit/unittest/unittest.pro
@@ -176,6 +176,7 @@ SOURCES += \
!isEmpty(LIBTOOLING_LIBS) {
SOURCES += \
+ gtest-llvm-printing.cpp \
clangquerygatherer-test.cpp \
clangqueryprojectfindfilter-test.cpp \
clangquery-test.cpp \
@@ -214,6 +215,7 @@ HEADERS += \
filesystem-utilities.h \
googletest.h \
gtest-creator-printing.h \
+ gtest-llvm-printing.h \
gtest-qt-printing.h \
mimedatabase-utilities.h \
mockclangcodemodelclient.h \