diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2016-11-21 13:30:26 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2016-11-22 12:21:14 +0000 |
commit | 2b9e9ebbfc4945300141655ad757bba28dcb0d9a (patch) | |
tree | fc31be36ddf3e3764edb1561870af94b16060815 /src/plugins/clangcodemodel/clangcodemodel.qbs | |
parent | b4d6884c25c6be7999e5ad90467f020774b9c195 (diff) | |
download | qt-creator-2b9e9ebbfc4945300141655ad757bba28dcb0d9a.tar.gz |
Clang: Work around libclang not accepting not existing unsaved files
Feeding libclang with unsaved files (e.g. in-memory generated ui_*.h)
that do not exist on disk leads to regeneration of the preamble on every
parse/reparse/completion and thus renders the clang code model useless.
We could check the existence in the file system for every unsaved file
just before every parse/reparse/completion. Obviously this does not
scale (e.g. qtcreator.pro generates about 200 unsaves files) and would
also slow down the responsiveness of the completion, especially for the
dot-to-arrow correction case.
We could also set up a file system watcher. However, implementing the
"file got created" case is not trivial because QFileSystemWatcher does
not support it out of the box.
Instead, set up a custom include directory and create empty files in it
that represent the unsaved files and pass that include directory to
libclang as the last one. While this fixes the performance problems, it
also comes with at least two problems:
* Because ui_*.h files are "relocated" to the same directory, two or
more "foo.ui" in the same session will be problematic.
* Because of the custom include directory, problems might arise for
projects that include the ui_*.h as "some/relative/path/ui_foo.h"
instead of "ui_foo.h". This should be the less common case.
Task-number: QTCREATORBUG-17245
Change-Id: I6e40e87c3ef095086eb22c972dd8c1a6459a8245
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/clangcodemodel/clangcodemodel.qbs')
-rw-r--r-- | src/plugins/clangcodemodel/clangcodemodel.qbs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/clangcodemodel/clangcodemodel.qbs b/src/plugins/clangcodemodel/clangcodemodel.qbs index ed36629504..b2374c2f7a 100644 --- a/src/plugins/clangcodemodel/clangcodemodel.qbs +++ b/src/plugins/clangcodemodel/clangcodemodel.qbs @@ -87,6 +87,8 @@ QtcPlugin { "clangprojectsettingswidget.ui", "clangtextmark.cpp", "clangtextmark.h", + "clanguiheaderondiskmanager.cpp", + "clanguiheaderondiskmanager.h", "clangutils.cpp", "clangutils.h", ] |