Commit Graph

2439 Commits

Author SHA1 Message Date
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
Nikolai Kosjar
3c5dc450b8 CppTools: Remove enum duplication
Change-Id: I2eb452780c21f8d30034bcfbb3266fc8daa10802
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-09 08:14:09 +00:00
Christian Kandeler
a7d502a309 CppTools: Fix clang warnings about old-style casts
Change-Id: I947051dec996e92e4afe178e985374587337c4f0
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-10-08 13:36:03 +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
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
Orgad Shaneh
f07396b86f CppTools: Apply SkipBuiltIn also to toolchain defines
The only place where Yes is used is the compilation DB, which doesn't
need these defines anyway.

Also add -fPIC for Qt compatibility.

This reduces the compile_commands.json file for Qt Creator from 180M to 33M.

Change-Id: Idd3b363c3a143b1d79f97962c4ff9ee61d7767a4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-25 12:44:00 +00:00
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