summaryrefslogtreecommitdiff
path: root/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* ClangRefactoring: Ensure that database is written to log after indexingMarco Bubke2019-06-173-3/+40
| | | | | Change-Id: Ic2473d9fe8dc9b41a7da728c9e1b5202524c1a79 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Clang: Filter macro QT_TESTCASE_BUILDDIR outMarco Bubke2019-06-051-0/+8
| | | | | | | | | We have to universalize it later with a UI so that user can set their own macros. Change-Id: I5385c3c1b01dbf77a1cbc2431103fcdea3f96118 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* CMake build: Skip installation of test plugins / executablesCristian Adam2019-06-051-0/+1
| | | | | | | Our tests run from the build folder. We do not need to install them. Change-Id: Iaeb27e466fe0d43bc15fa3eee3bf6d2659b87083 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* CompilationDBProjectManager: Handle relative sysrootChristian Kandeler2019-06-041-2/+4
| | | | | | Fixes: QTCREATORBUG-22388 Change-Id: I030b105897bd483c17aaf86229d4515b2dd747d3 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CMake build: Add unittest CMake build filesCristian Adam2019-05-293-0/+422
| | | | | | | | | On MinGW 8.1 I get the following after running ctest -j 40 99% tests passed, 35 tests failed out of 2631 Change-Id: I2c3ce7940b036e52ef393feab5837886355e7b5a Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Fix projectupdater-test.cpp after FileName changeshjk2019-05-281-1/+1
| | | | | | Change-Id: I43974405522facd46a757ba4cf2886128310597c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Rename FileName to FilePathhjk2019-05-283-4/+4
| | | | | | | | More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* C++: Do not auto-insert '}' after control flow constructsNikolai Kosjar2019-05-281-0/+35
| | | | | | | | | | | | ...as this rather gets in the way. As before, pressing ENTER after { will still auto insert } on the next line. Fixes: QTCREATORBUG-18872 Change-Id: I8ee082962b5ee82781e51c3e5ee146343f808332 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
* CompilationDbProjectManager: Sanitize project parsingChristian Kandeler2019-05-231-1/+2
| | | | | | | | | | The parsing code used to access all kinds of stuff (e.g. the project tree and the toolchain manager) from the non-UI thread, which is not allowed. Fixes: QTCREATORBUG-22420 Change-Id: I4be47919d7e543376d31826dd380f66f4e060458 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* UnitTest: Fix ProjectInfoGenerator.* testsNikolai Kosjar2019-05-212-0/+13
| | | | | | | | This amends e3def98c001a90e8046e6f20dd332927481abdec. Change-Id: I21deb74fe4a4387f7490c806e0990bafd06438bf Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Fix unit tests compilation + initialization orderOrgad Shaneh2019-05-032-7/+11
| | | | | | | Amends commit cc9d246b028c518d1fc01fc8318f0945949040d3. Change-Id: I688df432cd03f440ec6c15ca5402d94430ce74f8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CompilationDatabase: Fix unit-testIvan Donchevskii2019-04-301-78/+80
| | | | | Change-Id: I2a2e2b5ead35236f11e6f9f0ec15608b30335fd1 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* ClangRefactoring: Fix indexingMarco Bubke2019-04-291-0/+64
| | | | | | | | We moved inside of loop so projectPart was used many times but was empty after the first iteration. Change-Id: Ie2441dbdd3bb9de73ae1fd076626255599f5dfea Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix system pre include search pathMarco Bubke2019-04-2922-159/+258
| | | | | | | | We now get the resource path from creator. The -fPIC case is working now too. Change-Id: Id191e89e6d46706748d50440038a06a349972cc9 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangPchManager: Remove target tripleMarco Bubke2019-04-291-2/+0
| | | | | | | We don't need it so far and it is creating trouble. Change-Id: Ia502452717b5be935e4ba2cd2de04007e4144199 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangPchManager: Don't generate PCHs if there is no includeMarco Bubke2019-04-292-0/+41
| | | | | Change-Id: I88caab6ff188b64d92a74d61276c4724c33cae23 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Reindex without PCHs if error are occurringMarco Bubke2019-04-237-39/+828
| | | | | | | | | If an occurs we first reindex with the system PCH only and if it is still occurring we are indexing without any PCH. Task-number: QTCREATORBUG-22011 Change-Id: I815ee3abe7829aaeb191d985cd045bac35015893 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangRefactoring: Move transaction in fetchPrecompiledHeaderMarco Bubke2019-04-232-8/+21
| | | | | | | | Prepare the move of fetchPrecompiledHeader in the lambda to execute it in the thread. Change-Id: I00f906196dabfdb5cd38f4b9752d92678236b849 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Refactor fetchPrecompiledHeaderMarco Bubke2019-04-233-11/+17
| | | | | | | We don't need the other information any more. Change-Id: Ie34a646df34e336591c124093a15e90307ac88ec Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools: Add pre system include search path per projectMarco Bubke2019-04-237-106/+125
| | | | | | | | | Sometimes you want add a pre system include search path per project to overload some system header for indexing. This can then even be checked in the repository. Change-Id: Ib103e5935d0553aa94522ed736f8c4eb2405a093 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Add global preincludes search pathMarco Bubke2019-04-235-14/+69
| | | | | | | | | | Some header like windows.h adds dangerous defines which are not used but break the indexing like "small". We now preinclude them and undefine the dangerous the defines. This can be used for speed up the indexing as we could provide stripped headers. Change-Id: I2a89a4719ada7591e0e7a1ecc411b2e0ffd40d9a Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangPchManager: Fix alive messageMarco Bubke2019-04-231-0/+15
| | | | | | | | Computing the dependencies can take quite some time. So it is better to ensure that the alive timer is fired. Change-Id: I0b372ef73a8a5e6716673ba9457d424151a762bb Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Unit-test: Fix buildIvan Donchevskii2019-04-182-4/+6
| | | | | Change-Id: Id89bbd391117d998bb6e8d4607786ac48580a7f4 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Fix build with clang-8Ivan Donchevskii2019-04-174-21/+10
| | | | | | | | | | Clang-Tidy checks and Clazy flags updated. CLANG-UPGRADE-CHECK done. Change-Id: I1ca585c5c3c77a7f183719df9c262603150914e8 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* UnitTest: Fix compilationOrgad Shaneh2019-04-171-0/+6
| | | | | | | This amends commit a5ee354b193f7e7bcf91907ccc156ef080d82456. Change-Id: I29938d30187fde1ac05d824276cb4b02b561645a Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* UnitTests: More QString fixesMarco Bubke2019-04-082-61/+66
| | | | | Change-Id: Id1c60dfa8b3ada2c855f43437a153042cfec9f63 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Merge remote-tracking branch 'origin/4.9'Orgad Shaneh2019-04-071-0/+154
|\ | | | | | | Change-Id: I7d1912cd5c4d824fd40d3454c5f1bb796f2c21d8
| * ClangFormat: Add more unit-tests for if conditionsIvan Donchevskii2019-04-031-0/+33
| | | | | | | | | | Change-Id: I4ed68fc6260bfb4b058d5714d64dfec638ae1953 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
| * ClangFormat: Fix indentation when empty lines are involvedIvan Donchevskii2019-04-021-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify continuation and new statement to get less false indentations. Handle one-statement if/else as a special case. Properly handle empty lines after - includes - preprocessor directives - beginning of the file - if/else Fixes: QTCREATORBUG-22238 Change-Id: Ic334eeca7de47d9fcb74963d2e31711838d04bde Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | UnitTests: Allow cast from char* to QStringMarco Bubke2019-04-041-2/+0
| | | | | | | | | | | | | | | | Otherwise it is not working for older compilers and Qt versions. We can revert it if we drop support for that old versions. Change-Id: I0f71e05235e9ff24cee28131654c9b6df9997643 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | Clang: Minimize reindexingMarco Bubke2019-04-0217-40/+488
| | | | | | | | | | | | | | | | | | | | 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>
* | ClangPchManager: Handle non generated PCHsMarco Bubke2019-04-025-5/+141
|/ | | | | | | | | | | | Sometimes we start generation of PCHs but not finish it. In that case we should redo it at the next start of the backend process. So we now remove the old precompiled header if we add the task to the queue. If we successfully generated the PCH it will be set again. But if we did not it will be read from the database and set to false. Task-number: QTCREATORBUG-22035 Change-Id: Id53c2b4e4f501fc5ef7830558085607baa6a49f1 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Improve project part updatingMarco Bubke2019-04-0145-1112/+1526
| | | | | | | | | | | | The project part ids are now already created very early in the database. This removes some checks because we can assume that an id already exists. The project part are now completely persistent, so we can read them from the database and compare them with new generated from a new creator session. This should help to not recreate the same PCH again and again. Task-number: QTCREATORBUG-21151 Change-Id: Iced818ff9f7431eaed3e37978087cc0a43b9afda Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix access specifier for variablesIvan Donchevskii2019-03-122-0/+27
| | | | | | | | | | Static members have a variable declaration kind so we need to check their access specifiers in order to provide proper information about tokens. Fixes: QTCREATORBUG-22082 Change-Id: If455174bd346398a2df3499fa6cf1ea2b4e26965 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Reduce dummy text to minimum sizeIvan Donchevskii2019-03-121-0/+13
| | | | | | | | ... and tweak continuation dummy text to fix the indentation for the line with existing text inside parenthesis. Change-Id: Iaebd2f58823fcbeed24bb7e47769af53261c18ca Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Tweak dummy text for consecutive empty linesIvan Donchevskii2019-03-121-2/+52
| | | | | | | | | | | If empty lines follow each other it makes sense to use the empty comment as dummy text for all but the last one of them. This prevents increasing indentation lengths after if (foo) when there are multiple new empty lines inserted. Change-Id: I4c948161b674b3af0a131bfb85e7a45a80ed3fb0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Indent closing brace on the new lineIvan Donchevskii2019-03-121-0/+24
| | | | | | | | | | | | Sometimes the curly brace also requires indentation. These are the cases when it comes directly after the comma, for example inside the initializer list. Lets handle such cases in the similar way we do it for the closing parenthesis. Change-Id: Ia0d25fa08f7224567dd41dd17f9757d9d8b27362 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Simplify the dummy text for empty line heuristicsIvan Donchevskii2019-03-111-0/+13
| | | | | | | | | | | | | | | | The text to fill the empty line mostly depends not on the fact of being inside parenthesis or not but rather on the last preceding meaningful character. Let's check for this character and sometimes for the following one to better understand the current context and pick the proper dummy text. With this behavior improvement we can better indent empty lines inside initializer lists with empty lines inside. Change-Id: Id2f27454ef56dfdf8c15b5efb14c4d09242908a9 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Improve dummy text guessing for empty linesIvan Donchevskii2019-03-071-0/+13
| | | | | | | | Improve detection of the cases when the empty line is inside the parenthesis to get more proper indentation. Change-Id: I4aa37c29b17bedcd0e4a781d12c7066e818a07f3 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Add whitespace unit-tests and fix bugsIvan Donchevskii2019-03-061-0/+30
| | | | | | | | Check that extra whitespace does not prevent the indentation and that indentation is the same for the consecutive empty lines. Change-Id: I04aa12c4cd31aaf07daf9320c98d2eea7afcc9a8 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Enable includes sortingIvan Donchevskii2019-03-061-0/+17
| | | | | | | | | Sort includes only in modes when all replacements are used (manual indentation with "Format instead of indent" selected and saving with "Format on save" activated). Change-Id: I73dfa1d3211760269fe7d33a141f4d831ff65c15 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Rename ProjectParts in ProjectPartsManagerMarco Bubke2019-03-063-19/+24
| | | | | Change-Id: Ia60d78e34a296b0b379339ebc14efd0e81dc8989 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Disable warnings in CommandLineBuilderMarco Bubke2019-03-063-0/+27
| | | | | Change-Id: I7597d57a0bb97facefb08c9c1bbe6e909c146080 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Don't filter source with missing includesMarco Bubke2019-03-068-24/+96
| | | | | | | | We do now tag and save them. So we can reliably track them. Task-number: QTCREATORBUG-22035 Change-Id: I49aaeeb76150b7e2d77b863eeb0aedefc9ab50f4 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Improve dependency buildingMarco Bubke2019-03-0619-289/+358
| | | | | | | | | We want to use the cached values in the database because it is faster than to parse the the files again. Task-number: QTCREATORBUG-22035 Change-Id: I7ada7073887b1d89a06332fdb617701cb69ccd68 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* ClangFormat: Do not remove empty lines while only indentingIvan Donchevskii2019-03-061-0/+17
| | | | | | | | | Insert dummy text into empty lines also for the electic characters not to remove empty lines when only indentation is intended. Fixes: QTCREATORBUG-22050 Change-Id: Ife5374459feb510a0587880a6772c90a2d68d70e Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ClangFormat: Do not apply "smart" formatting before new linesIvan Donchevskii2019-03-051-23/+18
| | | | | | | | | | | In the concept that behavior seemed fine but in practive it looks quite strange. Add comma to the dummy text inserted into the empty line to have a proper indentation for the following empty lines. Change-Id: I770af02a475e6489bdc8f44d9f84eb3c5e7398d7 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* UnitTest: Add missing enumOrgad Shaneh2019-03-051-0/+1
| | | | | | | Amends commit f009dad9ef2f286248d7da8678134f587bda22d0. Change-Id: I5288297525edc153c1aea81d2cabb1f230a8fcce Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Add ICore::cacheResourcePath()Marco Bubke2019-03-041-0/+6
| | | | | | | | | | We need some directory where we save the index database and the precompiled headers. This files should be persistent but the user can delete them if he wants because we will rebuild them. Task-number: QTCREATORBUG-22012 Change-Id: I9f25eb48a9992d6385a96427ef9c10bc739a3567 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Clang: Move fetchPrecompiledHeader to PrecompiledHeaderStorageMarco Bubke2019-03-045-41/+46
| | | | | | | It went for historical reasons in the symbol storage. Change-Id: If05edb868901884f3951d0eb2f152566e99b4d1a Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>