diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-10-19 10:20:27 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-10-31 10:38:27 +0000 |
commit | d52ac9a7084df220a5349468703c11cc1c0794c4 (patch) | |
tree | edf93dd6c68e9e3614e728a1e1a08456381c76db /src/plugins/clangcodemodel/clangeditordocumentprocessor.h | |
parent | 91ed30ffac8f218f13a6d01d77f7e6398749cb67 (diff) |
Clang: Fix unresolved #includes for ui_*.h headers
...with an extra parse.
Previously, the creation of an e.g. "Qt Widgets Application" from the
wizard could show code model errors in mainwindow.cpp. Depending on
timing issues, the first error is either
1. 'ui_mainwindow.h' file not found (QTCREATORBUG-15187)
The parse happened before the in-memory ui_mainwindow.h was
generated by uic. The file system watcher can't help here as the
#include was not resolved successfully. And libclang's reparse does
not handle this case (it would need to remember all failed #include
stats...).
==> Detect this case with the help of the include paths and trigger
a full parse.
2. or: allocation of incomplete type... (QTCREATORBUG-15187)
The parse happened after the generation of the in-memory
ui_mainwindow.h, but before the clangbackend received the unsaved
file.
==> Fix this by also writing the content of the unsaved file to our
behind-the-scenes-created ui_mainwindow.h.
Fixes: QTCREATORBUG-15187
Fixes: QTCREATORBUG-17002
Change-Id: I4f3a81adaa3d604746977a402c29f83fbc5b0e44
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/plugins/clangcodemodel/clangeditordocumentprocessor.h')
-rw-r--r-- | src/plugins/clangcodemodel/clangeditordocumentprocessor.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h index 9229a60132..78d777ddfa 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.h +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.h @@ -124,7 +124,8 @@ private: const ClangBackEnd::DiagnosticContainer &firstHeaderErrorDiagnostic); ClangBackEnd::FileContainer simpleFileContainer(const QByteArray &codecName = QByteArray()) const; ClangBackEnd::FileContainer fileContainerWithOptionsAndDocumentContent( - const QStringList &compilationArguments) const; + const QStringList &compilationArguments, + const ProjectExplorer::HeaderPaths headerPaths) const; ClangBackEnd::FileContainer fileContainerWithDocumentContent() const; private: |