Commit Graph

2563 Commits

Author SHA1 Message Date
Marco Bubke
97828a96af CppTools: Adapt CompilerOptionsBuilder to HeaderPathFilter
After we moved some of the code to HeaderPathFilter we now use it in
CompilerOptionsBuilder.

Task-number: QTCREATORBUG-21693
Change-Id: Iea3569465bbc135d72bd88f9c23026f2ace33aba
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-20 18:46:14 +00:00
Eike Ziller
83fb81df35 CppTools: Fix categorization of *.inl, *.tpp, and similar
These are files that are included like headers, and not compiled
themselves, so e.g. adding them to a project should not categorize them
as source files.

Fixes: QTCREATORBUG-21736
Change-Id: I7dafba02896d12160de5eed458b99144df0a5f37
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-12-19 13:35:15 +00:00
Bernhard Beschow
763e0d059e CppProjectUpdater: Reuse cancelAndWaitForFinished()
Change-Id: I749dd0244175060ce79d6050b12b729866c06c9d
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-12-19 13:27:37 +00:00
hjk
e6a71fb43d CppTools: Compile fix
Amends ef8de6a384516c.

Change-Id: I50dc5b63867888ed258d6dedf643c3cc33b1014c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-17 13:21:49 +00:00
Marco Bubke
ef8de6a384 CppTools: Introduce HeaderPathFilter
We went the filtering of the header path outside of the compiler options
builder so merge the PCHs.

Task-number: QTCREATORBUG-21693
Change-Id: Ia1126813a5049e39d7c6e7d60bf449aa17012d02
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-17 11:06:14 +00:00
Eike Ziller
9084ca73df Merge remote-tracking branch 'origin/4.8'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I87f47cecbb924064296a002fd9446a0627acad8e
2018-12-12 09:44:13 +01:00
Ivan Donchevskii
5cd4a73aca CppTools: Return proper tab settings
We are always interested in currentTabSettings().

Fixes: QTCREATORBUG-21280
Change-Id: I5b739b516eb985074c27410113c244787dd8b52d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-12 06:39:50 +00:00
Ivan Donchevskii
aa70799795 Clang: Always force the built-in includes order
C++ includes must always come first, then clang resource
directory and then everything else.
This prevents both c++ standard headers and intrinsics issues.

Change-Id: Ia21bfa2fe99884c9adf58f7ef6beba1bede1724b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-11 07:49:09 +00:00
Nikolai Kosjar
f6b8302efd Clang: Stop forwarding toolchain macros
...for clang code model and clang tools use case.

This means that compiler detection code will see clang now instead of
the toolchain that is configured in the kit. While providing the
toolchain macros worked fine for the general case, it always was
problematic for compiler detection code.

By not providing the toolchain macros we are more close to the real
clang compiler invocation. That is, rely on clang to do the right thing.

Allow to go back to old behavior with QTC_CLANG_USE_TOOLCHAIN_MACROS=1
as this will be useful checking differences for debugging.

Fixes: QTCREATORBUG-19543
Change-Id: I23ffd761d83f35ca1a22269c3ef07a2dc62358bd
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-10 10:25:22 +00:00
Eike Ziller
e5c2ee922a Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I743ea39480cc5c7b6febcd2e93713d15a3ae6d9c
2018-12-07 08:53:11 +01:00
Nikolai Kosjar
c7c800a73e CppTools: Split CppTools::UseBuiltin in two options
...for clarity.

No behavior change.

Change-Id: Id0334bc79b97a8ff53b37089e337530c9a01b1d4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-12-04 14:57:20 +00:00
Ivan Donchevskii
e57c1268ee ClangFormat: Move settings to the Code Style widget
It makes sense to unify the indenter creation by replacing
the CppCodeStylePreferencesFactory instead of removing it.
We are reusing the same options page but with different
kind of settings.

With this change wizards will no more be confused by missing
factory and will create the proper indenter.

Fixes: QTCREATORBUG-21516
Change-Id: I38964d5fa1f2257617c66a1441db723d239a3237
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-12-04 11:42:22 +00:00
Nikolai Kosjar
a2306bfe78 CppTools: Fix build with MSVC
compileroptionsbuilder.cpp(196): error C2440: 'initializing': cannot
  convert from 'const char *' to 'QString'

Change-Id: Ifa5e50ab927c534a855c2f7871d3dce87092b30a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-12-04 08:43:52 +00:00
Nikolai Kosjar
273157c2a1 Clang: Unify CompilerOptionsBuilder options
No behavior change.

Sometimes we use "SkipX, sometimes "UseX". Unify to "UseX" as this is
more natural to read.

Change-Id: Ib08bdb4cde93ed55fdb9c855566b10a3933cae37
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-03 15:19:03 +00:00
Christian Stenger
0ee1c97ab7 CppTools: Fix compile with older Qt / gcc
Change-Id: I00656b409135ee1a84a0a372f726fdbc7c20d1e6
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-12-03 14:30:29 +00:00
Nikolai Kosjar
0c38e3aea7 Clang: Clean up CompilerOptionsBuilder
No behavior change.

* Remove virtual from methods that are not overridden
* Move constant member functions that do no access any members into
  source file as static functions
* Remove QLatin1String where possible
* Make variable names a bit more consistent
* Other minor stuff

Change-Id: I34a582d5a468489e11365507b283e9aee157664f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-03 12:58:31 +00:00
Ivan Donchevskii
8920d78bb2 Clang: Use -fms-compatibility-version with clang-cl toolchain
It's used while building so let's also do that in Clang Code Model.

Change-Id: I4e5e3ccc71d14c8d44049672e37380af2592390f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-12-03 08:51:57 +00:00
Orgad Shaneh
7096649fc2 Merge remote-tracking branch 'origin/4.8'
Change-Id: I5b18233936e3b2cd674df92a694ba73b5a3ed752
2018-12-03 09:56:07 +02:00
Nikolai Kosjar
12dce3ef7d Clang: Work around eating memory with gcc/clang/-fno-rtti/boost
Boost recognizes a misconfigured compiler in rtti emulation mode
(-fno-rtti) as our libclang command line is special. Even worse, it does
not seem to stop instantiating templates and allocating memory
afterwards.

For the former to fix, we need to rework our command line (in master).

The latter can be work arounded by defining
BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING with a value for gcc/clang.
See also
https://www.boost.org/doc/libs/1_64_0/doc/html/BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING.html

Task-number: QTCREATORBUG-19543
Change-Id: Iddb5be2d1f1966018e5ab535a8f7475fe7911284
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-29 12:51:29 +00:00
Eike Ziller
29c9f8080d Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/android/androidrunnerworker.cpp

Change-Id: Ibd8b99435365fb7e7d488313fd1d2b3a75adad1b
2018-11-29 13:36:14 +01:00
Nikolai Kosjar
9fe8c46d15 C++: Use file size limit also for included files
We can't stop the clangbackend from processing huge files, but at least
our built-in parser.

Fixes: QTCREATORBUG-21590
Change-Id: I506024495ba0632692f2845c6c204360f4c61b33
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-29 11:03:53 +00:00
Ivan Donchevskii
d47cb48909 Clang: Do not call built-in follow symbol with no document
CppEditor tests (the part which works with ClangCodeModel) showed
that it's possible that QTextCursor might get document reset
to the moment we try to call built-in follow symbol. That means
that the editor widget is closed already.

Check for the document to prevent such behavior.

Change-Id: I2463f4688dc6fca7f701fba243ffc6e43a573b33
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-28 09:07:11 +00:00
Ivan Donchevskii
f5fb9932a2 Utils: Fix column number for Highlighting result
Follow up for 8469e317c9. This column number compensation
is not required anymore.

Fixes: QTCREATORBUG-21384
Change-Id: I94da48533520471170200c592129781e5b4b614c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-26 15:39:43 +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
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
Nikolai Kosjar
7ef2dccff8 CppTools: Fix thread-unsafe call to MessageManager::write()
The Preprocessor running in a worker thread can call this function.

Fixes: QTCREATORBUG-21481
Change-Id: I4970379fbabae23cfa3d7c1222e81a4ae8c3e6ad
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-15 14:55:12 +00:00
Ivan Donchevskii
36f4ed54df CppTools: Simplify the currentProjectCodeStyle code
Use alias to shorten the repeating default return value.

Change-Id: I673fc1d293c1612c945c80d554c6667a756108de
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-13 08:29:36 +00:00
Nikolai Kosjar
6cd6d8ef4e CppTools: Forward OpenMP extension flag
Fixes: QTCREATORBUG-21213
Change-Id: I986ab69bc44ece83a3b56f968cc3b6c3126e2c32
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-13 07:27:26 +00:00
Ivan Donchevskii
8dc566e902 CppTools: Allow to check whether project code style exists
The calling code can anyways fallback to the global style
without extra help if no project style exists.

It is useful when you want to get the project style if it exists
and understand at the same time that it is not a global one.

Change-Id: I265de3f436f90623385427fc8a1abad09c8c3577
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-12 08:56:20 +00:00
Ivan Donchevskii
868c8e31d5 ClangFormat: Fix crash on exit
Was introduced in 0e5c7f51fa with the page being deleted
to remove it from the global list of pages.

Change-Id: Ia13f7ab74d85b5b8c66f1b20e33d97c29ce3e8f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-12 08:09:00 +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
Ivan Donchevskii
8469e317c9 Utils: Adjust column numbers affected by convertPosition change
convertPosition change was introduced in 931ec39f64.
It changed 0-based column to 1-based which is how it
naturally is in Qt Creator.

This fixed some usages but broke many more. This is an
attempt to fix the remaining use cases.

Fixes CppEditor auto-tests.

Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-09 08:51:21 +00:00
Ivan Donchevskii
0e5c7f51fa ClangFormat: Synchronize with C++ code style settings
And remove UI for default code style settings because
it does not affect anything when ClangFormat plugin is
enabled.

Change-Id: Ie348b7d2691b09ea2b4868da987f2a27347ea0f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-11-08 14:23:06 +00:00
Nikolai Kosjar
c8c642dde0 Clang: Fix crash when removing diagnostic config
1. Create some Qt Console Application from the wizard
  2. Open Tools > Options > C++ > Code Model
    2.1 Click "Manage..." and create a custom configuration "custom" and
      finish with OK.
    2.2 Set "custom" as diagnostic config.
  3. Analyze > "Clang-Tidy and Clazy..."
    3.1 Use "Custom Settings"
    3.2 Click "Manage..." and remove "custom" ==> Crash

The crash happened because the code model used an invalid diagnostic
config id. The invalid id came from the settings, which were not
correctly upated.

Fixes: QTCREATORBUG-21273
Change-Id: I5242f7c92e121eec8558fa7923139bb3d759c676
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 13:14:19 +00:00
Nikolai Kosjar
4a09a6a2cf Clang: Fix reading inconsistent settings
The diagnostic id might not match any diagnostic configuration in the
settings as Qt Creator prior version 4.8 could have written it
inconsistently. We need to correct this case.

Task-number: QTCREATORBUG-21273
Change-Id: Ic9e21f70bca94da6d9afb30f0b2bfd5024d16fdd
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-11-08 13:13:45 +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
Andre Hartmann
a59097086b CppLocatorFilter: Fix result sorting
* Fix rating items with startsWith()/contains() higher
* Rate matches in function parameter list lower

Task-number: QTCREATORBUG-19377
Change-Id: I2ea4c3ba96cd086aef82627326fa0888f700850f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-02 09:32:41 +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
b97d4c2f80 Clang: Check that file kind matches the language version
It was checked that pure C header and source files had proper
language version but not another way around.

Change-Id: I1eaf41f342731bdbe30ee73e81144334d0f15d19
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-01 10:04:24 +00:00
Orgad Shaneh
24bcce4aa6 CppTools: Change default of "Ignore precompiled headers" to false
If the project has no PCH it has no effect, and if it does have PCH it is
typically important to use it.

Change-Id: I20ce2a0c5713253d2754d31e7b7dca51696b208b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-11-01 09:14:49 +00:00
Ivan Donchevskii
b385171eb8 Clang: Don't wrap Qt headers when generating compilation database
This trick is needed only for internal purposes.

Change-Id: Ic10c0898519eed663d14c4b1665a0d6b0d47b4a4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-10-30 13:07:45 +00:00
Eike Ziller
7d3686359a Fix missing translation contexts
Change-Id: I4402157e7991ad0050333a34394b87ff3d6f4a1b
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2018-10-25 11:46: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
Alessandro Portale
12d8f7e3af CppTools: Bump llvm.org docs link to version 7.0.0
Since we now ship clang 7 binaries, let's open the docs accordingly in
the browser.

Change-Id: Idfd8967fbbadfee87df6f7e721e1ee13ea15de87
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-24 07:07:03 +00:00
Nikolai Kosjar
cfbf2559f4 Clang: Fix naming conventions for *ModelManagerSupport* classes
We use "Builtin" and "Clang" as prefixes, not suffixes.

Change-Id: I6926aeb8f005176ef420c4421c257e3df61ee0b7
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-23 06:12:29 +00:00
Ivan Donchevskii
3c1565efcb Clang: Fix build with clang 7.0
As an addition update the header with Clang-Tidy checks.

Change-Id: Ib4a4d324e8cad95403a3e799e352205b05ed7475
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-17 05:56:51 +00:00
Nikolai Kosjar
d67ddfb5d1 Clang: Avoid starting backend jobs for inactive app and during VCS operations
...to reduce file locking on Windows caused by clangbackend's
parse/reparse jobs.

Considering inactive application state should help for external VCS
operations, e.g. on the command line. However, activating Qt Creator
while such a VCS operation runs might still lead to undesired behavior,
but this should be the less common case.

VCS operations started from within Qt Creator should see less locking
conflicts as we know when they start and finish. However, we just avoid
starting new jobs - there might be still jobs running.

Pending or new jobs will be started once Qt Creator is activated again
and all VCS operations finished.

Task-number: QTCREATORBUG-15449
Change-Id: I5f04c34f006e66162368efbdd58bd822a706f35e
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-16 06:40:43 +00: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
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
Nikolai Kosjar
2a40c215e9 CppTools: Inline ToolChainEvaluator
Change-Id: Ie5579820e4683a5e4d7d73034441d662e017b6a3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-09 08:14:16 +00:00