Commit Graph

2507 Commits

Author SHA1 Message Date
Orgad Shaneh
539b10727e Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/debugger/debuggermainwindow.cpp

Change-Id: I07496916dd37b842d57ce5c49f99c079a9095a5f
2018-09-21 10:49:44 +03:00
Eike Ziller
d3d47dd521 Merge remote-tracking branch 'origin/4.7' into 4.8
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: Ia1d6035a335fd56069ec8d6d106d58124ee8798d
2018-09-21 09:26:38 +02:00
Nikolai Kosjar
08ec1f9326 CppTools: Fix crash on smart selection change with lambda
...in case there is no lambda declarator provided, e.g.: []{}

Fixes: QTCREATORBUG-20994
Change-Id: I6a77cffe4e585422f1ed0639cabc687d3d123f5d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2018-09-20 11:09:43 +00:00
Orgad Shaneh
439bc225e1 Clang/CppTools: Replace Q_DECL_NOEXCEPT with noexcept
Change-Id: I105a5ed5e4a5c647f947a413ae8123d02bfdae3f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-20 08:36:45 +00:00
Ivan Donchevskii
c99fb5d0bc Plugins: Add compilation database plugin
Introduce compilation database project support.

Pass the arguments list for each file directly to
ClangCodeModel via extraCodeModelFlags therefore
introduce a dependency from the ClangCodeModel plugin.

Change-Id: Iea5760d379de1ea246382dce56de0adf7ab5673d
Task-number: QTCREATORBUG-21115
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-19 12:11:36 +00:00
Eike Ziller
9a3fe812f9 CppTools: Fix missing override
Change-Id: I6ee424a844ce2657516258033764ef557a424830
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-18 13:15:17 +00:00
Ivan Donchevskii
658e308f68 Clang: Use built-in paths knowledge to better place clang include path
Clang include folder should be a part of built-in includes
and always come after user and system includes.

Change-Id: I22961ea3bbb018f41b49f42c6ff7d22eb591ad01
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-18 06:57:01 +00:00
Ivan Donchevskii
eeece5b5ad Clang: Skip built-in includes when exporting the compilation database
We don't want to have compiler-specific paths there.

Change-Id: If26434ea3760d4f2ca4c25bbcf0340f4ea781072
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-17 13:13:16 +00:00
Ivan Donchevskii
0bd095aa45 ProjectExplorer: Rename compiler includes from System to BuiltIn
System include are those used with -isystem keyword, built-in
includes on the other hand come from compiler and always
follow in the end of the include list (after system includes).

Change-Id: I95c2fec36d2e5b43f014fe0a88d59c6769edfa1f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-17 11:24:32 +00:00
Ivan Donchevskii
3170d05087 Clang: Do not use -isystem in ClangCodeModel
Some other logic in the options builder is based
on the -I usage and also we don't want to lock any files
with ClangCodeModel.

Change-Id: I4338abed26e91ebb0a561d449328ea0954fe44ea
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-17 09:22:52 +00:00
Tobias Hunger
c763d4d787 ProjectExplorer: Remove HeaderPath::isFrameworkPath
None of the other types has a query function, so remove this one, too.

Change-Id: I936d162e092c8f9361b0e3bb86676e68905d2f4b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:32:59 +00:00
Tobias Hunger
11245564da ProjectExplorer: Consistently use HeaderPaths
Use HeaderPaths over QList<HeaderPath>.

Change-Id: I8f78b0a44e0160f1a2e7a78d9db4d04fcaa22f82
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:32:51 +00:00
Tobias Hunger
570fe88970 ProjectExplorer: Remove HeaderPath::isValid and related code
HeaderPath with an Null path are invalid, there is no need to
have a special type for that.

Change-Id: Ied102fbe523a8cf17e8b385ee89b099517a6d598
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:32:43 +00:00
Tobias Hunger
1df553a683 ProjectExplorer: Rename IncludePathType to HeaderPathType
It is the type used by the HeaderPath class, so reflect that in
the name.

I also considered to rename HeaderPath to IncludePath, but
that name is reflected in a lot of users, which would also need
to be adjusted for consistency. That would blow up the patch size
for little value IMHO.

Change-Id: I51421dbd3ab8b2874dc32fc82dc394c9b93ce5e9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-13 11:32:31 +00:00
Marco Bubke
e0b7a28333 Clang: Add refactoring project updater
The project parts are now first used by the pch manager and then notified
by the pch manager to the refactoring plugin.

Change-Id: I88074d8891cd0de9721497bbafee0deffc0b6339
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-12 14:32:34 +00:00
Ivan Donchevskii
ca84a51f86 Clang: Use clang-format for indentation
This is the new experimental plugin based on LibFormat.

It replaces the default indenter for CppEditorDocument
and applies clang-format after the CR or the set of 'electric'
characters.

Uses the global .clang-format kept in QtC settings or
the one for current project. Both can be configured.

For indentation some style modifications and code manipulations
are done to prevent line shrinking when it's not expected.

Manual indentation uses unmodified style from .clang-format file.

Change-Id: I6279b805e418e1804b553efa615f5c843f395a58
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-12 07:59:30 +00:00
hjk
e7f649a194 CppToolsPlugin: Simplify setup code
Change-Id: I4d738638aa363f66b3bbfd44f866eb8fa48fa226
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-10 09:42:39 +00:00
Marco Bubke
3abaf647d0 Add system include path to HeaderPath and merge ProjectPartHeaderPath
System include paths are appended after other includes by the compiler. So
we should set them as system includes and not as normal includes. Otherwise
we change the include order. Headers in system include paths are not
cluttering the screen with unwanted warning and by the way improve
performance too.

ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them.

Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-09-10 09:31:32 +00:00
Ivan Donchevskii
b23bb73bee CppTools: Do not auto-trigger completion after '{' and '(' in the new line
There's no token before the first symbol in the line.
With no information it's better to avoid triggering
automatic completion after the first token.

Change-Id: I9d3aca3bf72485c6eca6e03d9b8691abf0492bcc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-09-03 08:30:24 +00:00
Ivan Donchevskii
8b6a16c95b Clang: Fix completion after '{'
Follow-up fix for 8d0391a4f9.

Do not complete after '{' coming not after an identifier.
Take constructor completions only for '{' and function
completions only for '('. Filter constructor completions by
class/struct type.

Task-number: QTCREATORBUG-21004
Change-Id: I7ae2d6bee23cf907648c42b93eb12742942833f6
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-30 13:36:52 +00:00
Ivan Donchevskii
efe7c56e62 Clang: Do not add -undef to ClangCodeModel arguments with clang-cl
Clang-cl behaves similar to MSVC and the parsing is more proper
without -undef specified.

Change-Id: Iee37fca3401000edb3e77e8a99dcb85ae6e70ab3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-28 10:23:34 +00:00
Ivan Donchevskii
1b4f5c0670 Clang: Fix include paths order
C++ include paths should come before Clang include
folder. Therefore parse all options for include/c++/v1,
include/c++/{version}, include/g++ and /usr/local/include.

Task-number: QTCREATORBUG-20231
Change-Id: I22c41f07d241e1e564069bb192d4fe637ff05e87
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-27 11:35:02 +00:00
Ivan Donchevskii
6652d937aa Clang: Fix excluded Clang path regular expression
Cover cases like /usr/lib64/clang/6.0.0/include

Change-Id: I015ea3535637376eeab6f737752ad13d33887190
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-24 05:46:07 +00:00
Marco Bubke
7bae47642c Add optional system include to compiler option builder
System includes suppress warnings and prevent indexing of unwanted symbols.
Using system includes for all includes outside of the project can be
quite advantageous. The rootProjectDirectory() can be extended to be set
in the project settings. An automatic generation could be possible but
could create an unwanted path which includes files outside of the
perceived project.

Change-Id: Ib9d3158f14f41efe1f6657f962d5c4437bb324b2
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-08-14 15:03:51 +00:00
Ivan Donchevskii
f60b035295 Clang: Add button to generate compile_commands.json
Change-Id: Iaabdcfc8d1b3463c3f6e5ce47536f9c52556eac0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-13 13:24:12 +00:00
Ivan Donchevskii
62e776aa8e Clang: Provide include directory only for libclang
Only libclang has issues with the include directory
search therefore undefining include folders makes sense
only for libclang options builder.

Change-Id: Ie3f62f5f3a89503e6e0ab59e18889e92425c3abc
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-08 14:07:13 +00:00
Ivan Donchevskii
d58b31c2eb Clang: Fix the include paths order for libclang
Clang headers should always come first. After we
removed '-isystem' from other paths it was still
used for clang headers which put it in the end of list.

This fix returns the paths their original order.

Change-Id: I0a4ab450a5303e2536e60200f479cc19f6f55e99
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-08 13:16:24 +00:00
Eike Ziller
847787f146 Merge remote-tracking branch 'origin/4.7'
Conflicts:
	src/plugins/debugger/debuggerruncontrol.cpp

Change-Id: I72882df605bc3fc8a8d20118fd4e49207ac92664
2018-08-07 09:42:02 +02:00
David Schulz
141f19a652 Utils: move code model icons to utils
In preperation for the language server protocol support.

Change-Id: Iee4ccd53a86d9afdb357972ea62b75ace2edcb1d
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-08-06 13:22:47 +00:00
Ivan Donchevskii
344cbb3a1b Clang: Move clang paths helper functions to Core plugin
These functions require core plugin so they can't go
to utils library. At the same time to use them in
ProjectExplorer plugin there are not too many choices
where to put them without introducing new dependencies.

Change-Id: I3cccccffaae8ac4bbce924fd809b5423da5dc503
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-08-06 12:38:52 +00:00
David Schulz
e3a0a710c6 TextEditor: fix crash while request follow symbol and typing on mac
Use a qobject_cast to prevent accessing a not available function.

Task-number: QTCREATORBUG-20910
Change-Id: If2aa6b7b120379681e9590db80904c45a6d9bd55
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2018-08-06 10:03:23 +00:00
Alessandro Portale
3d3f14e3fe Prefer using 'override' instead of 'virtual'
warning: prefer using 'override' or (rarely) 'final' instead of
'virtual' [modernize-use-override]

Change-Id: I6dac7a62b627fa1353b4455e1af92f869c2571cc
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2018-07-11 16:31:35 +00:00
Eike Ziller
5c81a65422 Merge remote-tracking branch 'origin/4.7'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I29916313f12e25f3942ac926f8e4d4490074978e
2018-07-05 11:14:33 +02:00
Ivan Donchevskii
ef9c68798d CppTools: Fix getting locator filters from the object pool
They are no longer inside the global object pool.
Get them from CppModelManager instead.

Task-number: QTCREATORBUG-20678
Change-Id: Ifb3221a812295e1dcfe8b59ea693a4b350cbcc2e
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-28 07:42:27 +00:00
Nikolai Kosjar
32614e9983 Clang: Avoid using -isystem include paths
...as this leads to file locking issues on Windows and pointless
diagnostics we currently ignore when opening files from -isystem include
paths.

The usage of -isystem suppressed warnings from system headers and
resulted in a performance boost. Nowadays we can preserve this
performance optimization by making use of the new
CXTranslationUnit_IgnoreWarningsFromIncludedFiles. This flag helps us
also to suppress diagnostics from clang tidy checks, which reported
diagnostics even for -isystem headers.

Change-Id: I33e1f7169e2ff9f17c811565a5324b9da4740701
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-06-27 12:57:57 +00:00
Eike Ziller
997f7166fd Merge remote-tracking branch 'origin/4.7'
Change-Id: Ifec1f8dc20a18f432ec6ccf68153f31fff3f8b29
2018-06-25 11:07:03 +02:00
Eike Ziller
a8c5af56a9 Remove unneeded checks for validity of mime types
mimeTypeForFile(...) is documented to never return an invalid mime type
(it will fall back to binary if everything else fails), so remove
unneeded checks.

This also removes fallback code that used text/plain in case of invalid
mime type, which is probably a relict from the old mime implementation.

Change-Id: I88ed41fa3b81704f110f9f481b0f01424a487cbb
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-25 08:08:14 +00:00
Ivan Donchevskii
b857762432 Clang: Remove redundant check
Excluding for __cplusplus macro is not required anymore
because we currently determine C and C++ files and do not
set this macro for C-files.

Does not break QTCREATORBUG-12818.

Change-Id: I40d5afcb9ef426a6469fb5134ec7d46438201d86
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-20 11:40:14 +00:00
Eike Ziller
bc02c97369 Fix that D source files should not open in C++ editor
The freedesktop.org specification for some reason makes it a subclass of
C sources, so override the MIME type as a workaround.

Task-number: QTCREATORBUG-20539
Change-Id: Ie822fd796c8b3b570ecb840412d74a12b3c1d5a7
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-06-20 07:26:59 +00:00
Ivan Donchevskii
840ab99115 Clang: Add default diagnostic configuration for Clazy
... and Clang-Tidy + Clazy.

Use stable 'level0' checks.

Change-Id: Icdcbb8807f7925bf93f8b4e11a00c2710d6693cd
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2018-06-20 07:00:23 +00:00
Ivan Donchevskii
6575cfc674 Clang: Add default configurations with Clang-Tidy checks
The first configuration contains most of checks
which make sense for most of generic projects.

The second configuration is extremely slow but plays
the role of Clang static analyzer.

For the sake of viewing these checks Clang-Tidy checks tree
is modified to be expandable in read-only mode.

Change-Id: I41c4ee26bcdf05384507427b842d61e255d59bf7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-06-20 07:00:16 +00:00
Eike Ziller
3bbe535b95 Merge remote-tracking branch 'origin/4.7'
Change-Id: I3c5d7e9e8c589ad4425cd89d61e1f572f5cb7997
2018-06-19 10:03:28 +02:00
Ivan Donchevskii
e1111d4570 Clang: Use built-in follow symbol for virtual methods
ClangCodeModel currently does not provide a list of overrides.
Therefore it makes sense to use ClangCodeModel result for
virtual method only if built-in code model does not find anything.

Task-number: QTCREATORBUG-20584
Change-Id: I5b4fac7974f990e741d3438ab61827670a8ce8d8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-15 12:15:22 +00:00
Ivan Donchevskii
75cda95039 Clang: Add option 'Build before analysis' to project settings
Diagnostic configuration Id was already there but
not the checkbox whether to build project or not.

Change-Id: Icb5fc15bda5eed5e375cd90df1a96060b30bf57e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-15 12:14:44 +00:00
Eike Ziller
9b43b55dc0 Merge remote-tracking branch 'origin/4.7'
Change-Id: I762dbddb0f337e9a5fc4b113c7876813e9f45c9c
2018-06-11 16:01:18 +02:00
Orgad Shaneh
c62daf9cda CppTools: Do not use -isystem for header paths in the repository
Clang uses mmap for system headers. This locks the header files on Windows.

If the project file is not in the root directory of the repository, and it
uses header files that are outside its directory, but in the repository,
Git operations like checkout, rebase etc. can fail because the header files
are locked.

Change-Id: If8a258234479fc70ca0a8384bf24c68d767dbeaa
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-11 11:38:10 +00:00
Hannes Domani
168e89e0a2 CppTools: Fix memory leak of QFutureWatcher when canceled
Change-Id: Ia9cd428e3bed193167903b6ffa080e4886193789
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-08 15:48:21 +00:00
Eike Ziller
f8e88e8ce4 Fix compilation issues with C++17
Testable on Linux/macOS by changing c++14 to c++1z in qtcreator.pri.
Testable with latest MSVC2017 by setting _CL_=/std:c++17.

unary_function, binary_function, and a few other things that were
deprecated are removed in C++17.
std::string got a non-const overload for its "data" member function,
so we cannot create a function pointer on it without specifying its
type. Use std::declval instead (though it requires a default constructor
for the type).

MSVC seems to have an issue with Utils::transform for std::vector
(used in Nim plugin), but that looks like a compiler issue.

Change-Id: I94f9a93d591d55b610f86fabfc618158927d6221
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-06-05 12:04:59 +00:00
Ivan Donchevskii
4e4bd4909a Clang: Use follow symbol result from clang when global fails
When built-in code model fails to follow symbol under cursor
fall back to the clang result even if it only follows
to the decalration.

Change-Id: I22d8c5fee6ab7594b1d1b7ce8104414db28383c7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-04 08:48:33 +00:00
Ivan Donchevskii
b0c0119345 CppTools: Use cursor range for better outline navigation
Clang provides cursor range for each declaration in
symbol outline. Use that information to search for
more accurate correspondence between a cursor position
in editor and an entry in symbol outline.

For example skip indexes with not matching ranges to
prevent pure declarations from automatically become
parents of everything coming after them.

Change-Id: I0ef95c26772050cd6655e830288c46118aba38bb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-06-04 08:43:44 +00:00