Commit Graph

9 Commits

Author SHA1 Message Date
Tobias Hunger
3529e785c4 CppTools: Make create* methods return something
Change-Id: I20cfdaef23e9b7c48c9d3b4f27157e771fd9bc7f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-01 14:19:29 +00:00
Christian Stenger
e255baaa8f CppTools: Add target type information to project part
Let project managers store information whether a project part
belongs to an executable or a library and use this information
inside the AutoTest plugin.
This information will help to determine which targets are
relevant for the execution of tests.

Change-Id: I93b42797bf55225425398dc83aecea3c99eea290
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-18 10:01:30 +00:00
Marco Bubke
b6e12f4a1c Convert macros from plain QByteArray to a vector of structs
The old code model expected the macros as C++ formatted text
("#define Foo 42) but newer targets like the Clang codemodel expect key
value arguments like "-DFoo=42". So instead of parsing the text again and
again we use an abstract data description.

Task-number: QTCREATORBUG-17915
Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-14 15:23:56 +00:00
Ivan Donchevskii
410e31c665 CppTools: set default -std=c++11 for Qt4
qmake from Qt4 does not provide C++ standard and
clang can't properly compile Qt4.8.6 and earlier
with c++1z. Behavior in this commit mimics qmake
from Qt5 which also provides c++11 as a default
standard.

Task-number: QTCREATORBUG-16441
Change-Id: I3d29891d6e47f2367f2b3b2bf4be4d86661924e9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-05 09:37:14 +00:00
Tobias Hunger
802eff3485 CppTools: Add target information to ProjectPart
This is important to be able to map sources to actual things that are
going to be built.

Change-Id: I1aef940767d60192642ed79a1703cff8dfdad9e1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-15 11:03:45 +00:00
Tobias Hunger
546df41853 ProjectPart: Add callGroupId
Do not rely on the projectfile being unique anymore.

Change-Id: I52e63b3ac8aeca43ef70af1d59d1d8612bd3540e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-03-09 13:50:08 +00:00
Tobias Hunger
cee92463f7 ProjectPart: Allow for line/column information in project file
Keep this information separate so that plugins using the information
do not need to start parsing the project file.

Change-Id: Ibecf431de1b12bbe820c6f8f9c986cffeb4972d2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-03-09 13:49:36 +00:00
Nikolai Kosjar
0c0b004493 CppTools: Fix setting ProjectPart::project
This was forgotten in

  commit 8c90998fff
  CppTools/ProjectManagers: Reduce ui blocking when loading projects

Change-Id: I5c3a8a4015dd3b4389a21a80367a9eac7ebd95fd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-02-21 11:45:00 +00:00
Nikolai Kosjar
8c90998fff CppTools/ProjectManagers: Reduce ui blocking when loading projects
${AnyProject}::updateCppCodeModel() did two potentially not that cheap
operations in the ui thread:
 (1) Querying the MimeDatabase for the mime type for the source files of
     the project. In 99.9% of the cases no files need to be read for
     this as the file extension will resolve the type. The expensiveness
     comes from the sheer number of files that can occur.
 (2) Calling compilers with the "(sub)project's compiler command line"
     to determine the macros. While the caches avoid redundant calls,
     the number of the unique compiler calls makes this still a
     ui-freezing experience.

These two operations are moved into a worker thread. For this, the
expensive compiler calls are encapsulated in thread safe lambdas
("runners") in order to keep the "mutexed" data minimal. The original
API calls of the toolchains are implemented in terms of the runners.

While adapting the project managers, remove also the calls to
setProjectLanguage(). These are redundant because all of the project
managers already set a proper value in the constructor. Also, currently
there is no need (client) to report back detection of C sources in
project parts. This also keeps CppProjectUpdater simple.

There is still room for improvement:
 * Run the compiler calls in parallel instead of sequence.
 * Ensure that the mime type for a file is determined exactly once.

Change-Id: I2efc4e132ee88e3c8f264012ec8fafe3d86c404f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-20 09:18:13 +00:00