Commit Graph

2563 Commits

Author SHA1 Message Date
Orgad Shaneh
edbaea4f60 C++: Use Utils::FileName for Usage::path
Change-Id: I1d22333ad60d229202db5d372d00019b5870e60f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-04-27 08:34:59 +00:00
Eike Ziller
9443f7104b Remove the need to create ISnippetProvider subclasses
Change-Id: I1810aaa945136d9726a66dad41377429a6adc8e1
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-04-25 12:03:08 +00:00
Eike Ziller
dae2556d2f Merge remote-tracking branch 'origin/4.3'
Change-Id: I44511e06986b7df6007be7daf7051c895a10794b
2017-04-21 15:30:00 +02:00
Nikolai Kosjar
2ed089ba7f Clang: Fix path to intrinsics dir
...which got lost in

    commit 1e3f2eec8d
    Clang: Consolidate all ClangCompilerOptionsBuilder into one implementation

This will fix

    SOFT ASSERT: "!resourceDir.isEmpty()" in file
        C:\work\build\qt-creator\src\plugins\cpptools\clangcompileroptionsbuilder.cpp,
        line 119

Change-Id: Ie0301517eca580b4907bbcd8f524775f2b0bedb8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-04-19 13:23:55 +00:00
Eike Ziller
88897f3a87 Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp
	src/plugins/genericprojectmanager/genericproject.h
	src/plugins/genericprojectmanager/genericprojectnodes.cpp
	src/plugins/genericprojectmanager/genericprojectnodes.h

Change-Id: Ie0c870f68c8d200a75489b75860987655b2f6175
2017-04-19 09:56:14 +02:00
Tobias Hunger
0951589420 Project: Unify handling of displayName
Unify the handling of displayName with a proper changed signal across
all projects.

Change-Id: I7e503528854b85f6f38de4b0943775f82a0d6123
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-04-07 14:49:51 +00:00
Eike Ziller
bac2e6c17a Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/cmakeprojectmanager/servermodereader.cpp

Change-Id: I58e7b33d32c41cb48a24a5638ddb256212dd6107
2017-03-30 13:59:12 +02:00
Tobias Hunger
b0c7bb0f7b Project: Move ProjectDocument setup into Project class
Change-Id: I5c0ec79ddf066e37660fb9a6b24f9d882355d511
Reviewed-by: hjk <hjk@qt.io>
2017-03-29 11:53:24 +00:00
Thomas Hartmann
d882cb4a8f Utils: Adjust name fillWithZero()
The name was quite missleading.

Change-Id: I538eca2a59e8a861e707fecd8331488e1919408a
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-03-29 08:23:14 +00:00
Eike Ziller
016767b2a6 Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp
	src/plugins/genericprojectmanager/genericproject.h
	src/plugins/projectexplorer/projectmodels.cpp

Change-Id: I290cba328212cadd3c12909d1f2f3642d326a1ca
2017-03-28 09:56:16 +02:00
Tobias Hunger
fc5ce1e710 ProjectExplorer: Handle project file list globally
Handle the generation of the list of files in a project globally, based
on the project tree.

Creator now has the concept of TreeManagers which can enrich the project
tree with additional data (e.g. the files found in a resource file), which
the project does not necessarily know about. So use that tree to find
the files that belong to a project instead of implementing similar features
in each project.

Change-Id: Ia375a914a1f2c0adaa427f9eda834eec2db07f68
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-03-27 15:32:13 +00:00
Nikolai Kosjar
7d39f94f3d Clang: Avoid warnings about unknown pragmas
Task-number: QTCREATORBUG-17460
Change-Id: Ic57f59f87b58c44ac738fb87039b4844d82bc924
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-24 10:51:43 +00:00
Nikolai Kosjar
535cc76cac Clang: Avoid dot-arrow-correction if dot is gone
Change-Id: Iba23a17ba9345ed4f08e16faad02054903c04afc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-23 17:26:06 +00:00
Serhii Moroz
6ecb1c4018 Locator: Add highlighting of the search text
Change-Id: Ia166e9667076e46770a754b626ceb28080139e79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-03-21 12:31:46 +00:00
Nikolai Kosjar
b2e537baaa ProjectExplorer: Move built-in parser workarounds to built-in code model
...so that only the built-in code model parser sees them, but not the
clang code model, which has problems with them. The specific case here
is due to definition of __int32:

  winnt.h:3077:1: error: functions that differ only in their return type
                  cannot be overloaded
  intrin.h:357:31: note: previous declaration is here

While moving, drop __MSVCRT__, which seems to be a predefined macro of
ancient MSVC versions, see

https://sourceforge.net/p/mpg123/mailman/mpg123-devel/?viewmonth=201010&viewday=24

Change-Id: I4b8c49ed4bdc942a2190dbae3c260f3a1a8078a4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-16 16:18:44 +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
Orgad Shaneh
da7cb91446 Merge remote-tracking branch 'origin/4.2' into 4.3
Change-Id: I4931dcc81be872d7712e67123e94d15ee696459f
2017-03-14 16:20:14 +02:00
Samuel Gaist
4033471aa9 QRegExp include cleanup
This patch adds the missing include statements for QRegExp.

Change-Id: Ibb03b929940adb84ae190b5090cb6b88653cc14c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-03-13 22:05:30 +00:00
Nikolai Kosjar
8a076e3f4b CppTools: De-duplicate and rename function in ProjectPart
Change-Id: I675ce4c9059d8ae4046f6a13aa7c04b88141d443
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-09 14:35:29 +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
187f48c238 CppTools: Clean up includes of doxygengenerator.cpp
Change-Id: Ie9ad5cbebc2d97c51889ccc1539caed7d7ded8d4
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-03-08 11:07:12 +00:00
Nikolai Kosjar
45b7c5ac29 Revert "CppTools: Do not put configuration document into global snapshot and working copy"
This reverts commit 05942b63f8 because it
breaks refactoring, e.g. Q_PROPERTY generators.

Change-Id: I9a14b912ba72663f08ea99e7e066d824b18da4b0
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-03-07 11:54:16 +00:00
hjk
3f5caf4cdc Utils: Wrap MimeDatabase into static functions
To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra
all over the place.

Change-Id: I4bfef62e73275a991455141671d6071162788e9d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-03-03 07:57:54 +00:00
Tim Jenssen
f2b8e9acd1 SessionManager: Clean up methods around projects
Clean up methods around projects() and update its usages to modern
language standards.

Change-Id: Ia0a4574d014ce41e0d511a392e4eed4680981d0e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-02 09:31:23 +00:00
Eike Ziller
d64e17ad55 Move mimetype definitions to plugin specs
- Avoids the hassle of QRC files and manually registering mime types
- Avoids performance regressions because of mime types that are
  registered after mime database has been used
- Makes it technically possible to detect that a disabled plugin could
  handle a mime type if it was enabled

Change-Id: I373008b1b56e9c6b4853055f20b3eeb112a6eff9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-02-27 13:54:59 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +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
Marco Bubke
1a75db12f4 Clang: Improve speed by content generation
The argument parsing has some considerable overhead. We try to avoid that
with merging all content together in one file.

Change-Id: Icf426bb5d6a5569d59c180f94c7eab66a22a251c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-16 17:39:05 +00:00
Nikolai Kosjar
444e496f5d CppTools: Remove unneeded include
Change-Id: I8d49ac57f7e78c975798892681588a0c6db5ef0e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-02-15 14:58:09 +00:00
Nikolai Kosjar
c0f2bc254e C++: Sort source files in *.qbs
This makes the diff smaller when adding new files with the wizards.

Change-Id: Iabd35afc32f363c465c8d9b36c45d480ea666627
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-13 11:13:11 +00:00
Christian Stenger
2475da1bb5 Replace some more occurrences of QStringList() << pattern
Change-Id: Ic7193ac3a741763479a9ef129ed05cb7ca64f1e9
Reviewed-by: hjk <hjk@qt.io>
2017-02-08 14:27:48 +00:00
hjk
56409f5afa Replace a few occurrences of QStringList() << ...
... by something shorter.

Change-Id: I363b4e509adb07997517b2d233246a333aea4aea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-02-08 11:21:45 +00:00
Nikolai Kosjar
50a07695bd CppTools: Report also C language back to project
...for Project::setProjectLanguage().

Change-Id: I77347c4597061fb48782c629d5ad6898028fee13
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-06 14:31:49 +00:00
Nikolai Kosjar
38ba61ec4f CppEditor: Rework showing/switching parse configurations
* Move the combox box for switching the parse configurations out of the
  "Additional Preprocessor Directives" dialog ('#'-button) to make it
  better visible/accessible. Also, decouple the extra preprocessor
  directives from the concrete parse context since this is not anymore
  in same dialog.
* The combo box appears only if multiple parse configurations are
  available for a file.
* The first time multiple parse configurations are detected, an info bar
  is shown that points the user to the combox box. A "Do Not Show Again"
  button is provided.
* Upon selecting an entry, the preferred parse configuration is saved as
  part of the session. The setting can be cleared with the context menu
  entry on the combo box.

Follow-up changes need to ensure that the display name and/or tooltip is
unambiguous, e.g. for qbs and cmake projects.

Change-Id: I9e9773704187291524ad7b605bfdddd83ef5b19d
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-03 11:58:27 +00:00
Christian Stenger
062edcaa94 Fix compilation using Qt5.6 on macOS
Change-Id: I94c16668d8fd64c0974f7f1c459a1c46e1cbc9e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-02-03 08:10:59 +00:00
Jarek Kobus
32b628e16b Remove unneded includes of QStringBuilder
Change-Id: I2f9690d9374b44731926a1a1532994e877809e26
Reviewed-by: hjk <hjk@qt.io>
2017-02-02 15:26:54 +00:00
Nikolai Kosjar
e2e78c6a5d CppTools: Distinguish between ProjectFile::{unclassified,unsupported}
There was no way to determine whether ProjectFile::classify() was run or
not. Now, ProjectFile::classify() returns ProjectFile::Unsupported
instead of ProjectFile::Unclassified.

Change-Id: I660d0e42044bdefcac38058c6f4a3425983a6d93
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-02 14:46:13 +00:00
Nikolai Kosjar
cfa25be0a4 CppTools: De-duplicate printer of ProjectFile::Kind
Change-Id: I66d2841ac76a73ef7c6548b98438d5c7b3acc4c3
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-02 14:21:37 +00:00
Ulf Hermann
c70b689526 Unify projectexplorer language IDs
We don't need two IDs for C++ and the QmlJS ID should look the same as
as the others.

Change-Id: Ib9747f6b36a90bb652951d85eec69666615670c4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-30 15:34:46 +00:00
Marco Bubke
c072cdfb88 Clang: Add ClangPchManager
Compiling every header file again and again is quite time comsuming. There
are technics to improve this like preambles(a kind of automated
precompiled header) but they don't share their data between translation
units. This approach provides an automatically generated precompiled
header for every project and subproject to improve the loading time.

Change-Id: I34f5bd4db21951175920e2a9bbf6b97b1d705969
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-30 13:55:58 +00:00
Nikolai Kosjar
40f31139e4 CppTools: Remove excess include
Change-Id: Idacd899a206f17f0b023fb7ad0a3b4406d5edbea
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-30 08:13:28 +00:00
Nikolai Kosjar
7415964819 CppTools: Fix choosing project part after project open
As long as there are project parts for a source file, always determine
the best project part, instead of trying to stick to the previous one.
This ensures the best project part at all times and simplifies the code.

Change-Id: I25ea3eb43a5a3e6d93688d4b8965f596dc9ae22b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:52:54 +00:00
Nikolai Kosjar
bddfe21961 CppTools: Fix using updated project part
1. Open a project consisting of two subprojects referencing the same
   source file.
2. Open the source file.
3. Click '#' in the editor toolbar and select the second project (part).
4. Update the project file, e.g. add a define
   ==> Editor does not reflect the added define

This is due to comparing project part pointers. Fix by using the project
part id that remains stable across project manager updates.

Change-Id: Ifd1a113e55ebe2ecf036cd7caafdbfd6e4cdf415
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:50:11 +00:00
Nikolai Kosjar
07f32ef57a CppTools: Use fallback project part if project is closed
...instead of sticking to the old one.

If a project is closed, the editor should reflect that. It also simplifies the code.

Change-Id: I9b8a94513d3b06a238cfc4ee60c11c0d0da3d93f
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:50:05 +00:00
Nikolai Kosjar
ec3dcfd6ad CppEditor: Show info bar for project-less file
While at it, centralize the code for handling the info bars and actions.

Change-Id: Ied62e3db268aaff3ef87e246bfe2b50399341be3
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-26 07:35:30 +00:00
Tobias Hunger
f50d73cc3c TemporaryDirectory: Fix failing test cases
Change-Id: Ied61a1de9d226815da1eaa050a09dde30091d006
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-01-25 08:16:59 +00:00
Nikolai Kosjar
0b8df41387 CppTools: Provide hints about chosen project part for editor document
Parse issues can have multiple reasons (invalid kit, not a project file,
actual parse issue) and we should be able to tell them apart. With this
change, we can distinguish between the fallback project part and a
ambiguous project part.

Follow up changes will use this to display more accurate diagnostics.

Change-Id: Icc8767607cc17dc14d6227b07f34e81ba5525a96
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-24 14:41:48 +00:00
Filippo Cucchetto
4b1f8f3609 ProjectExplorer: Added support for registering custom languages
Change-Id: I728a2ed1ef7d9f44d7c2b59d27d6e23444cd3bb5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-23 11:19:11 +00:00