Commit Graph

853 Commits

Author SHA1 Message Date
Marco Bubke
e43aa08ebe ClangPchManager: Store collected build dependencies
Task-number: QTCREATORBUG-21289
Task-number: QTCREATORBUG-21377
Change-Id: Idba57ac09bc5a1f1ccef87f5e33f1ceeaccea372
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-21 15:05:23 +00:00
Ivan Donchevskii
053b2090b4 Clang: Fix C++ paths search in compiler options builder
Take into account paths from MinGW and NDK Clang.

Fixes: QTCREATORBUG-21540
Change-Id: I00906c75dc4ddeb92fe5942a0222285d8ce2eb9d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-21 13:18:22 +00:00
Orgad Shaneh
5170dd0858 Merge remote-tracking branch 'origin/4.8'
Change-Id: Ia8bf92c8effdee0e1085730cb975ff88c8ad85fc
2018-11-20 19:13:13 +02:00
Marco Bubke
2a65be107b ClangPchManager: Filter missing includes recursively
Missing includes prevent the creation of PCHs. So removing includes which
directly or indirectly point to missing includes is a requirement for
working PCHs.

Task-number: QTCREATORBUG-21529
Change-Id: Id55be164df590149fe1ab55c2a3a90b8b5e3bfa7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-20 14:25:08 +00:00
Marco Bubke
64a3a130ac Clang: Add BuildDependencyCollector
IncludeCollector is renamed to BuildDependencyCollector. It is now
returning a BuildDependency instead of individual getter. The test coverage
is improved too.

Task-number: QTCREATORBUG-21379
Change-Id: Ifc2d1c40c85772cf498c21968de526f4408b6023
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-20 14:24:03 +00:00
Orgad Shaneh
f73ed6bb54 UnitTest: Fix compilation
Change-Id: I4207a6f8fc162336807c3f037a11578c1f8632ed
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-19 19:43:25 +00:00
Eike Ziller
3d1d9aae2e Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/winrt/winrtdevicefactory.cpp

Change-Id: I33b8697e2ebf2bea051d7f1144449e0743ee16a5
2018-11-19 10:00:18 +01:00
Orgad Shaneh
0ed6409618 Clang: Remove duplicate CXX flags
Most of the flags appear twice on llvm-config-7 --cxxflags (at least on
Debian).

Change-Id: I9c5630d61472fa37bce998ec541a0ab561b83722
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-15 08:57:34 +00:00
Nikolai Kosjar
5b12ada2dc Clang: Fix completion icon for members in member init list
Change-Id: Ib02320dcf4de7cbb8ac6fbf29d1929edae77591a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-14 07:38:19 +00:00
Eike Ziller
3666e3aaeb Merge remote-tracking branch 'origin/4.8'
Conflicts:
	tests/unit/unittest/unittest.pro

Change-Id: I4f0ab05f96ee60900a3a35fad4c7331238367593
2018-11-09 13:30:40 +01:00
Marco Bubke
9b1e7e440a Clang: Add BuildDependenciesStorage
Task-number: QTCREATORBUG-21378
Change-Id: Ibcb90239d240653b21f12a7b96a7775e5b0b4319
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 14:34:02 +00:00
Marco Bubke
6eb620238b Clang: Refactor FilePathId
We don't need the directory id any more. It's not used widely any way.

Task-number: QTCREATORBUG-21443
Change-Id: Ia95ea4c72fe9530ac56262f61f17faca04d313ba
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 12:51:15 +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
Marco Bubke
f644ea0a01 ClangPchManager: Add BuildDependenciesProvider
It is still unfinished but I want to add other changes first.

Change-Id: Ife7ac56576f85d800633ea1e8f1c3f4f16486d5f
Task-number: QTCREATORBUG-21377
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-06 11:52:11 +00:00
Eike Ziller
1473bc5891 Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/debugger/debuggermainwindow.cpp
	src/plugins/qbsprojectmanager/qbsbuildstep.cpp
	src/plugins/winrt/winrtdevicefactory.cpp
	tests/unit/unittest/gtest-creator-printing.cpp
	tests/unit/unittest/gtest-creator-printing.h
	tests/unit/unittest/unittest.pro

Change-Id: Ie9b80b87a8a4fa81baf72a2daa7919b21371c15e
2018-11-06 09:20:00 +01: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
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
Nikolai Kosjar
d52ac9a708 Clang: Fix unresolved #includes for ui_*.h headers
...with an extra parse.

Previously, the creation of an e.g. "Qt Widgets Application" from the
wizard could show code model errors in mainwindow.cpp. Depending on
timing issues, the first error is either

  1. 'ui_mainwindow.h' file not found (QTCREATORBUG-15187)
    The parse happened before the in-memory ui_mainwindow.h was
    generated by uic. The file system watcher can't help here as the
    #include was not resolved successfully. And libclang's reparse does
    not handle this case (it would need to remember all failed #include
    stats...).
    ==> Detect this case with the help of the include paths and trigger
    a full parse.

  2. or: allocation of incomplete type... (QTCREATORBUG-15187)
    The parse happened after the generation of the in-memory
    ui_mainwindow.h, but before the clangbackend received the unsaved
    file.
    ==> Fix this by also writing the content of the unsaved file to our
    behind-the-scenes-created ui_mainwindow.h.

Fixes: QTCREATORBUG-15187
Fixes: QTCREATORBUG-17002
Change-Id: I4f3a81adaa3d604746977a402c29f83fbc5b0e44
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-31 10:38:27 +00:00
Ivan Donchevskii
93269f3ecd Clang: Add unit-tests for function overloads completion order
Make sure that the same function overloads with different priorities
come together in the completions list.

Fixes the case when we complete the method without '.' or '->'.

Change-Id: Icaf7ea47f5e58b3ae5cc9764ad79c857f6f6e231
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-26 07:22:24 +00:00
Marco Bubke
f8ec57919f ClangPchManager: Add PchTaskGenerator
Task-number: QTCREATORBUG-21358
Change-Id: Ia460ce82c3c896f4d0ac00638d03800a55dd27dc
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 13:35:11 +00:00
Marco Bubke
ee2122be70 ClangPchManager: Add build dependencies to include collector
It's a first step but we have to refactor the interface later.

Task-number: QTCREATORBUG-21379
Change-Id: Idda666bcaec950203f001c993c54a926779527e0
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 13:35:02 +00:00
Marco Bubke
e571220663 Clang: Add top system includes to include collector
If we want to split the project part we have to filter out the top system
includes.

Task-number: QTCREATORBUG-21345
Change-Id: I258fa33ac39bd94b4699f4f39923d6ad274c1dc7
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 13:34:52 +00:00
Marco Bubke
be3e06cc7e Clang: Fix test
Change-Id: I599d42f3a2584b40cbcec1368db9a2b11b0112d5
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 13:34:44 +00:00
Nikolai Kosjar
d946ff5403 Clang: Fix adding completion snippets after {
...e.g. as in "void f() {".

The criteria whether to change snippets got invalidated with

    commit 8d0391a4f9
    Clang: Treat brace initialization as constructor completion

as the completion operator might be T_LBRACE now instead of T_EOF_SYMBOL
for normal completions.

This fixes the plugin test ClangCodeCompletionTest::testCompleteGlobals.

Add also unit tests.

Change-Id: I85cf522b9b307359c5c3e25198dd228cbb68ded0
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-25 12:13:57 +00:00
Ivan Donchevskii
83a63c7914 Clang: Go through CLANG-UPGRADE-CHECK
Change-Id: Iaaaea598d020a44bcdc60a8d06ee28a1f28386bb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-25 10:34:18 +00:00
Ivan Donchevskii
d05fe2fe15 Clang: Re-enable tests which do not fail anymore
Change-Id: I1f8f396eeb8e97a8910bc2bd454227a395330f31
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-25 10:25:01 +00:00
Christian Stenger
1b231d1dc6 Tests: Fix linking without lib tooling
Change-Id: I51110089b1bed337de54dfa7167b2a5aff761837
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-24 15:30:51 +00:00
Nikolai Kosjar
f1290da3cd Clang: Avoid running pointless UpdateDocumentJobs
Opening a document (without typing in it), switching away and back to it
resulted in running UpdateDocumentJobs for that document for nothing.

As for documents we are going to reset, simply set opened documents
initially dirty.

Change-Id: I8edc2d1fb8f6f92950b4e2067f60609176bd5b26
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-24 12:52:14 +00:00
Eike Ziller
95db30bd3a Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/debugger/debuggeritem.cpp
	tests/unit/unittest/unittest.pro

Change-Id: Id2e4e9c2bc87b2556d7c2845aea3fe2fa11b630b
2018-10-22 09:53:54 +02:00
Ivan Donchevskii
78211741c8 Clang: Make SourceLocation lazily calculate its fields
Trigger path, line, column and offset evaluation only if one
of them is accessed.

Change-Id: Ib2f8b06ece94a3b7424db28523b5796628865202
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-17 05:56:39 +00:00
Ivan Donchevskii
78fbb0826b Clang: Fix fix-its positions calculation
Code completion does not save the unsaved file contents
in translation unit therefore we need to access unsaved
file directly to calculate the proper UTF-16 column.

Change-Id: I0f217b0d36e0ff94ebc483ed6bef94b55efd311a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-16 10:08:08 +00:00
Marco Bubke
2c885fa3d4 Clang: Split symbol storage
We need UsedMacros and source related statements in the PCH manager too,
so we have to split that class.

Task-number: QTCREATORBUG-21289
Change-Id: Ie27d4b518b3d6d9174e93fcb243fdb55a09ddf51
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-16 08:57:00 +00:00
Eike Ziller
511bd64f3f Merge remote-tracking branch 'origin/4.8'
Change-Id: I0ff6f659b7ccd4ff5a79e422a1d54488508fe05f
2018-10-16 07:11:57 +02:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Orgad Shaneh
1934d584c8 Merge remote-tracking branch 'origin/4.8' into master
Change-Id: I6ecd3732a147960681c6135e8752cbd046bad65b
2018-10-12 17:21:14 +03:00
Marco Bubke
28007d9a1c ClangPchManager: Introduce UsedMacroAndSourcesCollector
It's a subset to thesymbols collecter so we try to share some code.

Change-Id: I058eee39289453e205f039b3850c1816f1d8ec1a
Task-number: QTCREATORBUG-21257
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-12 07:51:49 +00:00
Eike Ziller
7af8e9b3b4 Merge remote-tracking branch 'origin/4.8'
Change-Id: I8acb6582890fb2e103996cc4987f7543d22d7108
2018-10-11 10:41:25 +02:00
Marco Bubke
77b5907c57 Don't remove __cplusplus
For the indexing we need all tool chain macros. Originally it was a fix
because the C++ version of the project part and __cplusplus could be
different but now they should be the same. They will be now removed in the
compiler options builder.

Change-Id: I7ae8721a29632473e76ecedb411a6c9001e5e199
Task-number: QTCREATORBUG-21265
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-10 12:25:30 +00:00
Ivan Donchevskii
76fad7aad0 Unittest: Fix compileroptionsbuilder-test paths on Linux
Match paths partially not to construct the whole path.

Change-Id: I397ac930e2d74b8eba98d1b523aabd4ed92f2aee
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-09 12:25:14 +00:00
Nikolai Kosjar
6aa11eb75e CppTools/ProjectExplorer: Remove enum duplication
... between CppTools::ProjectPart and ProjectExplorer::ToolChain.

Change-Id: I8b448747e454adbed77547460383b8515462cc81
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 12:34:57 +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
Marco Bubke
391cfab5d7 Clang: Add progress bars for creating PCHs and indexing
Task-number: QTCREATORBUG-21112
Change-Id: Ie0c00a58f479a2fe7cbc7322490808509733ff0f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 08:20:22 +00:00
Eike Ziller
8fa37a17c1 Merge remote-tracking branch 'origin/4.8'
Change-Id: I74268f767e2fc7dae5db390a0348095ef220abd2
2018-10-05 13:11:02 +02:00
Ivan Donchevskii
f6e5202b80 CompilerOptionsBuilder unit-tests
Bonus: minor compiler options builder issues fixed.

Change-Id: Ie25f8fad6729339de05f2bf9b614ceac873e2634
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-04 10:24:13 +00:00
Eike Ziller
f8ffe14b82 Merge remote-tracking branch 'origin/4.8'
Change-Id: Ife02e25f89a601e066851cddf0e000ac9491fc35
2018-10-04 09:39:10 +02:00
Ivan Donchevskii
efc39304a1 Clang: Move the majority of completion items sorting to ClangBackend
With this change ClangCodeModel only needs to sort completions by prefix.

Also some other optimization have become possible and are implemented here:
1. Getting completions after '{' for constructor overloads by replacing
   it with '(' inside usaved file.
2. Checking for all overloads requires only previous item check because
   all Class completions are already sorted to go before all CXXConstructor
   completions. Since they are not mixed no extra search is required.

Change-Id: Ie0187ad96a20857a63c1d71ddec74606b803f572
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-02 12:29:23 +00:00
Orgad Shaneh
c268ec8465 Merge remote-tracking branch 'origin/4.8'
Change-Id: I8044614199102217b6bfa5e47dac108ce7641185
2018-09-28 12:46:29 +03:00
Ivan Donchevskii
65ea6f8e83 Clang: Introduce Token class to work with CXToken pointers
Make tokenization and tokens annotation simpler.

Task-number: QTCREATORBUG-21143
Task-number: QTCREATORBUG-21144
Change-Id: I580091b7b63dd973228fd2e21cf2e74c7d0e7df2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-09-26 11:46:18 +00:00
Nikolai Kosjar
aa290912b8 Clang: Remove project tracking on clangbackend side
...as it is not needed. Just provide the compilation arguments as part
of the Document.

As a side effect, re-initializing the backend after a crash is cheaper
and will not freeze the UI anymore (referenced bug).

Task-number: QTCREATORBUG-21097
Change-Id: I866e25ef1fd5e4d318df16612a7564469e6baa11
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-26 10:45:41 +00:00
Marco Bubke
bca41fa9f6 ClangRefactoring: Initialize sqlite database only once
Initializing the database is not cheap so it is better to initializing it
only once. We simply check if the database file already exists and then
skip the initializing step.

Task-number: QTCREATORBUG-21174
Change-Id: I151090c5081c009f7913a30517065be2833791d8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-26 10:38:01 +00:00