Commit Graph

18 Commits

Author SHA1 Message Date
Marco Bubke
d9b7092a87 Clang: Use no mutex in copyable file path cache
We use it in worker threads and there should be no access from different
threads.

Change-Id: I62874761221c45f88ce4d7cfda4fbda4bc446cac
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-08-27 11:51:39 +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
bbd58ca30b Clang: Watch directories instead of files
Because there a limited resources to watch files we watch now directories.
So we need much less resources.

Change-Id: Iac558832e9521a7a1a67c5ea99b42ad1b0b5129c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-27 12:31:52 +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
Eike Ziller
3bbe535b95 Merge remote-tracking branch 'origin/4.7'
Change-Id: I3c5d7e9e8c589ad4425cd89d61e1f572f5cb7997
2018-06-19 10:03:28 +02:00
Orgad Shaneh
e26e13212a ClangSupport: Refix GCC warning
Was fixed in 351f355b69, refined in
956e6f3a97 and re-introduced in
9c4bfbe20a.

Change-Id: I38621524ea650625c5636471463d394d0f6f0fa1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-06-15 14:52:24 +00:00
Tobias Hunger
3f83cf2447 ClangSupport: Fix typo in variable name
Change-Id: Ic8574b95d4ac477e6bede896eaac0cbc46e6fdd8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-05-29 08:14:19 +00:00
Marco Bubke
ff1ce3a475 Clang: Honor directories for the file name
The file name id must be unique for very entry, so the directory id must be
incorporated too. Now there is always one unique integer id for every
file path. The directory id is there to access and compare the directory
much faster but not provide any data to the uniqueness of the id.

Change-Id: I0f9a2ca70bc9dda0ce32ebc45eb7b082821eb909
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-28 14:01:12 +00:00
Marco Bubke
9c4bfbe20a Clang: Improve interfaces
The interfaces should never used to handle ownership. So it is now using
protected destructors. Copy operations are forbidden too.

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-nonvirtual

Change-Id: Ib0b60a73a7ec130973b5cb0095cc5b2f10fa0758
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-03-26 13:39:36 +00:00
Marco Bubke
fb0b5d9d9b Clang: Make it more clear that the FilePathId.filePathId is not shared
The name fileNameId could imply that the id shared for the same file name
which is not the case.

Change-Id: I27310a8994c2d9e9bb0f0aed2094bd988309c710
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-22 13:22:30 +00:00
Orgad Shaneh
956e6f3a97 Clang: Fix MSVC build
Link error:
clangpchmanagerbackendmain.obj : error LNK2019: unresolved external symbol
    "__declspec(dllimport) public: __cdecl ClangBackEnd::ClangPathWatcher<class QFileSystemWatcher,class QTimer>::ClangPathWatcher<class QFileSystemWatcher,class QTimer>(
        class ClangBackEnd::FilePathCachingInterface &,class ClangBackEnd::ClangPathWatcherNotifier *)"
    (__imp_??0?$ClangPathWatcher@VQFileSystemWatcher@@VQTimer@@@ClangBackEnd@@QEAA@AEAVFilePathCachingInterface@1@PEAVClangPathWatcherNotifier@1@@Z) referenced in function main

Looks like MSVC looks for import even for inline template functions.

Another alternative is to revert 351f355b69
and either ignore or suppress the GCC warning.

Change-Id: I040d4e3924af7f4d1f4424276329c6095e6ff6bd
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-01-18 08:07:49 +00:00
Orgad Shaneh
351f355b69 ClangSupport: Add 2 missing exports
Fixes the following GCC warnings:

In file included from .../clangpchmanagerbackend/clangpchmanagerbackendmain.cpp:26:0:
.../clangsupport/clangpathwatcher.h: In instantiation of ‘class ClangBackEnd::ClangPathWatcher<QFileSystemWatcher, QTimer>’:
.../clangpchmanagerbackend/clangpchmanagerbackendmain.cpp:114:78:   required from here
.../clangsupport/clangpathwatcher.h:80:7: warning: ‘ClangBackEnd::ClangPathWatcher<QFileSystemWatcher, QTimer>’
    declared with greater visibility than the type of its field ‘ClangBackEnd::ClangPathWatcher<QFileSystemWatcher, QTimer>::m_idCache’ [-Wattributes]
 class ClangPathWatcher : public ClangPathWatcherInterface
       ^~~~~~~~~~~~~~~~

Change-Id: I8c6bc30e80da50b631d272ff7c2120cf706548aa
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-01-17 07:21:17 +00:00
Marco Bubke
76807c134a Clang: Merge FilePathView and NativeFilePathView
Change-Id: Ib07b16bf60c56027814cc5f0d7be1cacd15e96bb
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-12-05 17:08:56 +00:00
Marco Bubke
a15250051d Clang: Handle native file in the file cache
Different types are introduced for normalized and native file path. So the
compiler is warning you if you try the wrong format.

Change-Id: I1da0686b142cbf9bb7578468c2b50f90a94cebf9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-11-23 11:55:15 +00:00
Marco Bubke
5e0b207a89 Clang: Improve locking of string cache
The string cache is only very seldom written but very often read. To
improve thread scaling it is faster to lock it only for write operations.
So we use a shared mutex which is locked in shared mode for read
operations and locked exclusively for write operations.

Change-Id: I7dfd4a02c5484683e4d0becd39269c0146126a96
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-18 13:13:29 +00:00
Christian Stenger
9bd0fcbe2e Revert "Clang: Improve locking of string cache"
This reverts commit be939a80db.
'shared_timed_mutex' is not available before Xcode 9.

Change-Id: I1ac6c2b3691d5b4f457c431e255629a526c48c3a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-10 09:12:21 +00:00
Marco Bubke
be939a80db Clang: Improve locking of string cache
The string cache is only very seldom written but very often read. To
improve thread scaling it is faster to lock it only for write operations.
So we use a shared mutex which is locked in shared mode for read
operations and locked exclusively for write operations.

Change-Id: I2cc742d1b9cc15c162be40ab339fa8310640bc44
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-05 17:48:23 +00:00
Marco Bubke
d2e15e5f1e Clang: Add file cache
The database is using file path integer ids to handle file paths because
otherwise we would save many redundant data. This patch is improving it
further with the introduction of a database based file path cache. The
entries are now divided in a directory path and file name. This is quite
handy for directory based file watching.

Change-Id: I03f2e388e43f3d521d6bf8e39dfb95eb2309dc73
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-05 17:36:37 +00:00