Commit Graph

2563 Commits

Author SHA1 Message Date
Nikolai Kosjar
082ba1d133 Clang: Validate warnings options from user
...in "Menu: Tools > C++ > Tab: Code Model > Clang Code Model Warnings"
to avoid (re)parse issues due an invalid command line for libclang.

If an invalid option is detected, then indicate it by providing an error
message. As long as there is an invalid option, the options are not
accepted.

We do not want to maintain a white list of valid options, so mostly
check whether the option starts with "-W". An unknown or misspelled
option like "-WnotYetKnown" will be ignored by libclang.

To keep passing in some options for testing/debugging convenient, skip
validation if QTC_CLANG_NO_DIAGNOSTIC_CHECK is set.

Task-number: QTCREATORBUG-18864
Change-Id: I196d0474c7521969c54133f52dfc7be0394bfc3e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-19 06:57:11 +00:00
Christian Stenger
e255baaa8f CppTools: Add target type information to project part
Let project managers store information whether a project part
belongs to an executable or a library and use this information
inside the AutoTest plugin.
This information will help to determine which targets are
relevant for the execution of tests.

Change-Id: I93b42797bf55225425398dc83aecea3c99eea290
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-18 10:01:30 +00:00
Ivan Donchevskii
a137b08eaa CppEditor: refactor FollowSymbol
Create an interface to get the ability to use
another FollowSymbol implementation

Change-Id: I5802f62523ff3ee47b8a14e487adf43edcb6c9b1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-15 14:14:01 +00:00
Ivan Donchevskii
76d12dc2d5 CppEditor: add default RefactoringEngine
..and use it when we don't have refactoring plug-in

Change-Id: Ibe317a9728d439b9c5e05271d92a330d22eaacb9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-15 14:13:48 +00:00
Marco Bubke
b6e12f4a1c Convert macros from plain QByteArray to a vector of structs
The old code model expected the macros as C++ formatted text
("#define Foo 42) but newer targets like the Clang codemodel expect key
value arguments like "-DFoo=42". So instead of parsing the text again and
again we use an abstract data description.

Task-number: QTCREATORBUG-17915
Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-14 15:23:56 +00:00
Jarek Kobus
b506fce0fe Fix string messages
Found during translating.

Change-Id: I9626b3393d7b53300f7c806acbc5e12bc58574d2
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-11 08:29:41 +00:00
Nikolai Kosjar
bdbd5a788b CppTools: "pre-compiled" -> "precompiled"
Change-Id: Ia4207747a3659fc05013d22b63feb2b17b1dec81
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-09-08 13:41:33 +00:00
Ulf Hermann
47886969cc Drop unused variables and lambda captures
Also, add context to connect() expressions where we are or were
capturing "this".

Change-Id: I6e006ba6f83d532478018550d148ee93eca59605
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-09-08 09:06:53 +00:00
Tobias Hunger
4ef01c961e app_version.h: Make IDE name configurable
Change-Id: I993f452c8d09cf89e9a2958fc8e36b7d2c17ee6f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-05 10:19:48 +00:00
Eike Ziller
ca959d8063 Merge remote-tracking branch 'origin/4.4'
Change-Id: Ic9a1cf3b40b259d9c77f2f542405d189171e0fbf
2017-09-05 12:15:42 +02:00
Ivan Donchevskii
410e31c665 CppTools: set default -std=c++11 for Qt4
qmake from Qt4 does not provide C++ standard and
clang can't properly compile Qt4.8.6 and earlier
with c++1z. Behavior in this commit mimics qmake
from Qt5 which also provides c++11 as a default
standard.

Task-number: QTCREATORBUG-16441
Change-Id: I3d29891d6e47f2367f2b3b2bf4be4d86661924e9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-05 09:37:14 +00:00
Orgad Shaneh
139792ee25 Merge remote-tracking branch 'origin/4.4'
Change-Id: I9ab2c68d2bd07b0dd89051a2f5f6fa51676d8594
2017-08-30 01:24:11 +03:00
Marco Bubke
7c0331ab93 Clang: Rename library clangbackendipc to clangsupport
We already share same classes there which has nothing to do with IPC and
I want to more for sharing. So we should use a name which fits better.

Change-Id: Idfb12b6de714206117b92634ad719c6a0e290e78
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-29 16:36:35 +00:00
Eike Ziller
04da881268 Fix copyright year in plugin info, --version, and macOS info
By using the new QTCREATOR_COPYRIGHT_YEAR variable

Task-number: QTCREATORBUG-18612
Change-Id: I3bcf0319660d210436d3130c00f43325c460a66c
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2017-08-24 11:23:40 +00:00
Eike Ziller
df796e2aa5 Merge remote-tracking branch 'origin/4.4'
Change-Id: Id525d68a899f2db14c2d52c200a3a2a8a4e81590
2017-08-24 13:23:04 +02:00
Nikolai Kosjar
94747ea2d0 CppTools: Guard against invalid document
Change-Id: Ib6fcdc312fcfa558cd7e1e55c46cb84c002258ad
Reviewed-by: hjk <hjk@qt.io>
2017-08-24 07:00:39 +00:00
Eike Ziller
ddd9e96afa Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/libs/utils/utils-lib.pri
	src/plugins/clangcodemodel/clangbackendipcintegration.h
	src/shared/qbs

Change-Id: I240e89afc76d8f40ce69d66683014b603f714707
2017-08-23 12:12:41 +02:00
Nikolai Kosjar
0db7ad77a0 Clang: Fix built-in's ExtractFunction action
Since

  Clang: Provide highlighting for identifier under cursor
  commit ca72c29462

the LocalUseMap, used for some refactoring actions, was not updated
anymore. Fall back to the built-in implementation for the LocalUseMap
because it contains pointers to built-in AST that clang obviously can't
provide.

Task-number: QTCREATORBUG-18607
Change-Id: I08762fe457835d4d83aca719febcb3497ee9696b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-08-22 10:01:31 +00:00
Ivan Donchevskii
e6a50fd44a Clang: implement requestFollowSymbol plug-in side
Invoke follow symbol in clang backend
if env variable QTC_CLANG_FOLLOW_SYMBOL is 1.
Does not include backend implementation.

Change-Id: Ia20a677830ebdd7f24800af5c5d6e8b1bf579205
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-08-15 07:32:16 +00:00
Andre Hartmann
c78ea5a7ea CppFindReferences: Fix file name case sensitivity on class renaming
Utils::matchCaseReplacement searches for common prefix and suffix
between old and new file name und leaves them unchanged. This leads
to unexpected new file names.

E.g. when renaming MainWindow to MyMainWindow, this function computes
the prefix "m", the suffix "ainwindow.h" and only considers "yM" as
the middle part that is actually renamed.

Use a better algorithm to determine the new base name, and for
unclear cases fall back to the "Lower case file names" option
from Tools -> Options -> C++ -> File Naming.

Task-number: QTCREATORBUG-18592
Change-Id: I818f7d372102eb6e266123b2b4b6355f6fa28d64
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-27 08:10:02 +00:00
Eike Ziller
e8e46ab553 Plugins: Fix that mimetype definition was not valid JSON
JSON officially does not support multiline strings, so we should use
the same mechanism that we already use for the plugin description
(i.e. additionally support arrays of strings which are interpreted
as lines).
This just happens to work because Qt's JSON parser eats it without
choking.

Change-Id: I25ef04600b209775c5a7af916c687fda4a8b1a4d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-07-25 06:00:49 +00:00
David Schulz
e97ff9f739 Clang: Do not warn about unhandled enum values
... in switch as long as there is a default case.

Change-Id: I584660cb26ee03a9ce3e41b297af0093dce59d1f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-07-24 14:21:36 +00:00
Leena Miettinen
52c2891083 C++: Remove full stop from check box label
Change-Id: I0129e6902d236f8fbc4216ae882abec349739a34
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2017-07-21 07:40:57 +00:00
Christian Kandeler
be2b3c91ae Add Q_FALLTHROUGH for Qt < 5.8
... and make use of it.
With gcc 7, the new option -Wimplicit-fallthrough is introduced and
added to the -Wextra set, triggering dozens of warnings in our sources.
Therefore, we annotate all obviously intended fall-throughs. The ones
that are still left are unclear and need to be checked by the respective
maintainer.

Change-Id: I44ead33cd42a4b41c28ee5fcb5a31db272710bbc
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-17 07:51:23 +00:00
Ivan Donchevskii
5a7a64b37d Completion: improve complete in the middle
Backport the master commit (cherry-pick).
Apply clang fix to the old code model
Do not replace the text after cursor if
the proposal does not contain it or
if proposal matches 100% the text after it

Task-number: QTCREATORBUG-18471
Change-Id: I10c90580d46d2d2c899dc1ed8fe4d7df0531691a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-07-14 10:03:48 +00:00
Ivan Donchevskii
985180d384 Toolchain: set triple in msvctoolchain class
Move triple set up to msvc toolchain class,
use another triple for x86_64

Change-Id: I3aebb051eb5d93accc6073e01391bf972199c2cb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-05 14:19:00 +00:00
Nikolai Kosjar
2747985358 Clang: Gray out diagnostics on document change
When reparses take a while, this is helpful.

Change-Id: Ie2003a3d65b30d944d20fa19dd4161412182851c
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-05 08:47:34 +00:00
Eike Ziller
526e40cba3 Merge remote-tracking branch 'origin/master' into 4.4
Change-Id: I00fe351ee5f2689366c63ba94b042609c47da777
2017-07-04 13:55:35 +02:00
Marco Bubke
3c6a2b7912 Extend search pane
The search term line edit can now be hidden away and the options are
hidden too too if they are all disabled.

Change-Id: I2363d010acbdabb2abfc6c6cd2f98c07cd7d3a3d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-04 09:08:17 +00:00
Eike Ziller
d12f5ca4aa Remove unused IAssistProvider::supportsEditor
Change-Id: Ieb2a36bfddbf4f2cade02cbf62b28d112dcb8f10
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-07-03 13:23:08 +00:00
Orgad Shaneh
5f973de952 Merge remote-tracking branch 'origin/4.3'
Change-Id: Ib5405ed2c3356f65b49fe2f454f8ac2e0de44ef6
2017-06-26 08:24:26 +03:00
Ivan Donchevskii
1e68d91cb1 Clang: fix intrinsic errors with boost
Add extra define not to include intrinsic headers
from boost headers.

Task-number: QTCREATORBUG-16439
Change-Id: I887fe63e2560afebdbe9f3d3587f99f95d408997
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-06-21 08:12:08 +00:00
Orgad Shaneh
687466ac47 Merge remote-tracking branch 'origin/4.3'
Change-Id: I126f3a05212a3d5df78812e66285bc9e8078360b
2017-06-20 11:32:02 +03:00
Nikolai Kosjar
e50ad1e09c CppTools: Avoid concurrent access to QTextDocument
Do not pass QTextCursor to another thread, but determine what we need
from it in the main thread.

Change-Id: I86900cfc5a28849efc1bd1dacb9b1452a5db252e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-06-20 07:42:06 +00:00
Orgad Shaneh
b89888ca9d Clang: substitute __float128 with short instead of void
There is an argument of this type in std_abs.h. void argument is invalid.

Replacing with float, double or long double causes an error in type_traits,
which has template specializations for __is_floating_point_helper for all
these types.

Change-Id: Ife95fa992cbf9684bc67a2098d6609a9a925d015
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-06-20 07:02:19 +00:00
Nikolai Kosjar
0bc782c468 Clang: Add CLANG-UPGRADE-CHECK marker
...for things to watch out on an upgrade.

Change-Id: I75b77a3c8fa238939b625d084c7db220ab429319
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-16 07:11:43 +00:00
Przemyslaw Gorszkowski
7bcf483189 C++: fix code completion of stl containers in internal code model
This fix makes some trick and replaces existing typedef of 'pointer'
to the simplest one(only in class unique_ptr), e.g.:
template <class _Tp>
class unique_ptr
{
  typedef some_strange_things pointer;
  pointer operator->();
}
is replace with
template <class _Tp>
class unique_ptr
{
  typedef _Tp* pointer;
  pointer operator->();
}

In most of the implementation of unique_ptr it should work.

Similar approach is done for std::list, std::vector, std::queue, std::set,
std::multiset, std::unordered_set.

It is done in this hacky way to omit problems with cyclic and complex
resolving of typedefs.

Change-Id: I1363dfc5e23d3cd2fa7af7fc27423bfbac2d894d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-06-15 17:18:20 +00:00
Nikolai Kosjar
d3d3e2ace5 CppTools: Simplify/Modernize SemanticInfo
Change-Id: I7bef1dee81678f77f5c0d8a6d22488aa63f981e7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-06-15 15:11:48 +00:00
David Schulz
2b83869236 TextEditor: Animate navigation within file
Change-Id: I490d70a785c947cd41809503e15a317152126641
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-06-15 09:24:07 +00:00
Nikolai Kosjar
38789eb0a6 CppTools: Use class member prefix "m_" in builtincursorinfo.cpp
Change-Id: I8e4079734f9167dcc9da2ceff027f8559bab367f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-06-14 12:33:22 +00:00
Nikolai Kosjar
fdf0a104ec CppEditor: Generalize CppUseSelectionsUpdater
Let CppUseSelectionsUpdater delegate the work to
*EditorDocumentProcessor so that the clang code model can also provide
results.

Change-Id: I6872afbfeea1a5c4a64fdf19fcb1992f134dde08
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-06-14 12:24:59 +00:00
Eike Ziller
247639d9c3 Remove 1-1 dependency between locator and locator input widget
Add possibility for filters to set a new search text when accepting
an entry.
Move placeholder text update from locator manager to widget.
Propagate filter update through signal-slot connection instead of directly.
LocatorManager::show is the only place left that directly references the locator widget.

Change-Id: Id61354d9f166c2af8c9d5528ad8998c7c6b8e1ab
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-13 12:42:13 +00:00
Ivan Donchevskii
78db7d7ed2 Clang: turn off delayed template parsing
Fix templates highlight and completion on Windows
Add UI to turn on/off delayed parsing (off by default)

Task-number: QTCREATORBUG-17222
Change-Id: I0cd5e0bcfff2789cd938e4096829f777ff15957a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-06-08 10:53:31 +00:00
Orgad Shaneh
59a5c0c232 CppTools: Avoid QT_SUPPORT macro
It is deprecated, and GCC7 warns about RHS expansion to defined.

Change-Id: I161ee9c566ee12d0e443a9054dd0e5cdadc0518e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-06-06 07:32:08 +00:00
Eike Ziller
33cc799b98 Locator filters: Add overrides
Change-Id: I20f93d6bcb22a342d9f662d8190f97798ca3e423
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-06-02 07:17:24 +00:00
Nikolai Kosjar
3e203e1208 CppTools: Fix uninitialized values warnings
...from coverity scan.

Change-Id: I7f4c3de39279cfffab2246aa84ae2ac13916bd1e
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2017-06-01 13:33:27 +00:00
Eike Ziller
68a89c29a4 Make functionality of applying mixin text styles available for everyone
Change-Id: I0e702be0572229ec96c71d0ae2b5395a3c2fb29e
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-05-29 06:54:18 +00:00
Nikolai Kosjar
6174cca5a0 Move CanonicalSymbol from CppEditor to CppTools
Needed for a follow-up change.

Change-Id: Ibb4815f3411f0d63deac8c32583178470668f67b
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-05-29 06:42:09 +00:00
Daniel Teske
ef951eaea7 Class Renaming: Offer to rename files that match the symbols name
Task-number: QTCREATORBUG-14696
Change-Id: I6d140dac510e47d1a19d6759148f5f24dad44062
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-05-16 16:04:17 +00:00
Nikolai Kosjar
e788333510 Clang: Add -Wno-used-but-marked-unused
...to built-in diagnostic configuration "Warnings for almost
everything".

Change-Id: I2a70c76c5b876cc0dc8cebd80c2457550b608593
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-05-12 10:13:55 +00:00