Commit Graph

2563 Commits

Author SHA1 Message Date
Tobias Hunger
c6f90e575e Utils: Introduce a TemporaryDirectory and TemporaryFile class
Both wrap the corresponding Qt class, but make sure all temporary files
or directories are created inside a "master temporary directory".

Change-Id: I55461be507c828c965224c02863ea5ed9bbf9498
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-20 12:17:10 +00:00
Marco Bubke
4d6b05c522 CppTools: Fix uninitialized memory
We cast it later to int64 for performance reasons so everything should be
filled by zeros.

Task-number: QTCREATORBUG-16672
Change-Id: Ib79ffa5cef79104dd3454111b52a6615c4b48917
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-01-17 16:45:24 +00:00
Marco Bubke
7dbd869e5b Fix exports for shared libraries
We use "shared" to define a shared library and not dll.

Change-Id: Ia97ebd0042a7ef0f33eadaa448d9a44b42331ad1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-16 18:21:17 +00:00
Nikolai Kosjar
32094eeb18 CppTools: Remove excess call to ProjectPart::updateLanguageFeatures
It is already called by BaseProjectPartBuilder::createProjectPart().
Besides ProjectInfo::finish() should not modify the project parts.

Change-Id: I4dc8276c94574a01432b7f98b9284e3bdf1b9f0b
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-01-16 13:32:42 +00:00
Nikolai Kosjar
e4e6572661 CppTools: Allow interpreting ambiguous headers as C headers
...instead of C++ headers.

For the Clang Code Model this results in using "-x c-header" instead of
"-x c++-header".

This introduces a new option in Options > C++ > "Code Model" to
configure this.

Change-Id: I8a0ce8fa6155f5ef58743ebc7f1d0b500fbf6599
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-01-16 10:17:50 +00:00
Eike Ziller
7f8aa3a7be Make some plugins hidden by default
Hide core plugin, hello world plugin, and plugins that only provide the
base for other plugins.

Change-Id: I7f4a29a265d760b2a759122be153c7f06bd40bd2
Reviewed-by: hjk <hjk@qt.io>
2017-01-09 12:25:13 +00:00
Nikolai Kosjar
9861a58400 CppTools: Prioritize project parts with selectedForBuilding=true
...when selecting one for the editor document.

This flag is only set by the QmakeProject.

Change-Id: I648886e12148bd1ebeccca52d9faaf4b528597c9
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-19 09:21:19 +00:00
Nikolai Kosjar
0718f536a7 CppTools: Show ProjectPart::selectedForBuilding in inspector
Change-Id: I8a662565eb5e12fd3dbabf00427f34c98030a55e
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-19 08:36:59 +00:00
Nikolai Kosjar
602c873d3e CppTools: Reparse editor documents after active project change
Change-Id: I010709c866291bf59c27f4a05765e1ab0efd28af
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:56:31 +00:00
Nikolai Kosjar
bd66d5ac05 CppTools: Remove some duplication
Change-Id: I8c84660b28c3e76b2cedd08ff3b44a38583f38a0
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:56:26 +00:00
Nikolai Kosjar
5421615070 CppTools: Rename updateHelper -> updateImpl
Change-Id: If1a1fb97aa2bcfad186c013f2b2cc4b94c66001e
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:56:21 +00:00
Nikolai Kosjar
566ab175b3 CppTools: Prioritize project parts from active project
...when selecting one for the editor document.

Change-Id: I85066aaa0862870cb2db2fb2cb40c2b2c23b2cac
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:56:16 +00:00
Nikolai Kosjar
ce1c6b2258 CppTools: Extract ProjectPartChooser
...and put it under tests.

Change-Id: Id4bd2391abd1dfdc23640e871453558566cb0693
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-16 13:40:23 +00:00
Marco Bubke
1e3f2eec8d Clang: Consolidate all ClangCompilerOptionsBuilder into one implementation
We used the same code in different but don't shared it. From a bug fixing
perspective it's actually not that smart.

Change-Id: Iaaffc883229e259ff77f95b5cf0a8f0d8b5117df
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-12-15 10:18:15 +00:00
Nikolai Kosjar
c82d372a41 CppTools: Ensure that the C++ project part is the first one
...for a given file in the ambiguous case (CppModelManager::projectPart).

There are several places where the first one will be preferred if there
are multiple project parts associated with a project file.

Change-Id: Ic01ea06277bc10f872238dcc181a55532b5783be
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-14 11:34:57 +00:00
Nikolai Kosjar
0265442c93 QMakeProjectManager: Use ProjectPartBuilder
...as the other project managers.

This removes extra code paths, duplication and improves classification
of source files (ambiguous headers).

Change-Id: Iae05cbbc61ab2e5dd841ae617bec994e0a1e52d5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-13 14:55:36 +00:00
Nikolai Kosjar
02d8e2af1b CppTools: Clean up ProjectInfo
Change-Id: I5d0db45d9fdb624bb6cc55d7f04061d553f13bce
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 09:15:25 +00:00
Nikolai Kosjar
7381736cf3 CppTools: Clean up ProjectPart
Change-Id: Ia7969ceb52ffb25e7c63b24bc33b091001e9b50a
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 08:33:14 +00:00
Nikolai Kosjar
a10bfb8400 CppTools: Do not hardcode default language version
...instead, use the latest we support.

Change-Id: I7e7768bc4bc31de1fe0f441c03f3ab5d677d76e8
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 08:33:09 +00:00
Nikolai Kosjar
602ad72d42 CppTools: Refactor ProjectPartBuilder
...and add some basic tests.

Introduce the abstractions ProjectInterface and ToolChainInterface in
order to break the dependency to the ProjectExplorer. Also, some simple
logic can go there to simplify the (Base)ProjectPartBuilder.

Change-Id: I6c50a1804ce62098b87109931eb171f5c2542937
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 08:33:04 +00:00
Nikolai Kosjar
3a369552c6 CppTools: Classify ambiguous headers depending on other files
This applies for all project managers, except qmake. The qmake project
manager will make use of this in follow up changes.

Before, "foo.h" was always recognized as a CXXHeader. Now, it depends on
the other files. E.g. in a file list {"foo.h", "foo.c"} foo.h is now a
CHeader. In {"foo.h", "foo.c", "bar.cpp"} the file "foo.h" is ambiguous
and we will create two project parts, one where it is a CHeader, the
other where it is a CXXHeader.

Change-Id: I50505163368742584b1380c284d42cbe07cb4fc9
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-12 13:49:09 +00:00
Nikolai Kosjar
05942b63f8 CppTools: Do not put configuration document into global snapshot and working copy
These are remnants of the time when we had only one snapshot.

Change-Id: I6ff4db645d1065a0ef195834890e0774e2e2c60e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-12-08 08:52:17 +00:00
Nikolai Kosjar
3602033fca CppTools: Clean up ProjectFileCategorizer
Change-Id: Ia6954810ad49d43629be2db074d620ab71a09cee
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-08 08:35:42 +00:00
Nikolai Kosjar
4580e88cbe CppTools: Extract ProjectFileCategorizer
Change-Id: Ib7a5c3c61b0ea172cbc6a3ac7c94e77ffabc0db4
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-08 08:35:34 +00:00
Nikolai Kosjar
c961018a63 CppTools: Clean up ProjectFile
Change-Id: I01212115566c6bf26268b66fef96d50b7e93b96c
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-08 08:35:25 +00:00
Nikolai Kosjar
6b2270e178 CppTools: Clean up indentation in CppTools.mimetypes.xml
Change-Id: Ibe8c8b32f659156d9bfba7ec26e0ee2cd5b04f94
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-07 14:35:02 +00:00
Nikolai Kosjar
8916e81c4e CppTools: Make objective c extension *.m unambiguous
...and thus avoid reading the file.

The other candidate was "text/x-matlab".

Change-Id: Ifb36b817cda654bcda37b7d675c2df4e60525a2b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-12-07 14:34:57 +00:00
Nikolai Kosjar
52ed363594 CppTools: Display header paths as view in code model inspector
Change-Id: I418cbc7200d9aee0862a484bb11cd23a632828b3
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-07 11:30:07 +00:00
Nikolai Kosjar
e7d74e1608 CppTools: Show file kind in code model inspector
Change-Id: I5cdc6ec672a970a6fcfa52dfa14c2f515cf27f6d
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-07 11:30:02 +00:00
Nikolai Kosjar
521423b433 CppTools: Call ProjectInfo::finish when we get it
No need to require the project managers to do this. Also, it is easy to
forget.

Change-Id: I96f7a5e5547418678af9653e5753c372f0880e5a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-06 14:34:39 +00:00
Francois Ferrand
38ae5aec10 C++: Fix handling of Objective-C/C++
- Objective C/C++ was not enabled in highlighter.
- QMake project part for Objective C/C++ did not have ObjectiveC extension enabled.
- As languageFeatures.objCEnabled is a bitfield, it was actually always set to 0.
- Highlight ObjC class & protocol declarations.
- Highlight ObjC message passing.

Change-Id: I64d12c9509058d05f7adce94598cb7ce91727ac8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-12-05 10:27:58 +00:00
Tobias Hunger
6a16a5bae0 CppTools: Initialize members
Change-Id: Id57982ad7fcd6756a95213e16aa59b41a2a329e1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-30 09:47:23 +00:00
Tobias Hunger
45626216b4 CppTools: Initialize settings pointer
Change-Id: Ib12d4c67fc69a0e41f863f5679013edfd09008ae
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-29 15:32:33 +00:00
Orgad Shaneh
7b3642cce4 Merge remote-tracking branch 'origin/4.2'
Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
2016-11-28 15:27:51 +02:00
Eike Ziller
2ed5d7998a Find Symbols: Use QRegularExpression instead of QRegExp
This makes it more consistent with the other find filters.

Change-Id: I39ad144d66091c3ccc5e4452009cc236165915ea
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-23 15:35:48 +00:00
Marco Bubke
ddfd29852a Utils: First step to extend search results for clang query support
We need multi line support, multi text range support. This is only adding
enablers and adds later the multi line and multi text support because this
triggers larger changes because you have to know the text document.

Change-Id: I44e46d9d80d7d73b2650c69cc83657c20c85bfae
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 10:48:59 +00:00
Nikolai Kosjar
b4d6884c25 CppTools: Fix propagating unsaved files
On project loading ExtraCompiler objects are created that might read the
already existing ui_*.h files in the build directory. In this case,
ExtraCompiler::setContent() is called, which will emit a signal about
the modified content.

Now GeneratedCodeModelSupport is a client of this signal and it forwards
the changed contents to the clang code model. However,
GeneratedCodeModelSupport objects might be created later and miss the
initial signal emission, thus leaving the code model unaware of some
unsaved files.

Fix by notifying the code model at construction time of
GeneratedCodeModelSupport.

Change-Id: I7311867ad7f534920357801647bd2d0c82bb4edb
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-22 12:21:07 +00:00
Orgad Shaneh
6d1d1a4416 Merge remote-tracking branch 'origin/4.2'
Change-Id: I957c22020fbacb2f631220b0cdc7fa16a782798b
2016-11-21 10:25:45 +02:00
Friedemann Kleint
3b1308bb43 TextEditor: Remove exported class QuickFixOperations
Define an operator << that accepts a raw pointer for the list of
QuickFixOperation::Ptr instead.

Fixes MSVC 17 warnings

src/corelib/tools/qlist.h(423): warning C4661: 'QVector<T> QList<T>::toVector(void) const': no suitable definition provided for explicit template instantiation request        ]
src/corelib/tools/qlist.h(389): note: see declaration of 'QList<TextEditor::QuickFixOperation::Ptr>::toVector'
src/corelib/tools/qlist.h(423): warning C4661: 'QSet<T> QList<T>::toSet(void) const': no suitable definition provided for explicit template instantiation request
src/corelib/tools/qlist.h(390): note: see declaration of 'QList<TextEditor::QuickFixOperation::Ptr>::toSet'
src/corelib/tools/qlist.h(423): warning C4661: 'QList<TextEditor::QuickFixOperation::Ptr> QList<TextEditor::QuickFixOperation::Ptr>::fromVector(const QVector<T> &)': no suitable definition provided for explicit template instantiation request
...

Task-number: QTBUG-57086
Change-Id: I879511656c39eb7a3eae54ea7daca3eca8ebe8d7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-18 11:47:59 +00:00
Eike Ziller
4026864f38 Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/plugins/clangrefactoring/refactoringengine.cpp
	src/tools/clangrefactoringbackend/source/symbolfinder.cpp

Change-Id: I7c1c87f3b8ade43a07f6668565501042e967fa8b
2016-11-16 16:04:59 +01:00
Denis Klychkov
36d4d01cd3 Clang: Take precompiled headers into account when parsing source files
Task-number: QTCREATORBUG-15590
Change-Id: Icbfce4ffd6e9f9802641d35d898fa1dc1c4c18ee
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-16 09:10:14 +00:00
Tim Jenssen
9c7ff5199f Clang: Add clang query
Clang query is mechanism to use AST matcher to search for code. Think
about regular expression but in the context of AST. So you get a semantic
search tool for C++.

Change-Id: I72e882c5b53a0c52f352a3664847c4c3e4f6fc2e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-15 15:30:33 +00:00
Nikolai Kosjar
8594020b57 CppTools: Fix crash on document close
Emit the signal only if we are not canceled.

Task-number: QTCREATORBUG-17249
Change-Id: I5082a5fe7554eecdc7ec5d148150c1b169002f6d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2016-11-15 08:41:05 +00:00
Nikolai Kosjar
645f7fc85b Clang: Avoid parsing unknown gcc 6 asm output flags
Task-number: QTCREATORBUG-17183
Change-Id: I24321cd97acfa3dd71a3682f14af4816bdd08059
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-11-01 14:16:11 +00:00
Eike Ziller
5b3aa93320 CppFindReferences: Simplify code
Get rid of the need to manage a map of QFutureWatcher -> SearchResult

Change-Id: I1a87eccfff9149f2ddfdd2f72bb5e4b07ee81ce3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-01 11:01:33 +00:00
Nikolai Kosjar
a8456c16e8 Clang: Avoid parsing unknown __builtin_va_arg_pack
Task-number: QTCREATORBUG-17185
Change-Id: I72552bcd417c9760413b772593642e3c79f1ab17
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-11-01 10:44:35 +00:00
Nikolai Kosjar
df581265c3 Clang*: Workaround parsing mingw's <type_traits> with clang 3.9
...for -std=gnu++0x.

Define the unknown identifier/type "__float128" so at least the headers can be
parsed successfully. Of course this does not help for parsing client code
referencing that identifier, but this should be the less common case.

Task-number: QTCREATORBUG-17126
Change-Id: Id321311713029d8aa77e068b02361d86debfada6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-18 15:07:15 +00:00
Nikolai Kosjar
57ac8d96c7 Clang: Avoid running into gcc/mingw intrinsics
Same as for the Clang Static Analyzer, so move the implementation into the base
class and use it.

This has gone unnoticed so far because it looks like that the error diagnostic
from the bug report can be extracted with libclang (as shown in the info bar),
but is not printed from libclang or clang.exe itself.

Change-Id: I5b714ba374c5fdefe234faf012a3515e96c9a08c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-18 15:04:16 +00:00
Nikolai Kosjar
b0a49ca1c1 Clang: Fix parsing MSVC's crtdefs.h for 64 Bit
...by specifying the word width, as for the Clang Static Analyzer.

This has gone unnoticed so far because it looks like that the error diagnostic
from the bug report can be extracted with libclang (as shown in the info bar),
but is not printed from libclang or clang.exe itself.

Task-number: QTCREATORBUG-17130
Change-Id: Ia7a5ee3825c7211cdf80c2166a9eb454ce48cac1
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-18 15:03:52 +00:00
Nikolai Kosjar
1fd5cd4dbc Clang: Use compiler specific undefine option
libclang generated:

    warning: /U__cpp_aggregate_nsdmi: 'linker' input unused [-Wunused-command-line-argument]
    warning: /U__cpp_alias_templates: 'linker' input unused [-Wunused-command-line-argument]
    ...

It needs -U.

Change-Id: Ibbd2f97e6f806215e3008803f57608b9b6b4c641
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-18 13:02:28 +00:00