Commit Graph

34 Commits

Author SHA1 Message Date
Christian Kandeler
0ffbe6a9e4 CompilationDbProjectManager: Sanitize project parsing
The parsing code used to access all kinds of stuff (e.g. the project
tree and the toolchain manager) from the non-UI thread, which is not
allowed.

Fixes: QTCREATORBUG-22420
Change-Id: I4be47919d7e543376d31826dd380f66f4e060458
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-05-23 08:56:16 +00:00
hjk
36daca80f3 Utils: Make FileName::canonicalPath a member
Change-Id: I8d7450dec5c4c14ae3e007d1d66f1a9c3c98f807
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-20 11:06:12 +00:00
hjk
f4c9e5e5c4 More FileName::appendPath() -> .pathAppended()
Change-Id: I403d34e4f52f758339c158efc7a11fd329e3e043
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 11:55:04 +00:00
hjk
1e9636ab8a Some more FileName::appendPath() -> pathAppended() changes
Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 07:46:56 +00:00
hjk
ce449e4219 ProjectExplorer: Remove BuildTargetInfoList wrapper class
Change-Id: I1a2ae06ec8c5b7278abca2386834d7edd31597d7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-14 13:30:34 +00:00
Thomas Otto
b32c1453b4 CompilationDatabase: enable the listing of non-cpp files
Files listed in an optional "compile_database.json.files" are also
visible in the project, similar to the GenericProjectManager.

Change-Id: I1250b674298079bab90a0ffe036107a09b4ac6e5
Reviewed-by: Thomas Otto <totto@zbh.uni-hamburg.de>
Reviewed-by: hjk <hjk@qt.io>
2019-05-02 14:09:00 +00:00
Ivan Donchevskii
cc9d246b02 CompilationDatabase: Asjust the sysroot and target handling
If the sysroot option is found - set it as a kit sysroot (only
in CompilationDatabase project where we have a cloned kit
which does not affect the other existing kits).
In other cases use the backup for the sysroot from the
toolchain (can exist for clang toolchains based on mingw).

Provide target when searching builtin include paths for clang.

Fixes: QTCREATORBUG-22339
Change-Id: Ibe07c2e490ba4f7e0d259e6df698d641dbfd0298
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-30 18:00:17 +00:00
Ivan Donchevskii
a5c73fef3d CompilationDatabase: Allow the second root node
The 'directory' field of a compilation database can be
in many cases another root directory to look into.

Change-Id: Ie0d11bdc706f09e4d466b20fef614dd6ce00d4e9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-29 14:17:47 +00:00
Ivan Donchevskii
7167656a8d CompilationDatabase: Allow to set custom build step and run command
In addition export the ProcessStep class from ProjectExplorer
not to duplicate the code.

Task-number: QTCREATORBUG-21727
Change-Id: I43d0c83b0338995fdb37ace940092c83ce2b6820
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-29 11:21:57 +00:00
Ivan Donchevskii
b991e0ca95 CompilationDatabase: Fix few bugs and plugin tests
- do not convert the DOS path if it does not exist
 - pass the proper flags to addDriverModeFlagIfNeeded
 - reset the kit toolchain before picking the matching one
 - do not show the popup when running plugin tests
 - clang++ contains 'g++' but it's not a gcc compiler

Change-Id: Ia5018a2131bb123202b87e34e0ac3a79f0feb45d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-26 08:34:11 +00:00
Ivan Donchevskii
a5ee354b19 CompilationDatabase: Force QString implicit sharing
Most of the flags in compilation database are the same,
let's share them by inserting them all into the temporary
QSet of QString-s.

Change-Id: I7d9b410b4b0bee40247434b49371bd37214d4c59
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-16 09:52:59 +00:00
Ivan Donchevskii
2c5808bada CompilationDatabase: Ask for the root path and scan for headers
Let's use the same approach we have for CMake projects by using
the same TreeScanner class.

Compilation database does not have a concept of the root directory
so let's show a file dialog and ask for it the first time the project
is loaded. Next times we open it we take this path from settings.
This root path can later be changed from the project tree context menu.

Fixes: QTCREATORBUG-22031
Change-Id: I151aed8d0504b2e8aa14aa774cad25f8c86d5c17
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-04-05 15:26:19 +00:00
Eike Ziller
b3baed58c6 Merge remote-tracking branch 'origin/4.9'
Change-Id: If36258b8e572b5c7875433a31a836e4f06e27286
2019-03-21 11:28:21 +01:00
Ivan Donchevskii
ed43e6d99f CompilationDatabase: Refresh the tree on the JSON file update
Reparse the compile_commands.json file when it has changed.

Fixes: QTCREATORBUG-21733
Change-Id: I8e5a99efd136b1d46a417817bde5b5b989109eea
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-03-15 08:15:47 +00:00
hjk
4d2981b1f4 ProjectExplorer: Un-protect ProjectNode constructor
Not much protection needed, and not provided either, as seen in
the removed workarounds.

Change-Id: Ib33f6481cdb04481c0324bdeb57eb50143ecb62f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 10:41:50 +00:00
hjk
65be7c2915 ProjectExplorer: Use a setter for the Node's type
Change-Id: I3cc496151888cdecff0be54043a24fefe5ee2b02
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 10:39:58 +00:00
hjk
ffa88006a5 ProjectExplorer: Replace FolderNode ctor display argument
... by use of the setter.

Change-Id: Ie6bf15b4dfae4d4e4d98694313b6e7dc9a22c117
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-26 10:33:07 +00:00
hjk
09372918c1 ProjectExplorer: Remove FileNode's isGenerated constructor bool
Use setter of base class, similar to setListInProject() before.

Change-Id: Id620f0084a5dec0410f29c80f8f6393a6bcd5050
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-25 12:23:31 +00:00
Christian Kandeler
83dd031960 ProjectExplorer: Rename KitInformation to KitAspect
The name "KitInformation" does not properly convey the fact that it
represents a certain *aspect* of a kit. The same goes for
"KitConfigWidget", which in addition was inconsistent with
"KitInformation".
We now use "KitAspect" and "KitAspectWidget".

Change-Id: I9804ee4cedc4d61fad533ea1dd4e4720e67fde97
Reviewed-by: hjk <hjk@qt.io>
2019-02-11 11:55:01 +00:00
Nikolai Kosjar
7b494c068e CppTools: Simplify ProjectUpdateInfo
...by using KitInfo.

Change-Id: I17b4dd6c368ba8b10b765f12a4663c041c9be7e5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-10 07:13:49 +00:00
Bernhard Beschow
3bdb7d1de5 CppProjectUpdater: Remove unread attribute
Change-Id: I51123e5b5609de431cfa6d1558aed0b9739ff9c8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-06 21:49:28 +00:00
Michael Weghorn
92f1dba285 CompilationDatabase: Fix directory hierarchy
When checking whether a child directory already exists,
only check whether that directory is present as a
direct child of the given parent, don't search
recursively.
Otherwise the directory hierarchy in the project outline
can get messed up if multiple directories with the same
name exist at different levels in the folder hierarchy.

Side note: Besides avoiding an incorrect folder hierarchy,
avoiding the recursive search also speeds up building up
the folder structure (e.g. it took ~4 instead of ~20 seconds
for building up the hierarchy of the LibreOffice source
tree in my case).

Fixes: QTCREATORBUG-21725
Change-Id: I5fc3c5c85d44ad8e3664f29e9143fc070d488c7a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-19 13:49:08 +00:00
Robert Loehning
6c267b34b3 CompilationDatabase: Don't translate qWarning
Change-Id: I5d7507fd05312e2d9b7ea57c94744aa311dc1104
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-14 13:16:01 +00:00
Ivan Donchevskii
0fabde31ab CompilationDatabase: Speed up parsing project file
Avoid expensive indexOf and check for the exactly same flags
before applying the full filter.

Change-Id: I6936b2022a2b439aad7bf0a65280c3db16d00c34
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-07 12:32:34 +00:00
Ivan Donchevskii
06162c1aa5 CompilationDatabase: Use QJsonDocument for separate objects
It is pretty easy to split objects without QJsonDocument help.

Due to the QJsonObject data size restriction use it
only for the already split objects inside the database.

Change-Id: Ice7c7407ad00aaac151a767f4d943fdcecf6a6b8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-05 15:51:28 +00:00
Ivan Donchevskii
7f67e987ea CompilationDatabase: Add folders to Project view
Change-Id: I4cd480535c203aa923b27596ea4ca74f83c12a9e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-05 15:51:12 +00:00
Ivan Donchevskii
3c3b75cef1 CompilationDatabase: Fix command line parsing
Handle cased when -x{kind} is one option.
Skip -o output files.

Task-number: QTCREATORBUG-18402
Change-Id: Id8a8612bed2db2b35f17b0968a4ff529e7a66194
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-02 14:12:34 +00:00
Ivan Donchevskii
fb25bd53c1 CompilationDatabase: Create target in the same thread
Causes a warning otherwise.

Change-Id: I040c3298e7c0898364b49ff4c6605f11f01c538f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-02 13:37:13 +00:00
Ivan Donchevskii
38d39fb9f0 CompilationDatabase: Add target to the compilation database project
Target exposes information about kit and toolchain to the outside
and enables tools like Clang-Tidy and Clazy.

Change-Id: I27b73bbb3b810789f6ca3d447b744604f8e61286
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-02 06:59:43 +00:00
Ivan Donchevskii
f604c8a77c CompilationDatabase: Support both code models
Extract headers, defines and fileKind from flags in
order to have complete project parts.

Side-effect: better support for MSVC-specific flags.
Change-Id: Iaa1413c91c96c3cf89ddbe76a7a1f0f46c5289c0
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-01 14:52:05 +00:00
Ivan Donchevskii
cb9df98efb CompilationDatabase: Fix escaped quotes handling
Change-Id: Iaecd38f921bd719899e478a76d8a8b9d4230a7cc
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-01 10:02:53 +00:00
Ivan Donchevskii
8ab9b93b79 CompilationDatabase: Fix opening relative file paths
Change-Id: I0d0ac8af9cd48510b8b8a80adfb20b8c526cd2e4
Fixes: QTCREATORBUG-21386
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-29 11:45:39 +00:00
Nikolai Kosjar
5900766ecb Toolchains: Detect unspecified language version
We checked the command line from the project manager for "-std=X" and
friends to figure out the language version to use. However, if such a
flag was not provided, we assumed the latest version we support. This
could conflict with the actual version of the compiler and its
predefined macros.

Figure out the version by inspecting __cplusplus/__STDC_VERSION__ in the
predefined macros of the toolchain. The MSVC compiler is an exception to
this, as it does not seem to properly set the value - check for
_MSVC_LANG if possible, otherwise simply assume some versions as before.

While at it, add also support for C17/C18 and the upcoming C++2a.

Task-number: QTCREATORBUG-20884
Task-number: QTCREATORBUG-21188
Change-Id: I464ffcd52d2120c0208275a050e82efda44fae1c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 09:07:56 +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