aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/clangcodemodel/clangcodemodel.pro
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2016-11-21 13:30:26 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2016-11-22 12:21:14 +0000
commit2b9e9ebbfc4945300141655ad757bba28dcb0d9a (patch)
treefc31be36ddf3e3764edb1561870af94b16060815 /src/plugins/clangcodemodel/clangcodemodel.pro
parentb4d6884c25c6be7999e5ad90467f020774b9c195 (diff)
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.pro')
-rw-r--r--src/plugins/clangcodemodel/clangcodemodel.pro2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/plugins/clangcodemodel/clangcodemodel.pro b/src/plugins/clangcodemodel/clangcodemodel.pro
index 0d9b5ee96b..d6d2cde4bf 100644
--- a/src/plugins/clangcodemodel/clangcodemodel.pro
+++ b/src/plugins/clangcodemodel/clangcodemodel.pro
@@ -33,6 +33,7 @@ SOURCES += \
clangprojectsettings.cpp \
clangprojectsettingswidget.cpp \
clangtextmark.cpp \
+ clanguiheaderondiskmanager.cpp \
clangutils.cpp
HEADERS += \
@@ -64,6 +65,7 @@ HEADERS += \
clangprojectsettings.h \
clangprojectsettingswidget.h \
clangtextmark.h \
+ clanguiheaderondiskmanager.h \
clangutils.h
FORMS += clangprojectsettingswidget.ui