Commit Graph

47 Commits

Author SHA1 Message Date
Nikolai Kosjar
ca63359386 CppTools/Clang: Clean-up of includes
Change-Id: I0ba340dcf0ee23e61588f17262d07e7088751836
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-12-16 13:15:38 +00:00
Marco Bubke
19d9dc0ce3 Clang: Use line and column instead of offset for diagnostics
Offsets can be get wrong because of the utf8 <-> utf16 differences. Line
and columns are not that sensitive to it.

Change-Id: I2e3e8c000621b6d694a4ada6df176f29427794f5
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-07 11:10:05 +00:00
Marco Bubke
493a2a6189 Clang: Fix slowness of code completion after opening the file
Task-number: QTCREATORBUG-15429
Change-Id: I9a8a582fb3c59a960425f83eb8e7b436f15d1c1a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-02 12:37:25 +00:00
Marco Bubke
d579608e8a Clang: Prioritize current and visible translation units
We reparse first the current and then the visible translation units before
we reparse all other units.

The signals connections are queued to wait for the visible editor update.

Change-Id: I5e2b8bc80568450268ca24e26720b3f5af640995
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-12-01 11:14:39 +00:00
Nikolai Kosjar
a12a8c95f9 Clang: Request diagnostics/highlighting only if needed
Most of the time, the updated diagnostics/highlightings will be send by
the backend on translation unit update.

The other use case is changing the font settings (e.g. color), here we
need to request the highlightings explicitly.

Change-Id: I17a574eaf972c8bef12900241e7b33fe6ffd9dbd
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-30 16:50:49 +00:00
Nikolai Kosjar
1410bf3faf Clang: Use "clang" prefix plugin files
...for consistency and to avoid future file name clashes.

Change-Id: If595c8debfa1ceb01a1bb0ed34649fa513660503
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-30 11:04:07 +00:00
Nikolai Kosjar
5f98b8ec24 Clang: Remove PchManager
...which is the last dependency to libclang from the plugin.

Change-Id: I173ee7e9621912ec88706b4cf62db2b1dbcf7610
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-30 11:03:51 +00:00
Nikolai Kosjar
daf9369679 Clang: Remove dead code
Change-Id: Ia36e96424580d9b34000cf4a9b38eab98f9c449c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-30 11:03:04 +00:00
Marco Bubke
7ce9ef9db4 Clang: Integrate highlighting results from backend
Change-Id: I2c3fb69aabfe075bde76d63eafc2ca370f17493c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-11-26 15:19:27 +00:00
Marco Bubke
bd10e9b020 Clang: Only apply fixits to the corresponding revision
Change-Id: I4f4136369e1b261338d444670c212565e0c6b824
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-11-25 14:15:39 +00:00
Nikolai Kosjar
d8f119c8a2 Clang: Allow to provide extra command line options
This can be used to experiment with clang options that e.g. affect
diagnostics.

Changes take effect on editor re-open.

Change-Id: Ie46d0ff085a3700a748dbcf4b94b93b0bf9c4642
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-11-11 15:14:56 +00:00
Nikolai Kosjar
4d1a1981a8 CppTools: CompilerOptionsBuilder takes project part by reference
...since it assumes a project part != 0 and does not participate in
ownership.

Change-Id: Ia9c1eca52776990576a2dac61e9144234b04c59c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-11 09:51:19 +00:00
Nikolai Kosjar
56f37f78b2 Clang: Speed up requesting diagnostics
Register the translation unit and request diagnostics from the
clangbackend as soon as the project part is determined. There is no
reason to wait until the parser is finished for the highlighter.

Change-Id: Iebccbf59ebd205389462dcee97363746fb651bb2
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:55:39 +00:00
Nikolai Kosjar
23fa5a7efd Clang: Provide the language option to the backend
Provide the language option (e.g. "-x c++-header") when registering a
translation unit for the editor.

Task-number: QTCREATORBUG-14787
Change-Id: Ie06f9fdab302f1b21ba72cdb65b6aabf9f7bc04c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-11-06 11:54:16 +00:00
Nikolai Kosjar
c45f08cdae Clang: Rename isProjectPartValid to isProjectPartLoaded
Change-Id: Ib20700ebb7142cfa9e75edff3b21410fd3bdab05
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-14 10:12:08 +00:00
Marco Bubke
6cbee0ede3 Clang: Add fileContainer getter
File containers were generates in many places. To reduce the noise this
getters are introduced.

Change-Id: I059745c27ac2dd0515bc23b3438d6d264ba071d7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-10-05 10:37:26 +00:00
Nikolai Kosjar
a5674be613 Clang: Unregister file with project immediately on project close
Ensure that first the editors unregister with the removed project part,
then unregister the project part.

This makes testing and following the message logs easier.

It also fixes the following race condition:
 * Unload project of opened file
 * Immediately close the editor before a new project part is calculated
 ==> The editor is closed, but the translation unit is not properly
     unregistered.

Change-Id: I618930d221323435ba60ac6c051380bccc9fdaf1
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-10-01 13:44:48 +00:00
Nikolai Kosjar
26c0d6ab92 Clang: Fix race condition when closing a project
...which could lead to undesired asserts:

    SOFT ASSERT: "!"Got ProjectPartsDoNotExistMessage"" in file
      clangbackendipcintegration.cpp, line 184

Change-Id: If6d67b9f617394ce8f72e7e56699423d47879688
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-30 13:29:24 +00:00
Marco Bubke
25bb8411a4 Clang: Add ClangEditorDocumentProcessor::hasProjectPart
Change-Id: Ie08c44315c9d03434384a1fa0b276e22f45a2107
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-09-30 11:38:36 +00:00
Nikolai Kosjar
a7928b4b0b Clang: Integrate clang's fixits as refactoring actions
They are invokable by the usual means (Alt+Enter, editor's context menu
> Refactor) plus by the context menu of the editor's left margin for the
related line.

The fixit text comes directly from libclang and is thus not translated.
We modify the text slighty by stripping the diagnostic category prefix
("note:", "error:", ...) and capitalizing the first letter.

A follow-up change should properly indicate available refactorings with
a refactoring icon in the editor's left margin.

Task-number: QTCREATORBUG-14868
Change-Id: I86157c9f824d2a9dedf19087476d02ad1e6cc854
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-29 11:39:21 +00:00
Nikolai Kosjar
de6d7f0617 Clang: Refactor handling of diagnostics
...by introducing ClangDiagnosticManager and the helper class
ClangDiagnosticFilter.

ClangDiagnosticManager will get more state in a follow-up change.

Change-Id: Id2c312bc897ea41ed67292b56b24dcfb7975ff4a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-09-29 11:38:53 +00:00
Marco Bubke
0d20d56183 TextEditor/Clang: Add font settings for clang diagnostics
Change-Id: Iea2b4fabf0f4620b12f88b108eb59c160945c8d8
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-09-10 13:39:43 +00:00
Eike Ziller
c868b9f3ed Merge remote-tracking branch 'origin/3.5'
Change-Id: Ife5fdcd71b0adc99d4297a28a64515e9e93d7864
2015-09-04 09:19:28 +02:00
Nikolai Kosjar
169556db2f C++: Fix crash after triggering completion and closing editor
Fix use-after-free for the following case:
  1. Open an editor
  2. Trigger a long processing completion
     (e.g. simulate with QThread::msleep in
      CppCompletionAssistInterface::getCppSpecifics)
  3. ...and immediately close the editor (e.g. with Ctrl+W)
  4. Wait until it crashes.

The completion thread relied on the BuiltinEditorDocumentParser object,
which is deleted once the editor is closed. Fixed by sharing the
ownership of that object between the *EditorDocumentProcessor and the
completion assist interface.

This case came up when doing tests for the bug report below.

Task-number: QTCREATORBUG-14991
Change-Id: I0b009229e68fc6b7838740858cdc41a32403fe6f
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-09-02 12:37:23 +00:00
Marco Bubke
7eee8061f6 Clang: Add unsaved files messages
We have auto generated buffers from ui files which are not open but have no
file representation. So we need to provide them as unsaved files only.

Change-Id: I48a426c18e06eeda2fa707864f32f293e17ac651
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:02:19 +00:00
Marco Bubke
6e14eb6940 Clang: Rename ForCodeCompletion in ForEditor
It reflects that the translation units and projects have a tied
relationship with an editor.

Change-Id: I3c01d5776980fe079af1fdef82feded83fdf5463
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:02:02 +00:00
Marco Bubke
f2b7371af1 Clang: Reparse only if files are changed
Includes are now watched by a file watcher. Unsaved file changes are
watched too. If they are changed the translation units which depend on
them are set to a state which require a reparse. Later the diagnostics
of this units are collected and send back to creator.

Change-Id: I2fb5c7dd6644687f22399edd8d18edd6215c9505
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 15:00:07 +00:00
Marco Bubke
b278dc87ca Clang: Add diagnostics
Diagnostics are now moved to the clang backend process. Fixits are
supported too.

Change-Id: I20faacf466bbf78dec479220c3d7b336a47bc453
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-08-31 14:59:16 +00:00
Nikolai Kosjar
92ff267845 Clang: Remove logging category qtc.clangcodemodel.clangeditordocumentprocessor
It did not provide much value.

Change-Id: If6d3c65102eef1bba72c8da4870ddb11a47d4dba
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-29 08:53:15 +00:00
Nikolai Kosjar
c6b52267f4 Clang: Fix sending (un)register translation unit
Handle the following use cases:

  1. Editor is opened
    --> Register file at backend.

  2. Close editor for which a project part exists
    --> Unregister file with project part.

  3. Close editor for which no project part exists (anymore)
    --> Unregister file with empty/default project part.

Change-Id: I2b253004a920cccef989876538ab552eacf6b45c
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 13:08:32 +00:00
Nikolai Kosjar
420bc69739 CppTools: Use project part ids instead of file paths
File paths are not unique since e.g. each qbs group in a file is mapped
to a project part.

Change-Id: I7df3f224dd23046b869f2588b8a34eb26cfc0b1a
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-07-20 09:49:14 +00:00
Nikolai Kosjar
418fc32f6a Clang: Do not call DocumentManager::modifiedDocuments() from worker thread
This is unsafe.

Change-Id: I8ac075a7289afa0d84785e37b1325d186a153000
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-07-10 14:04:19 +00:00
Marco Bubke
5e2942a5bd Clang: Use member instead of pointer
It makes the resource allocation much more clear.

Change-Id: Ib276e089dc3db551171373d72e9b54c9d87b4c8c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-07-01 11:52:54 +00:00
Nikolai Kosjar
e50aafafe3 CppEditor: Fix semantic highlighting when zooming
...for the not visible documents.

First reset the extra additional formats, then set the new ones, not the
other way around.

Task-number: QTCREATORBUG-14579
Change-Id: Iae465bd9a7bb0a397fd4917df45955713aaf87c5
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-06-23 08:15:46 +00:00
Nikolai Kosjar
5e035bd740 C++: Rename semanticRehighlight to recalculateSemanticInfoDetached
semanticRehighlight() does a bit more than only rehighlighting and we
want to trigger (only) rehighlighting in a follow-up change.

Change-Id: Ic8da9ec8643f0f82f7c99ef9a8180b2868194254
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2015-06-22 07:20:21 +00:00
Marco Bubke
1402c067b1 Clang: Rename CodeModelBackEnd in ClangBackEnd
Change-Id: I13e8a458634110456375956d4d4da7239c86957f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
2015-06-16 13:29:27 +00:00
Nikolai Kosjar
23b8a3b2e8 Clang: Use completion through backend process
This makes us independent of libclang crashes for completion.
Re-parsing for highlighting still happens in the Qt Creator process.

Run in verbose mode:
    qtc.clangcodemodel.ipc=true

Run tests:
    -test "ClangCodeModel"

Task-number: QTCREATORBUG-14108
Task-number: QTCREATORBUG-12819
Change-Id: Id3e95bd2afdb6508bbd1d35fddc69534a909b905
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
2015-06-10 10:15:40 +00:00
Eike Ziller
9926fc2ab1 Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'
Conflicts:
	src/libs/utils/tooltip/tipcontents.cpp
	src/libs/utils/tooltip/tipcontents.h
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/baremetal/baremetalconstants.h
	src/plugins/baremetal/baremetaldevice.cpp
	src/plugins/baremetal/baremetaldevice.h
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwidget.h
	src/plugins/baremetal/baremetaldeviceconfigurationwizard.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.cpp
	src/plugins/baremetal/baremetaldeviceconfigurationwizardpages.h
	src/plugins/baremetal/baremetalplugin.cpp
	src/plugins/baremetal/baremetalplugin.h
	src/plugins/baremetal/baremetalruncontrolfactory.cpp
	src/plugins/baremetal/baremetalruncontrolfactory.h
	src/plugins/cppeditor/cppcodemodelinspectordialog.cpp
	src/plugins/cppeditor/cppdoxygen_test.cpp
	src/plugins/cppeditor/cppdoxygen_test.h
	src/plugins/debugger/breakpointmarker.cpp
	src/plugins/debugger/debuggeritemmodel.cpp
	src/plugins/debugger/debuggeritemmodel.h
	src/plugins/debugger/loadcoredialog.cpp
	src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp
	src/plugins/projectexplorer/addnewmodel.cpp
	src/plugins/projectexplorer/addnewmodel.h
	src/plugins/projectexplorer/jsonwizard/jsonfieldpage.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.cpp
	src/plugins/qmlprofiler/abstracttimelinemodel.h
	src/plugins/qmlprofiler/notesmodel.cpp
	src/plugins/qmlprofiler/qml/CategoryLabel.qml
	src/plugins/qmlprofiler/qml/MainView.qml
	src/plugins/qmlprofiler/qml/Overview.js
	src/plugins/qmlprofiler/qml/Overview.qml
	src/plugins/qmlprofiler/qml/TimeDisplay.qml
	src/plugins/qmlprofiler/qml/TimeMarks.qml
	src/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.cpp
	src/plugins/qmlprofiler/sortedtimelinemodel.h
	src/plugins/qmlprofiler/timelinemodelaggregator.cpp
	src/plugins/qmlprofiler/timelinemodelaggregator.h
	src/plugins/qmlprofiler/timelinerenderer.cpp
	src/plugins/qmlprofiler/timelinerenderer.h
	src/plugins/qmlprojectmanager/QmlProjectManager.json.in
	src/plugins/texteditor/findinfiles.cpp
	src/plugins/vcsbase/vcsconfigurationpage.cpp
	src/shared/qbs
	src/shared/scriptwrapper/interface_wrap_helpers.h
	src/shared/scriptwrapper/wrap_helpers.h
	tests/auto/qmlprofiler/abstracttimelinemodel/tst_abstracttimelinemodel.cpp
	tests/system/suite_debugger/tst_debug_empty_main/test.py
	tests/system/suite_debugger/tst_qml_js_console/test.py
	tests/system/suite_debugger/tst_qml_locals/test.py

Change-Id: I67540b648f8b162496f4aa606b04d50c7c9125c6
2015-02-12 17:29:21 +01:00
Eike Ziller
3c85058694 Update License
Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
2015-01-16 12:37:56 +01:00
Orgad Shaneh
c6a983d271 Core: Use FileName for file path in IDocument
Change-Id: I85f7398aee59d0d36f0e5c3bf88ff3c96002e394
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
2015-01-12 10:23:37 +01:00
Nikolai Kosjar
9ccb6b81c9 CppTools: Fix include hierarchy for clang code model
This makes the editor document snapshot accessible through
BaseEditorDocumentProcessor since we need it for the include hierarchy
if the the clang code model is activated.

Task-number: QTCREATORBUG-13553
Change-Id: I7214cc578d05fe5cad6e12b4d29fe6f840a88e8d
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2014-11-28 14:20:29 +01:00
Nikolai Kosjar
bf3c55be42 ClangCodeModel: Make use of QLoggingCategory
Change-Id: I28d50e224803096c032ae6e387bf1346db4cc216
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2014-11-03 12:11:04 +01:00
Tobias Hunger
6568d9fbc0 Fix some copyright headers
Change-Id: I5a6bba98684208cf7ca5fb30b4bd29635c4c0f21
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2014-10-16 12:02:57 +02:00
hjk
0fcca946ad Rename {Core,TextEditor},{Base,}TextDocument classes
First step of some more 'Base' removal in TextEditor.
s/Core::TextDocument/Core::BaseTextDocument/
s/TextEditor::BaseTextDocument/TextEditor::TextDocument/

Change-Id: I71ba325a2f0ad72ec9dae0d96846cbae72d326f7
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-09-25 18:00:51 +02:00
hjk
b26a17f30d CppTools: Change CppModelManager implementation pattern
Replace the CppModelManagerInterface/derived CppModelManager
combo by a more common CppModelManager/CppModelManagerPrivate
pimpl pattern.

Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2014-09-19 13:17:55 +02:00
Nikolai Kosjar
c4ace44141 CppTools/Clang: Remove QScopedPointers in *EditorDocumentParsers
...since they are pointless.

Change-Id: I1c7925d3b1ad33ac0f1dc372797e3ab9a4bdc4b3
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-29 16:13:02 +02:00
Nikolai Kosjar
89bd4ee3c4 C++: Base parsing on editor document instead of widget
This mainly takes CppEditorSupport apart.

* Parsing is now invoked by CPPEditorDocument itself by listening to
  QTextDocument::contentsChanged().

* Upon construction and destruction CPPEditorDocument creates and
  deletes an EditorDocumentHandle for (un)registration in the model
  manager. This handle provides everything to generate the working copy
  and to access the editor document processor.

* A CPPEditorDocument owns a BaseEditorDocumentProcessor instance that
  controls parsing, semantic info recalculation and the semantic
  highlighting for the document. This is more or less what is left from
  CppEditorSupport and can be considered as the backend of a
  CPPEditorDocument. CPPEditorDocument itself is quite small.

    * BuiltinEditorDocumentProcessor and ClangEditorDocumentProcessor
      derive from BaseEditorDocumentProcessor and implement the gaps.

    * Since the semantic info calculation was bound to the widget, it
      also calculated the local uses, which depend on the cursor
      position. This calculation got moved into the extracted class
      UseSeletionsUpdater in the cppeditor plugin, which is run once the
      cursor position changes or the semantic info document is updated.

    * Some more logic got extracted:
	- SemanticInfoUpdater (logic was in CppEditorSupport)
	- SemanticHighlighter (logic was in CppEditorSupport)

    * The *Parser and *Processor classes can be easily accessed by the
      static function get().

* CppHighlightingSupport is gone since it turned out to be useless.

* The editor dependency in CompletionAssistProviders is gone since we
  actually only need the file path now.

Change-Id: I49d3a7bd138c5ed9620123e34480772535156508
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2014-08-25 13:06:01 +02:00