Commit Graph

78 Commits

Author SHA1 Message Date
Nikolai Kosjar
25be7e087d CppEditor: Extract CodeModelInspector::Dumper
Change-Id: I58acfb2d049dd4239a3f41b0a5795bfaab7b4f2f
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-03-26 15:57:27 +01:00
Nikolai Kosjar
5c8df5fa4e CppEditor/CppTools: Introduce Test{Case,Document}
Move common functionality of the 12 test classes into base classes.

Change-Id: If64d3cec876807ac6f991151189860a99b8ff4ca
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-01-07 14:19:13 +01:00
Nikolai Kosjar
7f829b26e5 Clean up {classview,cppeditor,cpptools}.{pro,qbs}
Mostly reordering files alphabetically.

Change-Id: Ibad1fa75559218fe488d1b31c7200ba4ff6131fe
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-12-11 11:46:42 +01:00
Nikolai Kosjar
273192759b CppEditor/CppTools: Move FunctionHelper to CppTools
...and rename it to FunctionUtils.

Change-Id: If076ec01fd82e8ba728764bdeab7e87e8bc1ff3b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-12-11 11:46:33 +01:00
Nikolai Kosjar
7eeb87295b CppTools: Add basic test for TypeHierarchyBuilder
Change-Id: I7a82f2b22105d4e096fc0bd69679adacdde2c731
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-11-12 16:40:41 +01:00
Erik Verbruggen
ba2d7a4fa7 C++: Only parse with appropriate defines for open editors.
If two files from different (sub-)projects include the same header file,
and the defined macros differ for both files, the header file will be
parsed with only the appropriate macros for the including file.

Task-number: QTCREATORBUG-9802
Task-number: QTCREATORBUG-1249

Change-Id: I560490afa287b3bb1e863bce1bb4f57af36ad56e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-10-01 10:33:51 +02:00
Orgad Shaneh
5dc583068a Mute MSVC safety warnings
Botan:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility:2227:
warning: C4996: 'std::_Copy_impl': Function call with parameters that may be
unsafe - this call relies on the caller to check that the passed values are
correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See
documentation on how to use Visual C++ 'Checked Iterators'

c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility:2212:
see declaration of 'std::_Copy_impl'

D:\dev\qt-creator\src\libs\3rdparty\botan\botan.cpp:7248: see reference
to function template instantiation
'_OutIt std::copy<const Botan::u32bit*,T*>(_InIt,_InIt,_OutIt)' being compiled
with
[
    _OutIt=Botan::word *,
    T=Botan::word,
    _InIt=const Botan::u32bit *
]

CppTools:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xutility:2873:
warning: C4996: 'std::_Mismatch1': Function call with parameters that may be
unsafe - this call relies on the caller to check that the passed values are
correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See
documentation on how to use Visual C++ 'Checked Iterators'

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility:2856:
see declaration of 'std::_Mismatch1'

D:\dev\qt-creator\src\plugins\cpptools\symbolfinder.cpp:388: see reference to
function template instantiation 'std::pair<_Ty1,_Ty2>
std::mismatch<QString::const_iterator,QString::const_iterator>(_InIt1,_InIt1,_InIt2)'
being compiled
with
[
    _Ty1=QString::const_iterator,
    _Ty2=QString::const_iterator,
    _InIt1=QString::const_iterator,
    _InIt2=QString::const_iterator
]

Change-Id: I09a477e755c4555101b064271f10c08a69576e33
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-20 14:51:07 +02:00
Erik Verbruggen
c9f5a14bdd C++: add code-model settings to choose one by mime-type.
The model-manager now supports multiple code models for semantic
highlighting and code completion, and will choose one based on the
mime-type of the editor.

The settings page is currently disabled. It will get enabled when a
second plug-in lands that has a ModelManagerSupport class.

Change-Id: I10023f52322ed6860397da15dba1c231e80e6517
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-13 14:37:48 +02:00
Erik Verbruggen
3a5d3a2fe9 C++: unify highlighting/code-completion support "factories".
Both semantic highlighting and code-completion go hand-in-hand, so now
the ModelManagerSupport class acts as a "factory" for the model manager.
Depending on the mime-type of the document in the editor, the model
manager will return the appropriate highlighter or code-completion
engine. If none is registered, the built-in fall-back is used.

Change-Id: I3e5dbb0e3b58e077dd5eda9aecb2ce5d448ac0b8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-10 11:45:38 +02:00
Erik Verbruggen
b4a1bd415f C++: clean-up CppCompletionAssist.
This is step 1 of 2 for merging the various provider factories into a
single class. Merging has the advantage that selecting based on editor
(content) mime-type only has to select one class, instead of re-doing
the selection for each class separately.

Change-Id: I11f815151bd4769ae6028b636793d6a80d02e202
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-09 11:59:14 +02:00
Orgad Shaneh
adee8336bb C++: Custom directory list for Switch Header/Source
Some projects use separate directories for sources and headers.

An example tree:
*
|-- src
     |-- foo.cpp
|-- include
     |-- foo.h

Allow the user to specify directories for finding out-of-project related
header/source files, in addition to current directory

Task-number: QTCREATORBUG-8883
Change-Id: I57215c8f2feffcc246d0d161798290861bcfcdd4
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-09-03 14:25:05 +02:00
Nikolai Kosjar
fc731a3a67 CppTools: Introduce LocatorData
Until now the locator filters CppLocatorFilter, CppClassesFilter and
CppFunctionsFilter used unnecessarily their own SearchSymbols instance.
The results were also saved separately, which was unfavorable since e.g.
the functions and classes data could be shared.

Starting with this patch an instance of LocatorData will serve all
mentioned filters.

This saves about 20MB of memory after indexing the Qt Creator project.

Change-Id: I8a34b67eb9fe0e5c68ba6e7c8f576389c78efc6f
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-08-30 16:42:26 +02:00
Nikolai Kosjar
fd9293dd0a CppTools: CppPreprocessor: Track also unresolved includes
Change-Id: Ia36e7e7142dbc030a428369ed04e76e70e8eef0b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-08-22 11:57:27 +02:00
Nikolai Kosjar
d185849150 CppTools: Tests: Introduce basic BuiltinSymbolSearcher tests
Change-Id: I25f11e80747863f797d146980d8ee0e605acb6e5
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-08-20 14:18:45 +02:00
Nikolai Kosjar
dcf618469d CppTools: Tests: Add basic tests for locator filters
Change-Id: Ie71aa8a39f4584a024a4f104841ad8e57947e489
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-08-19 14:43:58 +02:00
Nikolai Kosjar
f23fed601b CppTools: Tests: Move test includes utils into helper class
Change-Id: Ia679f3d2ae5fce0978a4e320fa18b28f1a7bed71
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-08-13 09:23:02 +02:00
Tobias Hunger
81eba6f984 Move Ui code model support into QtSupport
* Move basic ui code model support from CppTools into QtSupport
* Use Kit infrastructure to retrieve uicCommand and environment
* Remove specialization for cmake projects (no longer needed)
* Remove specialization for qmake based projects (no longer needed)

Change-Id: I8569cc01acb46a540883c2da235d169bebf7db39
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-07-10 14:36:17 +02:00
Nikolai Kosjar
f3186690bd CppEditor: Improve finding position for new includes
...by detecting include groups (separated by new lines, include types
and same dir prefix).

Task-number: QTCREATORBUG-9317
Change-Id: I73e80fdc715104901cb2d4f5b15b4cab5d04d305
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-06-11 15:57:10 +02:00
Erik Verbruggen
09ea0d235a C++: moved the CppPreprocessor into its own file.
Change-Id: I399d667a1fccb376fadbd6ab8fbba243e86d8f4b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-26 13:56:08 +02:00
Tobias Hunger
ddafdf55de CppTools: Rename files to comply with coding standard
Rename ModelManagerInterface.(h|cpp) to cppmodelmanagerinterface.(h|cpp).
Rename TypeHierarchyBuilder.(h|cpp) to typehierarchybuilder.(h|cpp).

Change-Id: I035d833fd205d7460819bd0fb7031294359032f9
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-04-10 11:43:22 +02:00
Oswald Buddenhagen
06acd82ada derive TARGET from QTC_{LIB,PLUGIN}_NAME
the information is redundant now

Change-Id: Icc8c8b4ace11538d45c6c9e1dbe5a7976f4743e1
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-04-03 14:37:56 +02:00
Oswald Buddenhagen
7923032022 fix include style relating to cplusplus libraries
... and adjust INCLUDEPATH accordingly.

while i'm at messing with include statements, also re-order the include
blocks according to policy and sort them within bigger blocks.

Change-Id: I7762abfd7c4ecf59432b99db2f424e4fa25733a5
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-04-03 13:40:39 +02:00
Oswald Buddenhagen
9631fb88cf centralize assignment of TEMPLATE = lib
Change-Id: I4025539f3875e79f03743ba9ed3fd09cd31b998d
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-04-02 17:13:17 +02:00
Oswald Buddenhagen
7ce3362288 automatically include libs' and plugins' _dependencies.pri files
Change-Id: I25645bb625b467c6f9d895ff89a70acd6a25683e
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-04-02 12:19:31 +02:00
Oswald Buddenhagen
671587ebb4 move cpptools => locator dependency to cpptools_dependencies.pri
it belongs there.

Change-Id: I2d05287b90476ba1fde5ddda282f5a2b1766f6a2
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-03-27 16:20:53 +01:00
Sergey Shambir
63fe568b9b CppTools: improved languages support in ProjectPart
Please, read blueprint here:
http://qt-project.org/wiki/Blueprint-for-language-specs-system

Removed feature from QbsProjectManager: it not longer splits project on
separate C and C++ parts, because Qt version used only by clang parser
(not native) and can be ignored for pure C and Objective-C without C++.

Change-Id: I1c561f7f9f915cc6cb8579d19db74e8352f54c1e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-03-21 17:22:18 +01:00
Nikolai Kosjar
138066792e C++: Introduce PointerDeclarationFormatter
For a given AST, CppRefactoringFile and Overview this will create a
ChangeSet for rewriting the pointer or reference declaration according
to the Overview.

Task-number: QTCREATORBUG-6169

Change-Id: If6f824c1ea5e9f53a11a58ec8b6d696d01f0723e
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-01-24 11:59:14 +01:00
Orgad Shaneh
88267a3299 Generalize QT_NO_CAST_FROM_ASCII
Change-Id: I2b6c5876cafb7cf19fc3040bc84fd88a90b6c0e0
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-16 01:14:08 +01:00
Erik Verbruggen
0cac83af8b C++: add unittest for modelmanager path cleaning.
Change-Id: I30815b191654cba5eedf92a9afd2ed1b48af8b87
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2012-12-20 14:49:20 +01:00
Erik Verbruggen
271fb797cb Made symbol searching plug-able through indexing support.
The indexing support for the built-in code model is moved to its own
file. Symbol searching will now call for a searcher through that support
interface, which will create a fully configured and ready-to-go searcher
that can be started in the/a future.

Change-Id: Idc3ee1c7c789a69fa05ee1d42415313dcea94cf8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2012-11-26 14:07:35 +01:00
Orgad Shaneh
be443b8edb CppTools: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: I31a6117c2b4be3f8603c16a9f98b6937a0b9aeb2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2012-11-22 09:40:14 +01:00
Erik Verbruggen
9246e78d23 C++: started to make indexing plug-able.
Change-Id: Iff35840d73882a212dd77b54e4223c0b4111ac1c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2012-10-23 09:26:19 +02:00
Eike Ziller
42f4595e37 Merge remote-tracking branch 'origin/2.5'
Conflicts:
	src/libs/cplusplus/cplusplus-lib.pri

Change-Id: I430ec8c6dda4afad3aedb1bc47d3af64537cfe66
2012-07-24 14:17:33 +02:00
Christian Kamm
8dc0f69ed1 C++: Fix broken merge of 9121c21230.
Change-Id: I0cca1851132245430d59840728362ddea1475655
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2012-07-23 07:19:26 +02:00
Erik Verbruggen
f1b2100e34 Move the ModelManagerInterface out of the CPlusPlus library.
Change-Id: Iffaa18f848a22f6961b49dff048672b194570df6
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-03-14 11:46:24 +01:00
Erik Verbruggen
2d262bd3b7 [C++] Added object pool handling for CompletionAssistProvider.
Change-Id: I89634989a7f360a30f7ed1bde4e67c93551ddfe4
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2012-02-23 10:33:50 +01:00
Erik Verbruggen
6fe6f5cdb1 C++: make highlighting/completion plugable.
Change-Id: I990fdf5411153041c6b4c62f31b453342d59de53
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
2012-02-20 14:21:22 +01:00
Erik Verbruggen
dbc3332b8e C++: Moved completion/highlighting into the model manager.
This way the editor does not need to know all the details of
instantiating or maintaining classes for highlighting and/or completion,
it can just ask the model manager. The change also enables different
highlighting- or completion-engines without changes to the cppeditor.

Change-Id: I8000d9d9fe446b292defddb2295493cf77d0f14a
Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
2012-02-08 14:30:14 +01:00
Leandro Melo
466ea4842c C++: Improve file accuracy when finding symbols
This patch introduces a priority-based mechanism when searching for certains
symbols in the snapshot. The priority corresponds to how similar the file path
from the "reference" symbol is to the file path from the "candidate" symbol.
This solves a variety of issues when matching "equivalent" symbols but that
are in another file/project, such as when following a function declaration,
a forward class declaration, or adding a definition through a quickfix.

There's now a symbol finder which will compute the "best" search order and cache
the most recent results. A consequence is that following symbols in some cases
is slower, but not apparently significatly.

Note: The "find" functions were moved from the Snapshot to the new SymbolFinder
class.

Task-number: QTCREATORBUG-6697
Task-number: QTCREATORBUG-6792

Change-Id: Ia518f014275fec1f4d0cb3224bd4e06a9df6d557
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2012-01-23 11:34:44 +01:00
Leandro Melo
beede7d7cf C++: Automatic Doxygen comment blocks generation
This improves our completion support for documentation
comments. It's now possible to have a Doxygen block
generated when hitting enter after a /** or /*! comment
start. A couple other related options are also available.

Task-number: QTCREATORBUG-2752
Task-number: QTCREATORBUG-3165

Change-Id: I1c81c0b4b370eb1d409ef72a9c7f22c357f202f4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@nokia.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
2011-12-09 10:25:59 +01:00
Christian Kamm
bc1b724476 C++: Move codegen test into the CppTools plugin.
Change-Id: I4c70a9dbd5445188c3d202427da96e1c6ff90b63
Reviewed-by: Bill King <bill.king@nokia.com>
2011-11-15 15:37:29 +01:00
Jarek Kobus
2244911826 Implement Code Style schemes
Task-number: QTCREATORBUG-5092

Change-Id: I218cef02f7c242e4dfae59b1b8021ea618e60d07
Reviewed-on: http://codereview.qt-project.org/5160
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-09-23 10:23:15 +02:00
Leandro Melo
23decd9d34 C++ editor: Improve type hierarchy widget
Now the type hierarchy widget will also show the classes
derived from the selected one. For consistency the way
the base classes are shown was changed too. The diagram
below is an example from Creator's code when openining
the type hierarchy for BaseTextEditorWidget:

Bases
 +QObject
  +QWidget
   +...
     BaseTextEditorWidget
 +QPaintDevice
  +...
    BaseTextEditorWidget
Derived
 +BaseTextEditorWidget
  +VCSBaseEditorWidget
    GitEditor
    MercurialEditor
    ...
   GLSLEditorWidget
   CppEditorWidget
   QmlJSTextEditorWidget
   ...

Depending on the project and on the selected class the
hierarchy widget might take a bit to be constructed.
This should be improved later.

Change-Id: Ifbdd1cbbba955a0bdf03297ff0e7620351b12dc5
Reviewed-on: http://codereview.qt.nokia.com/883
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-07-08 14:50:26 +02:00
Christian Kamm
779fafcbfe Make C++ code style configurable.
Change-Id: Iaf08edb2361146e6b5e1cbafdb716a23c938875b
Done-with: Jarek Kobus
Task-number: QTCREATORBUG-2670
Task-number: QTCREATORBUG-4310
Task-number: QTCREATORBUG-2763
Task-number: QTCREATORBUG-3623
Task-number: QTCREATORBUG-567
Reviewed-on: http://codereview.qt.nokia.com/74
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
2011-05-24 12:45:07 +02:00
Leandro Melo
bec4f02495 New code assist API
This is a re-work of our completion engine. Primary goals are:

- Allow the computation to run in a separate thread so the GUI is not locked.
- Support a model-based approach. QStrings are still needed (filtering, etc), but
internal structures are free to use more efficient representations.
- Unifiy all kinds of *assist* into a more reusable and extensible framework.
- Remove unnecessary dependencies on the text editor so we have more generic
and easily "plugable" components (still things to be resolved).
2011-05-18 10:46:20 +02:00
Christian Kamm
5f50a6ae34 C++: Move the ModelManagerInterface from CppTools to CPlusPlus. 2011-01-04 15:58:21 +01:00
Oswald Buddenhagen
e160f071ce centralize addition of pluginspecs to OTHER_FILES 2010-11-03 17:47:41 +01:00
dt
6b6d9871b8 Merge remote branch 'origin/2.1'
Conflicts:
	share/qtcreator/templates/mobileapp/app.pro
	share/qtcreator/templates/qmlapp/app.pro
	src/plugins/cpptools/cpptools.pro
2010-10-04 16:07:46 +02:00
dt
41ceaf2821 Ui Code Model Support: Refactor code in preparation for cmake support 2010-10-04 15:09:58 +02:00
Erik Verbruggen
3ebc328498 C++: added quickfix to insert a method definition.
Reviewed-by: Christian Kamm
2010-09-30 12:19:39 +02:00