Commit Graph

2439 Commits

Author SHA1 Message Date
Alessandro Portale
1d3d18a969 CppTools: modernize
Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-21 09:00:18 +00:00
Nikolai Kosjar
eb9e8e128b CppTools: Fix incorrect QTC_ASSERT
Change-Id: I1c7bd599cc121484b4d33723123f34981c675407
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-17 10:55:43 +00:00
Alessandro Portale
c82d2cbd54 Fix warning: "Don't call QList::last() on temporary"
[-Wclazy-detaching-temporary]

Change-Id: I5e06e44fc45c80ea1dca518611d4f0c28a738061
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-01-17 10:05:30 +00:00
Alessandro Portale
adea8467f4 Fix warning: "Don't call QHash::operator[]() on temporary"
[-Wclazy-detaching-temporary]

Change-Id: Ide503c9260af285fa1dbedb63f7819c8ad616db6
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-01-17 10:04:11 +00:00
Ivan Donchevskii
0679c2ff25 Clang: Never use toolchain defines
The known cases provide enough flags not to require
toolchain defines.

Change-Id: Ia7e08a90eca6ea9474db40683ac1e63236f8643d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-16 12:18:55 +00:00
Ivan Donchevskii
0348009e0e Clang: Support MSVC style of compiler flags
Clang has MSVC compatible mode which works with MSVC style command line
flags.

When possible use the same flags (-I, -D, -U, etc.) and in other cases
either replace by MSVC analog (for example use /FI instead of -include)
or pass the argument with '/clang:' prefix (requires
https://reviews.llvm.org/D53457).

Change-Id: I95f33bed5dc8d9493895ed8d4359cdd70fc774b8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-16 12:17:31 +00:00
Nikolai Kosjar
4c0c3f5a64 Clang: Forward compiler options for gcc/clang
Rely on clang to do the "right thing" with them.

Change-Id: I44adf2cd5c61549896da3fc9b7c35c2fb0142060
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-16 11:47:29 +00:00
Christian Stenger
3bcd0c8d81 CppTools: Fix build for MSVC2015
Change-Id: I9bb230b73051330333109b3dd521feceb1ee94a7
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2019-01-15 14:38:05 +00:00
Marco Bubke
5dbaf387ba Utils: Move C++ language details from ProjectExplorer to Utils
We want to use them in the backend processes too so it's nice to share them
in Utils. A concrete size was added too because they should be serialized.

Change-Id: Id5eb8f46643d5159f034fc9559f68a08d7e5847a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-15 10:37:03 +00:00
Eike Ziller
71d60ee9c8 Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/cpptools/compileroptionsbuilder.cpp

Change-Id: I522f91de70aff28692d7c3a050e8d52df0b82a76
2019-01-15 08:40:23 +01:00
Nikolai Kosjar
ae0d895d96 Clang: Warn of potentially expensive checks
...for the code model.

If a diagnostic configuration with potentially expensive checks is
selected in Options/Preferences > C++ > Code Model, show a warning below
the combo box.

Change-Id: I52c5c2e229fd50c0fd82f70154fb5b727726ba31
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-01-14 14:10:06 +00:00
Ivan Donchevskii
951aee8f3a Clang: Fix parsing boost headers
The fix for MSVC2013 undefined clang macros to fix some
internal Qt stuff failing in Qt 5.7.

Now we know exactly which MSVC version is used and can
ignore this fix for newer versions.

Fixes: QTCREATORBUG-16439
Fixes: QTCREATORBUG-21685
Change-Id: Ie2844428c39d72d212198ee2dd6841420a464974
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-14 06:44:52 +00:00
Nikolai Kosjar
7109e8f050 Clang: Minor cleanups in CompilerOptionsBuilder
Change-Id: Iaf5af70136bceed52d19622c01d9d7147e5abeea
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-11 07:20:52 +00:00
Nikolai Kosjar
591cc5a8c4 CppTools: Reorder some (Raw)ProjectPart members
Mostly for clarity, but as a side effect, this reduces the size of
ProjectPart from 168 to 160 bytes.

Change-Id: Iee23c97d581a5233554c05ed2fd7ea07e2e9b45a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-11 07:20:32 +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
Nikolai Kosjar
4ce9ec5d63 CppTools: De-duplicate code for CppProjectUpdater
Centralize gathering the kit, toolchains and qt version.

Change-Id: I6bd586ac7925e2ee556fd119f1dab096cd500e41
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-10 07:13:38 +00:00
Nikolai Kosjar
b114f77d8a Clang: Stop enabling exceptions explicitly
According to commit e2e3be09e3 this was
needed for clang 3.8.0 on Windows.

Change-Id: I4f2c2bf31449d9613607e57524c7ff6e4577812a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-01-09 15:03:25 +00:00
Orgad Shaneh
c225216b93 Utils: Introduce GlobalFileChangeBlocker
Tracks application state, and signals when it is changed.

Supports forcing blocked state with reference counting.

Change-Id: Ic173d42446b1b08bd4a1e7c1acf38c68644d30b3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-01-08 14:21:39 +00:00
Nikolai Kosjar
820e4f8177 ClangTools/QMake: Stop analyzing files not part of build configuration
...for the qmake project manager.

When parsing the project files, remember whether a file was discovered
by the exact or cumulative parse. Only files that were discovered by the
exact parse are considered "active" and thus part of the build
configuration. The others are not offered for selection.

Fixes: QTCREATORBUG-16016
Started-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I7a28b4de15e048975d7f0cd737dd8c11f744315b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-08 14:09:52 +00:00
Eike Ziller
04a4bacbf9 Merge remote-tracking branch 'origin/4.8'
Conflicts:
	src/plugins/coreplugin/dialogs/externaltoolconfig.ui

Change-Id: Ie38e9028cee599578c59b22325d85c097335243e
2019-01-07 13:24:12 +01:00
Bernhard Beschow
9ee785a4ef CppModelManager: Remove method overload used only in tests
Use (and therefore test) the method actually used in production code.

Change-Id: I4317517ef8a1779df4d46af3905790012ee98645
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-06 21:50:08 +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
Bernhard Beschow
552e730426 QbsProject: Remove unread attribute
Also remove the signal CppProjectUpdater::projectInfoUpdated() which is
now unused.

Change-Id: I65afe8f96cd8175edaf8ccb6e5067e4f9cd8d99f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-06 21:48:42 +00:00
Christian Kandeler
3741c2213d CppTools: More build fixes
Change-Id: I350479c0f79869cccdf0edfd6c89d932d8f3215f
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2018-12-21 11:26:48 +00:00
Christian Kandeler
e250543cc7 CppTools: Fix build
Amends 97828a96af and ef8de6a384.

Change-Id: I9dd7d6a093657ea6f20ff3b5a4d0c968f8293ad7
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-12-21 08:21:53 +00:00
Marco Bubke
781dadc94a CppTools: Add reset function to CompilerOptionsBuilder
It makes it easier two get different options.

Task-number: QTCREATORBUG-21693
Change-Id: Ibcfa52d8bbbdf971a38fb6102a6b79e037a9cf02
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-12-20 18:46:44 +00:00
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