Commit Graph

2193 Commits

Author SHA1 Message Date
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
Nikolai Kosjar
caf721430b CppTools: Avoid "defineLine" in CompilerOptionsBuilder API
...because it might suggest to append a new line.

Change-Id: I8d5701a1d20c9d94ee528383227a6e3b446b4ff2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-17 14:29:49 +00:00
Nikolai Kosjar
f4994a5f76 CppTools: Always pass in header paths as native paths
Change-Id: I473c737107c14a4bc2c78b7c697eef02eb4bacff
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-17 13:19:55 +00:00
Nikolai Kosjar
f31735142c CppTools: Exclude compiler option from conversion to native path
...otherwise e.g. MSVC's "/I" option will be converted to "\I".

Change-Id: Ia01519ee5c942d0f3cdd32c4302055d0e58fb865
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-17 13:19:50 +00:00
Nikolai Kosjar
dd647b4236 CppEditor: Clean up header error indicator
* Show/hide the error indicator button instead of enabling/disabling it.
* Use "Minimize" instead of "Do Not Show Again" in the info bar button
  and use a custom setting to save this. The current info bar API does
  not signal addition/removal of global suppression ids which would be
  needed to update all editor widgets properly. We are the only client
  and it feels wrong to add this API there at the moment.
* Remove not needed code anymore.

Change-Id: I2bb872522b7410434f060cc359a3b62dfed0af4d
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-14 09:01:17 +00:00
Nikolai Kosjar
6884ab080e ClangStaticAnalyzer: Fix path for intrinsics for clang toolchains
Ignore the include path for intrinsics coming from the toolchain. The
clang static analyzer comes with its own intrinsics and does not cope
well with intrinsics from other clang versions.

Move the relevant implementation from LibClangOptionsBuilder into the
base class so that ClangStaticAnalyzer profits from this, too.

Task-number: QTCREATORBUG-17102
Change-Id: Id9a28ddebb889c862939332dce888a80b3bb7e63
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-13 10:17:58 +00:00
Nikolai Kosjar
9d55d8485c Clang: Show info bar for parse errors in header files
...because those errors can lead to a substantial performance/functional
regression.

The actual diagnostics (possibly with children) are shown as details in
the info bar.

The info bar can be hidden with the "Do Not Show Again" button.
Re-enabling the info bar is possible with the new editor tool bar
button.

Change-Id: I03394ff8e3c84127946b0b791930b28a385f5a46
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-11 14:01:14 +00:00
Nikolai Kosjar
380d756a03 Clang: Hook up supportive translation unit on first edit
Parsing happens rotationally on the translation units.

The recently parsed translation unit is used for completion jobs while
the older version is used for parse jobs.

Advantages:
  A1. A completion job cannot be blocked anymore by currently running
      parse job.
  A2. Faster triggering of parse jobs. A reparse was triggered about
      1650ms after the last keystroke. This is down to 500ms now since we
      do not have a blocking translation unit for the completion anymore.

Disadvantages:
  D1. Memory consumption is doubled for an edited document.
      This could be addressed by suspending the second translation unit
      after some time of inactivity.
  D2. Setup of the supportive translation unit takes some time.

Change-Id: I958c883c01f274530f5482c788c15cd38d6f4c3e
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-10 12:36:59 +00:00
Alessandro Portale
e809594fae Core: Make IOptionsPage::categoryIcon a Utils::Icon
This is necessary for themable + HighDPI icons in the options dialog.

Change-Id: I8e3ff87a24591af40bb76b39cd970443d7678fae
Reviewed-by: hjk <hjk@qt.io>
2016-09-20 12:52:49 +00:00
Eike Ziller
c635c6b50a Merge remote-tracking branch 'origin/4.1'
Conflicts:
	share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml
	src/plugins/android/androidrunner.cpp
	src/plugins/debugger/debuggerruncontrol.cpp
	src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.cpp
	src/plugins/qmlprofiler/qmlprofilerstatisticsmodel.h
	tests/system/suite_WELP/tst_WELP03/test.py

Change-Id: Ibac4d71d4f4dbe1e4f05052d2f8a2dcfd82edd4c
2016-09-13 12:15:09 +02:00
Versus Void
5cd77137bc CppTools: Fix loading of .config files
.config file wasn't considered during creation of injected configuration
file thus disabling code processing inside #ifdef blocks.

Task-number: QTCREATORBUG-16236
Change-Id: I50f21622ec1b246aaa80e4832fd826f1b61d8e96
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-09-06 13:14:37 +00:00
Eike Ziller
c56aa52b80 Merge remote-tracking branch 'origin/4.1'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/qmakeprojectmanager/makestep.cpp
	src/shared/qbs

Change-Id: If1787ed23afa786ed2cef57f53c1db642559cbe0
2016-08-31 14:40:38 +02:00
Nikolai Kosjar
83ea1f4deb CppTools: Add UI for file size limit of indexer
Task-number: QTCREATORBUG-16712
Change-Id: I92db8cbcac9669cbd5e4ee5f7ef6f613797c753a
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-08-31 07:47:27 +00:00
David Schulz
89ff2c1db5 Editor: Collect indentation for a list of text blocks
Allows the indenter to reuse code formatter structures.

Task-number: QTCREATORBUG-16420
Change-Id: Ie906d7fdcb50798da02ef5b750fb03ae752aadc1
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-08-31 05:33:56 +00:00
Francois Ferrand
7b2c09a118 C++: Disable C++ keywords in C files
In some (legacy) C files, new and delete may be used for regular identifier.

There are some limitations:
* Header files have no 'implicit' type, and may be parsed as C++ or ObjC depending on the
other files in the project.
* QMakeProject use a single ProjectPart for C and C++ files, so there will still be the issue.

Change-Id: Iec11687b35f7ccf1e7c0d091b143ae90d950e440
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-08-23 12:35:04 +00:00
Nikolai Kosjar
f06a5db22b CppTools: Fix condition in file size check
Change-Id: I71d67f1273bad025b8dff45b3903b458f5cda2a2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-08-16 13:38:13 +00:00
Nikita Baryshnikov
58a4663bda CppCodeFormatter: removed unused member function
and modernized State

Change-Id: I4ea2a7d9ebd89e35ffc5ba2465bf4f781fde08f6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-08-10 16:39:43 +00:00
Orgad Shaneh
b17b2461dd Simplify Utils::sort calls that sort by member
Change-Id: I0937e98014f223f42fbf1c6b2bd94fb109bc8870
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-09 13:52:47 +00:00
Orgad Shaneh
670e54345c Remove use of deprecated Qt algorithms
Change-Id: Ib35cffa2d5762874feea9b1d4df7f569c0e5f496
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-08-09 13:41:25 +00:00
Marco Bubke
4cdb5bab15 Clang: Add clang refactoring
Change-Id: I2e3f36f810276da3f8dc7dcc587b06f8edb586d3
GPush-Base: d02f51b48fc752fddcdef6dcb32b3f7f6c0195a3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-04 14:37:19 +00:00
Nazar Gerasymchuk
90629108fc UI files: Fix tab order in lots of UI forms
For unknown reasons tab order in listed UI files was set incorrectly and
behave unexpectedly. Now tab order behave naturally.

Changes made for listed objects and touches only UI.

Change-Id: I057b95eb21943ddb29b108682618382661db7be9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-02 14:29:27 +00:00