Commit Graph

2439 Commits

Author SHA1 Message Date
Hugo Holgersson
86aab16ea4 TextEditor: Highlight punctuators as Text
This change limits the set of tokens that fall under
Token::isOperator(). That allows cpphighlighter.cpp to
distinguish operator tokens from punctuator tokens
(without changing any logic in cpphighlighter.cpp).

This change moves punctuators from "Operator"
to the "Text" style category where they belong.
Punctuators are not operators. Punctuators are
dumb text tokens.

Why don't we let the clang backend alone separate
these tokens for us?

1. Clang is slow on big files. Sometimes the
   highlighting dictated by clang is painted _seconds_
   after cpphighlighter.cpp runs. CppHighlighter is way
   faster so we use it to "prepaint" code while clang is
   busy in the background.

2. Secondly, clang cannot yet handle all operator types.
   In particular, none if its "operator cursors"
     CXCursor_UnaryOperator:
     CXCursor_BinaryOperator:
     CXCursor_CompoundAssignOperator:
     CXCursor_ConditionalOperator:
   includes the -> and . operators.
   We still need CppHighlighter to paint those tokens.

However, once clang has finished processing the file some
operator tokens will be repainted. We need clang to get
all operators' semantics. In particular, we need clang to
tell us if < is a "smaller than"-operator or part of a
template parameter like set<int>.

Task-number: QTCREATORBUG-19659
Change-Id: I952cb58f7c79134b3281e2a8221425cc1d0ad263
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-05-03 13:43:16 +00:00
Ivan Donchevskii
02f50d5286 CppTools: Rollback some changes in CompilerOptionsBuilder
Make it safer in the 4.6 release.

Change-Id: I75857ecc08af8febe40fd75dc94d8ab986d4b768
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-03 10:04:08 +00:00
Ivan Donchevskii
0a7d24c730 CppTools: Fix MSVC toolchain flags for C-files
In case of C-header or C-source files the MSVC
language version was not switched to C.
Fixes static analyzer runs for C files.

Task-number: QTCREATORBUG-20198
Change-Id: I1da31a1048b7c258642cf00f5084681f5d384ee6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-05-03 08:25:31 +00:00
Ivan Donchevskii
219e23332e ClangTools: Add tool that runs clang-tidy and clazy
... over the whole project.
Generate and read serialized files to get diagnostics.

Change-Id: Iafc25fc70443107a040a995efc038aed35102bbf
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-26 13:02:19 +00:00
Eike Ziller
a8aa4bbb31 More improvements of text editor tool bar
Make line/column label always visible, and move context drop down to the
right, so it vanishes first. Reduce the minimum size and stretch of the
outline drop down, so the context drop down doesn't vanish too early
either.

Task-number: QTCREATORBUG-15218
Task-number: QTCREATORBUG-19386
Change-Id: Ie2ced1cb62a27a0129438f5605d5711bfac50cd0
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-04-25 07:10:52 +00:00
Alessandro Portale
4317e350f5 Update Options dialog icons
A new set of scalable and themable icons with unified look as provided
by Diana.

Task-number: QTCREATORBUG-20325
Change-Id: I68498b034e9e43fbb61511a38d9c7fc0003ab076
Reviewed-by: hjk <hjk@qt.io>
2018-04-24 14:43:35 +00:00
Eike Ziller
d1ec4c1204 Clean up options page category display name and icon set up
In cases where plugins extend an existing settings category of a plugin
that they depend on anyhow, they do not need to specify the translated
display name and icon for that category.
Some options pages were already not setting the icon, but still the
translated name, which makes even less sense.
Clean up this mess, only setting display name and icon if that is
necessary.

Change-Id: I8bc9d0c51b11d48f1d847337838704d663e70b45
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-04-23 11:12:26 +00:00
Eike Ziller
2dff9a03ac Improve behavior of cpp editor tool bar
The parse context drop down was taking a content based, fixed amount of
space in the editor tool bar, without being shrinkable.

That was especially bad if you have a long project / target name. When
working with a small window / split, the outline drop down would be
dropped from the tool bar.

This patch makes the parse context drop down shrinkable (with a small
minimum size), and gives the outline drop down a slightly higher
priority for getting tool bar space.

Task-number: QTCREATORBUG-19386
Change-Id: I87e3ee2e411a43b1f398ffd24fe5608e4df02af6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-20 14:15:52 +00:00
Robert Loehning
5c8844d8f7 CppTools: Don't deref null pointer
Change-Id: I92eade63b4fdc7039ce9b4e0a7db1091fb34d692
Reviewed-by: hjk <hjk@qt.io>
2018-04-13 13:04:15 +00:00
Ivan Donchevskii
8936e51033 ClangTools: Always use CompilerOptionsBuilder for clang tools
We do not ship clang-cl anymore which makes it impossible
to run clang with MSVC options.
Secondly we used to we tweak compiler options quite a bit so
why not to switch to CompilerOptionsBuilder totally?

Change-Id: Id323cb554587afaea7d9aa530e947a45a03922d1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-04-13 12:34:35 +00:00
Eike Ziller
428fcb476b Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/libs/utils/settingsaccessor.cpp
	src/plugins/autotest/autotestplugin.cpp
	src/plugins/git/gitclient.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
	src/plugins/qbsprojectmanager/qbsrunconfiguration.h

Change-Id: I65f143cad18af509a2621d6c5925abbd038ea70f
2018-04-13 10:54:42 +02:00
Nikolai Kosjar
8441bb0933 Clang: Avoid warnings about unknown warning options
...as they are generated by e.g. Q_OBJECT use.

Previously we have avoided Q_OBJECT warnings by using
-Wno-unknown-pragmas (Qt Creator build with libclang 3.9). With the
upgrade to libclang 5.0 GCC pragmas can now be parsed by clang and the
related warning option thus changed to -Wunknown-warning-option.

Note that previously -Wno-unknown-pragmas was part of every built-in
configuration and visible in the UI. Now that option and the new one are
added behind the scenes (not visible in the UI anymore) so that every
diagnostic configuration, also the copied/customized ones, will profit
from it. Still, by putting this hidden options first on the command
line, the user can overwrite them with his own configuration if desired.

Task-number: QTCREATORBUG-17460
Change-Id: I68aaec1b4791522bd8dc4e5fdb405cc5b9c9f514
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-11 07:15:35 +00:00
Orgad Shaneh
eea6a7c3b3 Utils: Purge qtcfallthrough.h
No longer needed.

Change-Id: I9b0bee014df89d4c567f1d2431b5ff9404f5f925
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 09:04:13 +00:00
Ivan Donchevskii
41a12410e6 Clang: Fix initial tidy settings tab
When no settings exist it has to be disabled.

Change-Id: I1cb8368edf182fa616930f5718323c8e03a0e649
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-03-27 13:54:06 +00:00
Ivan Donchevskii
99bd0ed2a4 Clang: Rebuild overview model tree when token data is updated
In release builds overview model tree is built earlier
then the job with token information is completed.

Change-Id: I1a563551e813996001fb97924ac441e2b7d599b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-03-23 14:15:45 +00:00
Ivan Donchevskii
08d1274ccc CppTools: Remove processEvents call from follow symbol
processEvents is a bad way of dealing with asynchronous
requests. Use QFutureWatcher for that purpose.

Change-Id: I3839cb9db80a6d391f6af1178e96986a325b7b99
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-03-19 13:37:46 +00:00
Ivan Donchevskii
4d153b4f67 Clang: Add combobox with tidy configuration options
The old way was not flexible enough.
With these options it's possible to just use your
config file or set tidy command line yourself.

Change-Id: I1bace40986668dee5e1b30c9d03090a3fd22e253
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-03-19 13:19:00 +00:00
Eike Ziller
0b10ecc718 Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakeproject.h
	src/plugins/debugger/debuggerplugin.cpp
	src/plugins/ios/iosrunfactories.cpp
	src/plugins/nim/project/nimproject.h
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp
	src/plugins/qmakeandroidsupport/qmakeandroidrunfactories.cpp
	src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp
	src/plugins/qmlprojectmanager/qmlproject.h
	src/plugins/qnx/qnxrunconfigurationfactory.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp
	src/plugins/winrt/winrtrunfactories.cpp

Change-Id: Ib029fdbaa65270426332f5edd6e90264be5fb539
2018-03-13 11:25:38 +01:00
Tobias Hunger
835d4e92f3 Project: Improve default implementation of Project::needsConfiguration
Change-Id: Ic4d227334d818658f179c0589462551509274c17
Reviewed-by: hjk <hjk@qt.io>
2018-03-09 12:57:59 +00:00
Ivan Donchevskii
6010fd855d CppTools: Remove resetFilters from CppModelManager
Without object pool resetting filters does nothing
and therefore is not needed anymore.

Change-Id: Id5439d11b0ee2564d7573b95c0c922d7fd7da59e
Reviewed-by: hjk <hjk@qt.io>
2018-03-09 08:35:10 +00:00
Eike Ziller
711ac6602f Fix C++ type hierarchy
Dynamic casts between library boundaries tend to fail. Add an "explicit
cast" to CppClass via virtual functions as a quickfix.
This is a recurring issue, e.g. d2769f3003, 3f11ef9216 and
2ffd0e2d0d to name just a few...

This was introduced in 5e861d2be6

Task-number: QTCREATORBUG-20001
Change-Id: Ie5a89a028d587e4e9d1ecec920a7c7d17497dbde
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-09 08:21:07 +00:00
hjk
efbcf6308b CppTools: Do not add LocatorFilters to global object pool
Not needed anymore, they are more directly accessible nowadays.

Change-Id: Ibe16ab1281a16b05e02fb20c0722d87196d99365
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-08 11:43:43 +00:00
David Schulz
29f76c43c8 CppTools: use member init in assist provider
Change-Id: I7aad8af42c9f6f6f6cd22f1d7677ac62178bbcb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-03-07 12:05:58 +00:00
Robert Loehning
37aea43479 Don't translate default windowTitle again and again
Change-Id: I4b4ff16e02c517bcd5a7c5ae73f62dd2a5bcc7cc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-03-06 14:57:40 +00:00
Tobias Hunger
1e2dcc232c Fix class/struct mismatch
Change-Id: I6dc8f23c505aac1eb984446d3917ba8b1ea20bc5
Reviewed-by: hjk <hjk@qt.io>
2018-03-06 14:18:38 +00:00
Robert Loehning
24aa3c35b0 Clang: Don't translate tidy checks
Change-Id: I1bcefd69bc4e7e6705bd8f3d2d992bd544244949
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-03-06 13:57:04 +00:00
Eike Ziller
6990995868 Fix mismatched tag class vs struct
See friend declaration below. That's the reason why we decided to use
'class' almost everywhere.

Change-Id: Icd8ba99528eac28721b403cac0a992ee4d367265
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-03-06 12:15:39 +00:00
Christian Stenger
33f2c24049 CppTools: Fix builtin overview model
5e872c0fcd changed the base class to TreeModel which
needs to have TreeItem inserted to fully work as intended.

This patch makes the overview model work without running
into countless soft asserts when using the builtin code model.

Change-Id: I875529bef03ea2cd9a226b05410fd05e247eded1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
2018-03-02 09:05:21 +00:00
David Schulz
a4b5fc00a8 CodeAssist: use shared pointer to pass around proposal models
Task-number: QTCREATORBUG-17752
Change-Id: Ia41f169b86ead209830e6f15764062389ced2b67
Reviewed-by: hjk <hjk@qt.io>
2018-02-27 12:32:36 +00:00
Ivan Donchevskii
b276de576f CppTools: Replace "\r\n" with "\n" in cpp file content
When we get the file working copy it never contains "\r\n"
line endings. Let's provide the same behavior when we have
no working copy and read the file from disk.

Task-number: QTCREATORBUG-19905
Change-Id: I720d62426860dcdcdd8520db5430d9f4f5900ab6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-02-23 13:09:20 +00:00
Eike Ziller
7c3cfa166d Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/plugins/coreplugin/helpmanager.cpp

Change-Id: I2feb60ec0afb2f22f75dc137a01c3fa217b299d8
2018-02-23 10:56:52 +01:00
Ivan Donchevskii
5e872c0fcd Clang: Introduce OverviewModel for clang
Change-Id: I1473e3f679f4345a04c55f1ee80cfe35e21a4347
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-02-21 06:55:59 +00:00
Nikolai Kosjar
fc37af56ff CppTools: Disable text edit for built-in clang configs
Otherwise it looks like the options can be customized without copying
the configuration.

Change-Id: I7df26f8f2e3f566f659d12258730d2f514e9d71b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-14 07:24:29 +00:00
Nikolai Kosjar
936d639403 CppTools: Provide hint to copy clang diagnostic config
If a built-in/read-only configuration is selected, show a hint that it
needs to be copied to make customizations.

Change-Id: I62fc51b7548ec7cd6a156a0be84d9dcb41849ee7
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-14 07:18:02 +00:00
Eike Ziller
c7fdb93865 Merge remote-tracking branch 'origin/4.6'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp

Change-Id: I2445882a270731b866b04f28ff87d161224c539a
2018-02-13 13:37:37 +01:00
Ivan Donchevskii
7698d95576 CppTools: Get OverviewModel from model manager
Move ownership and add the placeholder for future clang based
OverviewModel.

Change-Id: Ia44d2c1d0db59b40239d1f7934bf37a02e4b14e6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-09 13:29:37 +00:00
Ivan Donchevskii
8389aa144a Clang: Use more generic methods in OverviewModel
Do not return Document or Symbol. Instead use Link
or LineColumn directly as return values.

Change-Id: I1863d7c3b4985ffe2ae5454622227075ebdc2de7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-09 13:29:10 +00:00
Ivan Donchevskii
c6d4308ccd CPlusPlus: CppEditor: refactor overview model
Introduce abstract model to be able to use clang
based version of it in follow up patches.
Fix warnings and modernize source code a little.
Move OverviewModel to CppTools.

Change-Id: Idcc9bf03cad047026a456bd01063597a1eb95147
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-09 12:03:18 +00:00
Nikolai Kosjar
2cedb0531c CppTools: Use radio buttons for clazy options
Change-Id: I7c307cffce58c8dc4fd00d17b5c477c85ba509d8
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-08 14:46:05 +00:00
Nikolai Kosjar
8cd96c2142 CppTools: Improve clang diagnostic configuration UI
...by clarifying the widget hierarchy. Ensure that the combo box at the
top is perceived as the main widget:

* Remove the "Configuration to use:" label so the combo box gets more
  horizontal space and thus dominance. Also, rename the group box
  header/label from "Clang Diagnostic Warnigns" to "Clang Diagnostic
  Configuration".
* Move the command line text edit below the combo box into its own tab
  page to clarify the relation to the tidy/clazy tabs.

Change-Id: I97a0785678e33b94746046d07a911422b1469890
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-08 14:45:59 +00:00
Ivan Donchevskii
c020f2448b CPlusPlus: Add toLink method to the Symbol
Basically move it from CppTools to CPlusPlus
to be able to use it there.

Change-Id: I0af80f93bdc029824397ceafdf940cb86c4382b0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-07 14:01:52 +00:00
hjk
87543118d5 CppTools: Apply 'static' pattern to StringTable
This also fixes a crash on loading (some?) projects introduced
in 577bf7c08a.

Change-Id: Ie35d466fa3b84b183118fe93f55393a4c59755de
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-07 13:32:08 +00:00
hjk
577bf7c08a CppToolsPlugin: Partially pimpl and remove use of global object pool
Change-Id: Iee09bf2fc7c945b8dcf950edfe94889d35c63735
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-07 11:20:22 +00:00
hjk
b16019c95b CppTools: Remove an unused declaration
Change-Id: I165f32678d61e3731fff68982bdb3f5c1791b1f0
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-07 11:10:45 +00:00
Eike Ziller
5432dd1f5c Merge remote-tracking branch 'origin/4.6'
Conflicts:
	src/plugins/coreplugin/locator/locator.cpp
	src/plugins/imageviewer/imageviewerplugin.cpp
	src/plugins/remotelinux/remotelinuxplugin.cpp
	src/tools/clangbackend/source/tokeninfo.cpp
	tests/unit/unittest/data/highlightingmarks.cpp

Change-Id: I74cc3ba3a2836cb9d0e65d3380d8c4f88d720c67
2018-02-07 11:58:23 +01:00
Christian Stenger
109c3f06f8 TextEditor: Fix compile with Qt5.6/gcc4.9
Amends 91c19c2734.

Change-Id: I556c2336ac2bbde7f7f2acf4ed9339809a918b55
Reviewed-by: hjk <hjk@qt.io>
2018-02-07 09:06:53 +00:00
hjk
91c19c2734 TextEditor: Simplify SnippetProvider handling
The group identifier is as good as the actual object, so use that
on the generator and the consumer side.

Change-Id: I6ccd54a2362631af0b50583f12563b8e41a5dd78
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-02-07 07:59:05 +00:00
Nikolai Kosjar
88c480ee7c CppTools: Remove unneeded #include
Change-Id: I3b1dd5aa12ba8690ee5de98ccdef99644fff04f9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-02-07 07:40:35 +00:00
Eike Ziller
ecb9fae785 Merge remote-tracking branch 'origin/4.6'
Conflicts:
	share/qtcreator/qml-type-descriptions/qmlproject.qmltypes
	src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp

Change-Id: I35fb652f29a98a798be7c8b4b4c2e581eb175fb6
2018-02-01 09:58:36 +01:00
Nikolai Kosjar
33b6fe812a Clang: Make clazy/tidy options part of the diagnostic config
As a side effect, clazy/tidy options become available for project
specific customization in the projects mode.

Change-Id: Id72762dedd857915139c15f532d2f1c6d1f43edb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-29 08:14:14 +00:00