Commit Graph

918 Commits

Author SHA1 Message Date
Marco Bubke
cf441e8198 Sqlite: Add primary key table constraint to table builder
Change-Id: I60c158eb76db2217a2d045053bb8e47eef75ff7a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-05 09:57:47 +00:00
Marco Bubke
a61eff0079 Sqlite: Add session support
Session are captured by hooking in the sqlite changes. They are saved in
blobs and containing inserts, update and deletes. Because the are
semantically coupled to translactions we add a

Change-Id: Ie095558ebc50601fcaae32958ebeeb98b72d73b9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-06-05 09:52:42 +00:00
Eike Ziller
c9d357fdac Fix unittest build if Clang refactoring is turned off (now the default)
Change-Id: Ib129d2872a4550e14a888c1d98c4b78012a08982
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-06-03 10:31:17 +00:00
Volodymyr Zibarov
28a999be52 CMake Build: Set /permissive- (standards conformance mode) for MSVC
To make errors appear faster when developing on Windows

MSVC 2017 and later have this flag to disallow MSVC-specific C++
language extensions. Use it to make code more correct and more portable.

Set this option with add_compile_options() in root CMakeLists.txt to
apply it to all targets.

Add one #include to unittest/gtest-clang-printing.cpp as workaround for
forward template declaration bug in MSVC http://tiny.cc/fa4tpz

Change-Id: Ie0b19701ad773c79ffd2fed24fffbb1dcb29538c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-05-29 06:51:45 +00:00
Marco Bubke
a9a205486d Sqlite: Improve SqliteStatement column check
We have done it for every getter. Now we do it only once as we ask for
the values. It simplifies the code and the test and could even improve
performance.

Change-Id: Ia7d4a33a77ec7c0a5fda548424fbf8b192f07511
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:26:07 +00:00
Marco Bubke
9f9140b196 Sqlite: Remove unused code
Binding by names is slower and we never used it.

Change-Id: Ia6b9b78401f8c2711be34b667ac6f08b44418773
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:09:35 +00:00
Marco Bubke
9c44f8d88d Sqlite: Add blob support
Change-Id: Ic2ec5f20c8585241b9e9aaa8465e70b6ab4f004c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:09:27 +00:00
Marco Bubke
22c33fb859 Sqlite: Improve LastChangedRowId
Change-Id: I2fe559d4b40f93561e44eb138119416291dc7d41
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:09:20 +00:00
Marco Bubke
64cbffe959 UnitTests: Fix LastChangedRowId
Change-Id: I538d068168488eee2662618dede598135c45e396
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-27 13:08:55 +00:00
Marco Bubke
75da71e1fa Sqlite: Fix test
Change-Id: I04de9c429b7779c5c4ecde4a4a44e3b5e60699b3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:11:14 +02:00
Marco Bubke
55d1f6b46e Sqlite: Relax LastChangedRowId
Change-Id: Ibc4637ebafd4c0cdedfcea5c52da5025435bc4ab
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:11:02 +02:00
Marco Bubke
36fd58fbe9 Sqlite: Add carray extension from Sqlite and a pointer binding
Change-Id: I96c160514ac80458cbcbff0151c685958de71fdd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:10:40 +02:00
Marco Bubke
2f6a226dd3 Sqlite: Forbid double quotes which are not part of the SQL standard
It's anyway easier to write single quotes.

Change-Id: Ie71c39d9cdd83e0b898efe70a1912d8257ac991e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:09:47 +02:00
Marco Bubke
dc2192ef8a Sqlite: Dont compile Utf-16 support
We don't support it anyway.

Change-Id: I35fa859f3c9d7389e3d00d584832a814acb39c80
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:09:26 +02:00
Christian Kandeler
9c3d4dcc88 qbs build: Make the pkg-config dependency in unittest.qbs non-required
We don't want an error if pkg-config is not installed.

Change-Id: I142abe3d21649a9010b91707532eb733e2103583
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-26 13:10:22 +00:00
Christian Kandeler
c9672f4ffa qbs build: Fix unittest project file
There were some subtle errors that lead to test failures.

Change-Id: Ibea24a8a45a47a5c3239da77bd4ed7ddca61ec57
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-26 13:08:32 +00:00
Christian Kandeler
949bb0e67b ClangCodeModel: Show value in tool tips, if possible
When hovering over a constant expression, it's probably helpful
to show that value to the user.
Requires clang 11 to fully work. For now, it only shows the value for
variable initializations.

Fixes: QTCREATORBUG-23967
Change-Id: I6b844231bac50993c2fa2fa82c552ad9cef590df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-26 08:50:58 +00:00
Nikolai Kosjar
0bf7bacb4f Clang: Disable a clangformat test for vanilla clang
...that requires a custom patch to work.

Change-Id: I954286f47112b660dc6ee681dac2250a9e8da0df
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-22 08:59:28 +00:00
Nikolai Kosjar
8df8502090 Clang: Disable a completion test for LLVM/Clang 10
For the case

  struct Foo;
  void f(Foo *foo) { foo->/*COMPLETE-HERE*/ }

no completions are expected as "Foo" is only forward declared.

This seems to be handled correctly in current LLVM/Clang master
(upcoming version 11), but wasn't with previous versions as pointless
non-member-completions were returned.

As our workaround is not applicable anymore with LLVM/Clang 10, disable
the corresponding test for that version as we cannot do anything about
it.

Change-Id: Ia02696175d0d532e16bc16a1010821b4aed20f8b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-22 08:42:09 +00:00
Nikolai Kosjar
e2a68edbc1 Clang: Adapt test DiagnosticSlowTest.Text for LLVM/Clang 10
Change-Id: I99ac001d1231f14cd5cda9268d925fa442b16a35
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-19 12:28:17 +00:00
Christian Kandeler
b92c22a102 qbs build: Add project files for clang unit tests
Change-Id: I2cd02d94fb886bb49c66fa2508a63dc3480a7c23
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-19 09:26:45 +00:00
Nikolai Kosjar
009e9d783d Clang: Fix leak in TranslationUnitUpdaterSlowTest
Change-Id: I75b349c5af80de01a2fb499b7335692eedcae6eb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-05-19 08:17:39 +00:00
Eike Ziller
3c59d02286 CMake build: Favor qtc_exted_... with CONDITION over custom if
Change-Id: I2c575b69fb6c2535f789313234400f6f6a63a08b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-05-18 11:18:38 +00:00
Eike Ziller
3c535503cb CMake build: Avoid using extend_qtc_target directly
Also add a extend_qtc_test which checks if the test is known.

Change-Id: Idd3b3a02ac61fce2622cb8681233cfbd96a77bc4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-05-18 11:18:26 +00:00
Nikolai Kosjar
09353d927b ClangTools: Fix ReadExportedDiagnostics.* tests
These fail

 [  FAILED  ] ReadExportedDiagnostics.Tidy
 [  FAILED  ] ReadExportedDiagnostics.Tidy_Clang
 [  FAILED  ] ReadExportedDiagnostics.Tidy_ClangAnalyzer
 [  FAILED  ] ReadExportedDiagnostics.Clazy

as 07ec6de8d9 introduced Diagnostic::name
but did not adapt tests and printing.

Change-Id: Icadace9c23ad1ad03eee7ad394bbc0211aea31f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2020-05-15 05:10:11 +00:00
Marco Bubke
33a833d187 Sqlite: Add null value
So we can distingish between a null value and zero or an empty string.

Change-Id: I9122fdafdf85cf04dcf8bca7bf294be9b28ee251
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 18:02:18 +00:00
Marco Bubke
4b7aeae749 Sqlite: Add check constraint
Change-Id: Ib4b909da40c7fe07dcb6a07c4650a720313391c2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 10:30:44 +00:00
Marco Bubke
77c81aa8b0 ClangPchManager: Fix tests
Change-Id: Ide9adf326dda4b995636d629a6b2eed829f42b34
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 09:52:55 +00:00
Marco Bubke
c4bbc74e37 Sqlite: Improve constraint support
Now you can add more than one constraint. And we added some
new constraints too.

Change-Id: I849d2d2ef6e44c897a65ff2bdfe8d172a345c991
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 09:15:00 +00:00
Marco Bubke
a86fd58e40 Sqlite: Improve LastChangedRowId
Sometimes we want not only the row id from one table but two or three.

Change-Id: I6d5444a71ecbfe6c1af8073be80b04932ea9268d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-14 09:14:35 +00:00
Nikolai Kosjar
2fb43e6e04 Clang: Fix typo in tests
Change-Id: I37ce70c06f98d6bc5f359f9fe34fd73a1cc51795
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-14 05:19:36 +00:00
Marco Bubke
a4b00a7742 Sqlite: Add update hook and use it to get the last changed id
Sqlite has a function to get the last inserted rowid but very often you
want to get the updated rowid too.

Change-Id: Ie276a5039682813ad16597433996a2959f54d9ba
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-12 13:05:57 +00:00
Marco Bubke
f02934458e Sqlite: Add foreign key support
It is still only support references in columns but so far it is enough.

Change-Id: Iebb4866cf738d651270e54357b5e4a2837f05417
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-07 12:14:58 +00:00
Marco Bubke
0e1870368c Sqlite: Add Sqlite::Value
It adds a layer if you don't know if the type is integer, float or string.
It does not handle bytearrays here because so far there is no need. There
are two classes, Sqlite::Value and Sqlite::ValueView. Value owns the
string, ValueView holds only a view the string. So there is no allocation.
It is designed to hold Utf-8 string like Sqlite but it can be easily
converted in and from QString or QVariant but mind about that this is not
free. ValueView has no constructors on perpose because it would be
ambiguous if there would be constructors for the other primitives of
the Sqlite layer like "int64", "double" and "string view".

Change-Id: Ia39364eb2fc1998e5c59fdb4316add22c748507d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-04-27 18:17:11 +00:00
Eike Ziller
5c121d5791 Merge remote-tracking branch 'origin/4.11'
Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp

Change-Id: Ib54f1645ec70a9e6460a888a13190ede130bccca
2020-02-05 11:59:35 +01:00
Christian Stenger
93896c9832 Unit: Fix building without ClangRefactoring
Change-Id: Id2a4d9d030c4a36eebc88f93029d846f08870eac
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-02-04 06:43:22 +00:00
Cristian Adam
3890473500 CMake Build: Fix unittests
Change-Id: I4282f2f80b1d8d1d902ac8252b8a826ca0e459c6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-02-03 13:57:51 +00:00
Eike Ziller
92546d0983 Merge remote-tracking branch 'origin/4.11'
Change-Id: I0657cee6b87eea7b3178548bebed85d5ac824519
2020-01-03 08:57:33 +01:00
Nikolai Kosjar
26693e8212 Revert "Clang: Stop enabling exceptions explicitly"
This reverts commit b114f77d8a as
"--driver-mode=cl" apparently still disables exceptions.

Task-number: QTCREATORBUG-23000
Change-Id: I9c49d971fafda5e1aca8445f8921e50f323d368f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-20 22:46:02 +00:00
Nikolai Kosjar
4fdd944617 Clang: Fix removing gcc internal include paths
Amends 5165c037eb.

Gentoo has the standard library headers installed in e.g.
<installdir>/include/g++-v8 and we excluded those. MinGW with the
standard library headers in <installdir>/include/c++ was whitelisted.

Instead of whitelistening more dirs that could contain standard library
headers, regard

  <installdir>/include
  <installdir>/include-fixed

as gcc internal include paths to remove. These seem to be stable across
distributions.

Task-number: QTCREATORBUG-23330
Change-Id: I44965d2030b4ea5a9dd269400faf19c3df89f5a6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-20 22:45:31 +00:00
David Schulz
a07053853b CMakeBuild: fix unittest msvc compile
by adding /bigobj cxx flag for msvc builds

Change-Id: I73e6afc820556454c2886fd2a55b296229c50649
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-05 11:56:36 +00:00
Christian Stenger
bf698f5a2f Unittest: Fix warning
Change-Id: Ie78646d82786ad8836f289ba53382dad2d51d3f5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-25 05:21:20 +00:00
Nikolai Kosjar
8f6eb41cad Clang: Ensure that platform codegen flags get also filtered
Leave the function addExtraCodeModelFlags() around as it's used by
ClangPchManager::ProjectUpdater::toolChainArguments().

This allows us to filter out excess target arguments in a follow-up
change.

Change-Id: I742d713dd1ca6c391ba77c52555dcf4e94cc2ff9
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-22 11:46:42 +00:00
Nikolai Kosjar
6ee08c0289 Clang: Simplify include paths in tests
* The paths on Linux are always "canonicalized" by
  GccToolChain::gccHeaderPaths(). Therefore, canonicalize the paths in the
  tests, soo.
* Introduce some helper functions to shorten the code.
* Do not break the strings literal paths as this complicates comparing
  them.

Change-Id: I0fc8acde0e455a7974baae0d9fdffd3a4060ff74
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-11 13:08:46 +00:00
Nikolai Kosjar
6156c59c62 Clang: Put clang's resource dir after /usr/local/include
...also on Linux.

That's what clang invoked from the command line does.

Change-Id: I59c48d11fab3b944bb42ca7bb4cd9093a735df60
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-10-11 13:08:28 +00:00
Nikolai Kosjar
5165c037eb Clang: Avoid consuming gcc internal include paths
Given the (default) include paths of GCC, e.g.

 /usr/include/c++/7
 /usr/include/x86_64-linux-gnu/c++/7
 /usr/include/c++/7/backward
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include

discard gcc-internal paths like /usr/lib/gcc/x86_64-linux-gnu/7/include
as they are not relevant for clang and even confuse it with regard to
 #include_next.

Paths below the gcc install dir are considered as gcc-internal. The
install dir is queried with

  $ gcc -print-search-dirs

Some GCC distributions, like MinGW, ship the standard library headers in
the install dir. Ensure to not discard these.

Fixes: QTCREATORBUG-22898
Change-Id: Ia85258fb01b72ad073e71390e003fe8268e3b01f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-10-11 12:49:06 +00:00
Orgad Shaneh
facebc6184 CMake: Fix build with Clang 9
Change-Id: Idf82175de1670259abd27df54b2c776e943a11e8
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-10-10 15:59:34 +00:00
Cristian Adam
4a20a596c8 CMake Build: Use shared precompile headers
This will make the build directory size smaller, as only two
pch files will be generated. Not one for every target.

Change-Id: I3eec91e7536eab1c62bff8843f075f0ef7b5fff6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-09-19 11:38:34 +00:00
Eike Ziller
ed9177f74c CppTools: Move ProjectUpdateInfo to ProjectExplorer
Used for updating project parts, so move it near RawProjectPart.

Change-Id: I77aeffbdbfb3d2ec0de600f61dcf7fbb7a355a98
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-09-12 06:37:41 +00:00
Eike Ziller
9cc45fe1fb CppTools: Move RawProjectPart to ProjectExplorer
Doesn't have any dependencies into CppTools anymore, therefore moving it
reduces the dependencies of the project managers to CppTools as well.

Change-Id: Ibe728abe59eb88a8877943dca1f48a85163e27ac
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 06:22:12 +00:00