Commit Graph

14 Commits

Author SHA1 Message Date
Marco Bubke
56b01f7463 Clang: Minimize reindexing
We optimal indexer is only reindexing if the index would be changed. This
patch is a step in that direction. We only reindex now if the file or
project has changed. It fixes some typos too.

Task-number: QTCREATORBUG-21150
Change-Id: I6ea1c13282fbcd70253b9b2939aed37580dbd160
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2019-04-02 13:08:44 +00:00
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
Nikolai Kosjar
aa290912b8 Clang: Remove project tracking on clangbackend side
...as it is not needed. Just provide the compilation arguments as part
of the Document.

As a side effect, re-initializing the backend after a crash is cheaper
and will not freeze the UI anymore (referenced bug).

Task-number: QTCREATORBUG-21097
Change-Id: I866e25ef1fd5e4d318df16612a7564469e6baa11
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-09-26 10:45:41 +00:00
hjk
cf4dbb4bb6 ClangSupport: Use simpler structures in some cases
The patch is mostly mechanical, but contains also a few spurious changes
from values references for some local variables, foreach -> ranged for
etc that I coulnd't resist.

Change-Id: I58f0bd972546895eb318607cbfbd7ac35caf3f23
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-04-06 12:55:23 +00:00
Ivan Donchevskii
d01b474b46 Clang: Refactor TokenInfos
Remove code duplication.

Change-Id: Ib1859f2c3a04f66d0f0b669b4e93a7fc06ab8e61
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2018-02-12 08:03:47 +00:00
Ivan Donchevskii
affc652b7b Clang: Rename HighlightingMark to TokenInfo
Before adding additional members into that class it
makes sense to rename it to better represent its content.

Other classes serving the same purpose are also renamed
to keep the names consistent.

Change-Id: I3c8517e42aae29779d71ec9c85b713cff581a473
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-12-11 15:00:24 +00:00
Nikolai Kosjar
cf0e3f2db3 Clang: Fix updating supportive translation unit
...with new project arguments.

Reproduce with:
 1. Open a file with some #ifdef
 2. Edit the file, e.g. type space.
 3. Change the build configuration so that the highlighting flips in the
    editor.
 4. Edit the file again, the configuration flips again [repeat].

Change-Id: Ib97c18fc46538d74c63972e682a348ae2736a4e6
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-05-05 12:10:56 +00:00
Nikolai Kosjar
b9c76d5218 Clang: Rename reparseNeeded to isDirty
...because the flag can be set for needed parses, too.

Change-Id: I8b328afefb282cb6bd1cf88711af3d08a56808db
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-05-05 08:18:08 +00:00
Nikolai Kosjar
e811ac4bfe Clang: Use class enum in Document
Change-Id: I754eaf185d10b61db5bd5f622d1912c53f71e79b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-05-05 08:17:58 +00:00
Marco Bubke
ada5ea1952 UnitTests: Fix names and disable slow tests by default
Slow and very slow tests have now their own test category. We add SlowTest
for tests which are slower than ~5ms and VerySlowTest if they are slower
than ~100ms. They are disabled them by "-*SlowTest.*". If you have a faster
machine than most developers simply try lower values. The aim is that most
developers can execute the tests in under ~2s.

In the long run we should use dependency breaking and data sharing to
reduce the count of the slow tests.

Change-Id: I8578071258d7f89b2052709f3dd526ced811483f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-01-04 12:35:52 +00:00
Nikolai Kosjar
8d443b40b7 Clang: Extract long clock/time_point references
Change-Id: If2790263e9a314f27762c57cf6bf4ef67f93a84b
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-10 12:36:24 +00:00
Nikolai Kosjar
1a426d9f01 Clang: Support second translation unit
A TranslationUnit is owned by TranslationUnits now. TranslationUnits
allows to add another TranslationUnit and to update/query the recently
and previously parsed translation unit.

This does not change any behavior yet.

Change-Id: I8a2f0cc05d3e51bf739dd5d7c4da14b54147f3ab
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-10 12:35:48 +00:00
Nikolai Kosjar
ae92b68154 Clang: Remove some needless bools
Change-Id: Ia845c803fce85ad0e29e2cf6b64820b86599bac6
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-05 07:25:45 +00:00
Marco Bubke
47c01daeb2 UnitTest: Cleanup
Improve naming and introduce googletest.h.

Change-Id: I445c13db4c23d6dd5682ce0db3b83055cc6b8a89
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-19 15:17:54 +00:00