Commit Graph

3 Commits

Author SHA1 Message Date
Nikolai Kosjar
d52ac9a708 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>
2018-10-31 10:38:27 +00:00
Ivan Donchevskii
78211741c8 Clang: Make SourceLocation lazily calculate its fields
Trigger path, line, column and offset evaluation only if one
of them is accessed.

Change-Id: Ib2f8b06ece94a3b7424db28523b5796628865202
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2018-10-17 05:56:39 +00:00
Ivan Donchevskii
65ea6f8e83 Clang: Introduce Token class to work with CXToken pointers
Make tokenization and tokens annotation simpler.

Task-number: QTCREATORBUG-21143
Task-number: QTCREATORBUG-21144
Change-Id: I580091b7b63dd973228fd2e21cf2e74c7d0e7df2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-09-26 11:46:18 +00:00