Commit Graph

853 Commits

Author SHA1 Message Date
Christian Stenger
bf698f5a2f Unittest: Fix warning
Change-Id: Ie78646d82786ad8836f289ba53382dad2d51d3f5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-25 05:21:20 +00:00
Nikolai Kosjar
8f6eb41cad Clang: Ensure that platform codegen flags get also filtered
Leave the function addExtraCodeModelFlags() around as it's used by
ClangPchManager::ProjectUpdater::toolChainArguments().

This allows us to filter out excess target arguments in a follow-up
change.

Change-Id: I742d713dd1ca6c391ba77c52555dcf4e94cc2ff9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-22 11:46:42 +00:00
Nikolai Kosjar
6ee08c0289 Clang: Simplify include paths in tests
* The paths on Linux are always "canonicalized" by
  GccToolChain::gccHeaderPaths(). Therefore, canonicalize the paths in the
  tests, soo.
* Introduce some helper functions to shorten the code.
* Do not break the strings literal paths as this complicates comparing
  them.

Change-Id: I0fc8acde0e455a7974baae0d9fdffd3a4060ff74
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-11 13:08:46 +00:00
Nikolai Kosjar
6156c59c62 Clang: Put clang's resource dir after /usr/local/include
...also on Linux.

That's what clang invoked from the command line does.

Change-Id: I59c48d11fab3b944bb42ca7bb4cd9093a735df60
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-11 13:08:28 +00:00
Nikolai Kosjar
5165c037eb Clang: Avoid consuming gcc internal include paths
Given the (default) include paths of GCC, e.g.

 /usr/include/c++/7
 /usr/include/x86_64-linux-gnu/c++/7
 /usr/include/c++/7/backward
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include

discard gcc-internal paths like /usr/lib/gcc/x86_64-linux-gnu/7/include
as they are not relevant for clang and even confuse it with regard to
 #include_next.

Paths below the gcc install dir are considered as gcc-internal. The
install dir is queried with

  $ gcc -print-search-dirs

Some GCC distributions, like MinGW, ship the standard library headers in
the install dir. Ensure to not discard these.

Fixes: QTCREATORBUG-22898
Change-Id: Ia85258fb01b72ad073e71390e003fe8268e3b01f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-10-11 12:49:06 +00:00
Orgad Shaneh
facebc6184 CMake: Fix build with Clang 9
Change-Id: Idf82175de1670259abd27df54b2c776e943a11e8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-10-10 15:59:34 +00:00
Cristian Adam
4a20a596c8 CMake Build: Use shared precompile headers
This will make the build directory size smaller, as only two
pch files will be generated. Not one for every target.

Change-Id: I3eec91e7536eab1c62bff8843f075f0ef7b5fff6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-09-19 11:38:34 +00:00
Eike Ziller
ed9177f74c CppTools: Move ProjectUpdateInfo to ProjectExplorer
Used for updating project parts, so move it near RawProjectPart.

Change-Id: I77aeffbdbfb3d2ec0de600f61dcf7fbb7a355a98
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 06:37:41 +00:00
Eike Ziller
9cc45fe1fb CppTools: Move RawProjectPart to ProjectExplorer
Doesn't have any dependencies into CppTools anymore, therefore moving it
reduces the dependencies of the project managers to CppTools as well.

Change-Id: Ibe728abe59eb88a8877943dca1f48a85163e27ac
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 06:22:12 +00:00
Cristian Adam
486aaabd21 CMake Build: Use same Qt compiler defines for tests
Source code needed adjustments though.

Change-Id: I78b4610a6bb895a385c7c30a6c92c97a276b89dd
Reviewed-by: hjk <hjk@qt.io>
2019-09-10 15:05:59 +00:00
Eike Ziller
8452264a18 CppTools: Move QtVersion and BuildTargetType
QtVersion to utils/cpplanguage_details.h which already contains similar
flags.

BuildTargetType to ProjectExplorer, next to BuildTargetInfo (but not in the
same header to not pull that in everywhere).

Removes dependency on ProjectPart from RawProjectPart.

Change-Id: I5791065e4266f20c2657ee4b1b594df04b238a1c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-10 07:31:21 +00:00
Nikolai Kosjar
e6d16b6747 ClangTools: Support loading exported diagnostics
Add a new toolbar button to load diagnostics exported with

   $ clang-tidy -export-fixes=/path/to/file
   $ clazy-standalone -export-fixes=/path/to/file (master version)

Change-Id: I8316fe0706a18222e68220ef4fbfdc7ae8d09804
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-09-03 09:39:48 +00:00
Nikolai Kosjar
0ba729e527 Import YAML-Parser yaml-cpp
Version: tags/yaml-cpp-0.6.2
  License: MIT

yaml-cpp requires c++11 and since yaml-cpp 0.6 there is no dependency on
boost anymore.

A YAML parser is needed for the ClangTools plugin to parse exported
diagnostics from clang-tidy/clazy:

  $ clang-tidy -export-fixes=/tmp/tidy.yaml source.cpp

The imported source is stripped of unneeded files as documented with

  src/libs/3rdparty/yaml-cpp/patches/0001-yaml-cpp-Strip-unneeded-sources.patch
  (generated with "git format-patch -D")

Change-Id: Ib0a521b5aff4b1cd058eb480bfb99fde4b320dc7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-30 08:42:22 +00:00
Marco Bubke
99e841d140 UnitTests: Add return value to mock function
Otherwise we try to get access a negative index. The real implementation
will never return a negative value, so the shouldn't the mock function.

Change-Id: I369e168bd18530b39fa5e2a622a716b30b8b344c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:54:06 +00:00
Marco Bubke
9f805b7e8a ClangRefactoring: Improve follow symbol and usage
Change-Id: Idb42010443e4560489ef067e54d05b4e567598e9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:53:45 +00:00
Marco Bubke
c174eb378a Clang: Reduce database accesses
If we prefetch data from the database to the caches we reduce the database
transaction calls which are quite expensive.

Change-Id: I617a0d886807402e0a94291a913a77f989970b55
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:53:32 +00:00
Marco Bubke
e0ca44e7bc CLang: Improve locking in StringCache
If there is no mutex we can skip some calls.

Change-Id: I3f2cc2d8da142bab28ace496a59711346aa1b5a0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:52:56 +00:00
Marco Bubke
199746143a Clang: Bulk add project file paths to database
This project part container generation because there is not anymore one
single access to the database for every file path.

Change-Id: I5f82022262fe89a976729d48ee4f098b74a1e1d1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:52:09 +00:00
Marco Bubke
947cb9ed4e Clang: Improve file path cache
Change-Id: I940dc63c0fc95fbb826ed7d19a1ac1e4db5a542c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:51:56 +00:00
Marco Bubke
f9fb4508d4 Clang: Optimize file path cache
We now fetch all directories and sources from the database at file
path cache creation.

Change-Id: I92510b49a234128f4c82b840611db82ead3f1a54
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:51:28 +00:00
Marco Bubke
4280a68d9f ClangPchManager: Watch unchanged PCHs
Change-Id: I7f4c0f12e4fbf3714e5bfe7655cfa13cac85f71f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:50:52 +00:00
Marco Bubke
56d611e0a3 ClangPchManager: Update PCHs if time stamps of dependencies changed
If there is a newer file than the last indexing or if a file is added or
removed from the project or system PCH we have to reindex the project and
maybe the system PCH.

Change-Id: Ibce2a244190a79b5c422c469c065ddc11e44b2cb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:50:39 +00:00
Marco Bubke
f1be7793c4 ClangPchManager: Expose more internals from BuildDependenciesProvider
We will need it later.

Change-Id: Ic2c85780bf965be8e4c8603fed365d806576fdc6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:50:26 +00:00
Marco Bubke
d086bbdc9a ClangPchManager: Fix transactions in precompiled header storage
Change-Id: Ia0333ef7110c97a42d73c70c33157849323fb34d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:50:15 +00:00
Marco Bubke
578b70e998 Clang: Add fetchTimeStamps to PrecompiledHeaderStorage
Change-Id: I75552a971fbc39a81e14e3b9ec0c5125d3858025
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:50:02 +00:00
Marco Bubke
0fe6811acd ClangPchManager: Use TimeStamp instead of long long
Change-Id: If8a429238d31492506c68bb523ceeb4bacad157e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:49:48 +00:00
Marco Bubke
1e703a6901 ClangRefactoring: Remove file status collection
It is not needed anymore. If we need it again we can reintroduce it.

Change-Id: If8897ddb404daaf52b249ddd3763deb685c35fe5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:49:31 +00:00
Marco Bubke
cc78969bdb Clang: Improve updating of PCHs
Instead of deleting the path and time stamp of the project PCH we always
set the time stamp but delete only the path if PCH creation failed. A
failed PCH will be no rebuilt if the files changed. We have to add that
feature later.

Change-Id: I1094271f9ead5d906e94b68ac91c0becd2371ca9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:49:16 +00:00
Marco Bubke
cdda564946 Clang: Set indexing time stamp by dependent sources
Instead of using the time stamp from clang we simply set one time stamp
for all dependent sources.

Change-Id: I0adbe59d46c88ddd1ac491a7f7db568bcf2ac540
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:48:54 +00:00
Marco Bubke
2fd72ed9d9 Clang: Remove reset from ModifiedTimeChecker
Change-Id: I8eb7258e929ad851310b3dfae818152eed88960e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:48:12 +00:00
Marco Bubke
4e5e4899d5 Clang: Improve modified timer checker
Make the algorithm a little bit more clear.

Change-Id: I71b04cdd947272edf9fade8f93b7300a945a2fc8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:47:49 +00:00
Marco Bubke
eadd37572a Clang: Move transactions to storage
We call the function anyway only isolated from other queries, so we can
move the transaction guards to the project storage.

Change-Id: I7cca26b25c2258856c68821671085c0a68044693
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:47:29 +00:00
hjk
a11320bbe9 More on QTime::start() deprecation
Change-Id: Icb53308b5eb95dfc2ae39e221677471ff260a2c1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-19 10:53:00 +00:00
Cristian Adam
12e61a9e1b CMake Build: Fix build
Change-Id: Ie066f6b4fe0f0dda5d5fdd6a734c4b8408164dd1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-07-31 13:19:36 +00:00
The Qt Project
9ebe05fd4e Merge "Merge remote-tracking branch 'origin/4.10'" 2019-07-26 09:34:33 +00:00
hjk
7ab6783e24 Standardize on int for line and column values
Recently tons of warnings show up for presumably "problematic"
singned <-> unsigned and size conversions.

The Qt side uses 'int', and that's the biggest 'integration surface'
for us, so instead of establishing some internal boundary between
signed and unsigned areas, push that boundary out of creator core code,
and use 'int' everywhere.

Because it reduces friction further, also do it in libcplusplus.

Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-26 09:23:48 +00:00
Eike Ziller
3ab3e68a7b Merge remote-tracking branch 'origin/4.10'
Change-Id: I427280fdb207b878000697dfd37595ffdb26f4e7
2019-07-26 10:30:03 +02:00
Cristian Adam
8ae9cfe39d CMake build: Add "Devel" package
The "Devel" package will contain headers, libraries, documentation
needed by the 3rd parties to build Qt Creator plugins.

Fixes: QTCREATORBUG-22514
Change-Id: If54929f823982b921b98a63ff6085d53618a3a49
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-25 14:06:46 +00:00
Christian Stenger
39aa325245 Fix compile after FileName drop
Amends 44acfc0702.

Change-Id: I1bddb0642e181b0a02d4ecba7ff1ae282218338f
Reviewed-by: hjk <hjk@qt.io>
2019-07-24 09:47:26 +00:00
Christian Stenger
e8e17f6c52 Unittest: Fix compile
Change-Id: I2ee07a67f042ac952d0301a0880f0674d21de714
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-24 09:42:32 +00:00
Eike Ziller
f689f86be5 Merge remote-tracking branch 'origin/4.10'
Change-Id: I1193e94353c14492a9e7f093fbcd3fa53f83e390
2019-07-18 07:30:29 +02:00
Marco Bubke
ec3c7946af UnitTests: Fix compile without Clang
I moved the clang depend code under the condition that it is only compiled
if LLVM is present.

Change-Id: If1e37f677464ff38833c81dbebdfe8eaa563cdde
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-16 08:19:06 +00:00
Tim Jenssen
333b33edbe Merge remote-tracking branch 'origin/4.10'
Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
2019-07-12 15:53:56 +02:00
Christian Kandeler
f7520b7d99 Make the project managers tell the code model about include paths
... from the environment.

Fixes: QTCREATORBUG-17985
Change-Id: I9b54e550121cfcc0684a6e173337d59d235c6107
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-12 09:13:42 +00:00
Marco Bubke
1841cb1fa5 ClangPchManager: Fix path for excluded include files
Still used the old approach but now it is using the new one.

Change-Id: I4bf4da3a5d41d46afff261f3d77bd9190737038a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 09:03:01 +00:00
Marco Bubke
56277de27f ClangPchManager: Protect fetchPchSources
It was not protected by a transaction so it was not thread save.

Change-Id: Ib4529d0e94942d3cbafb46705a0256812908c8c6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 09:02:43 +00:00
Marco Bubke
2eb4050acb ClangRefactoring: Make the indexer more robust
We check now if the database is busy. This should not be happen but better
be careful.

Change-Id: I8b667ff183368977991974ea1fe7fcde837e968a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-07-11 08:59:16 +00:00
Nikolai Kosjar
2aa067f28e Clang: Fix adding snippets after opening brace
The regression was introduced by

    commit 82d6d20acb
    Clang: Do not show completions after comma in initializer list

This fixes ClangCodeCompletionTest::testCompleteGlobals().

Change-Id: Ic126f1e3eaed158196268e3682ff32bc02deb7b9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-10 07:56:48 +00:00
Christian Stenger
0d9e8d3e9d Unittest: Fix compile due to ambiguity for older gcc
Change-Id: I4eb2ce1cd0892a50702eacb1b0d6bdf844718c20
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-10 07:50:52 +00:00
Orgad Shaneh
6e6dc32ad0 CMake: Fix build
This amends commit 376aae2711

Change-Id: I63e94c7e720f4f18fcf0f47b6e7af7e471c84df5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-07-08 18:28:58 +00:00