Commit Graph

131 Commits

Author SHA1 Message Date
Robert Loehning
0ca8268d81 Clang: Initialize errorType
Change-Id: I1a418c8cda02320c6157635755f03bdc14d28a9e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-07 10:02:06 +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
340063c624 Clang: Use Utils::TemporaryDirectory
Task-number: QTCREATORBUG-17401
Change-Id: Ibf6007455ec92b1d9fcac17e1f3b5e2af21b7438
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-02-13 15:21:04 +00:00
Marco Bubke
79e73ea4ee Fix spelling of unitttest_public
Change-Id: Id90dbfe30bb1f1c147299c4ac8cd210dbe7d8b82
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-03 15:35:44 +00:00
Marco Bubke
01a96537a8 Utils: Move forward declaration of SmallString in an extra header
Change-Id: I6da1cc60d425f654a31570373eb3b4f660d5f975
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-02 12:46:44 +00:00
Marco Bubke
b860d46579 Clang: Handle generated files
We don't handled generated files so we got internal parse errors.

Change-Id: If75e202f93fe3f71f43e3b1d15c0fb77e20c2248
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-01 13:11:15 +00:00
Marco Bubke
a0c69c517c Utils: Fix long small string
We used only 6 bit to save the short size but for SmallString with a size
over 64 it is not enough. So we have now to use a uint16 instead of a
uint8 if the size if over 64.

Change-Id: I53558e492b6cb40b739b23a8af83d192a2e11bd2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-31 16:12:18 +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
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
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
Marco Bubke
3070a28422 Clang: Filter generated files
Generated files are not available, so clang will stop with an fatal error.

Change-Id: I80754015a1daf48cbf2ce8e06526c75b05b2901c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:41:01 +00:00
Marco Bubke
15de02ea0c Clang: Add refactoring support for unsaved content
We need the generated UI header but we don't have a build directory. So we
provide clang with in memory represations of the file.

Change-Id: Ie9db97bbea2222b0203a0457baa1f1fc7ad97213
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:39:11 +00:00
Marco Bubke
5735b3d3b3 Clang: Use std::unique_ptr instead of QScopedPointer
std::unique_ptr is in the standard and QScopedPointer maybe gets
depreciated in futur. So lets use std::unique_ptr instead so we don't have
to change to much code later.

Change-Id: Id479b0e80adaf3da4e408198d43c5dfd09a8c66d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-07 11:38:51 +00:00
Orgad Shaneh
7b3642cce4 Merge remote-tracking branch 'origin/4.2'
Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
2016-11-28 15:27:51 +02:00
Christian Stenger
bf3d2b0a3d ClangBackend: Fix missing include on macOS
Change-Id: I17c33d011941d4f425d9dc664f4faa0af250e967
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-24 08:35:00 +00:00
Nikolai Kosjar
a86ff510dc Clangbackend: Fix warning about inconsistent use of override
Change-Id: Ia7a00fea846119f3026d4db2665853fc72a3a888
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-11-23 15:01:32 +00:00
Tim Jenssen
7f757884c5 Clang: Extend clang query
It's a first step to introduce clang query.

Change-Id: I4d001a8883f56066765ce6bc561fa3f49611c0a4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-23 12:16:04 +00:00
Nikolai Kosjar
6cf1f7968f Clang: Fix initial document parse with modified content
Reproduce with:

  1. Create a new class named Foo with the wizard.
  2. Close foo.h
  3. In foo.cpp, add some class member function.
  4. In foo.cpp, trigger the refactoring action "Add public Declaration"
     for the just defined member function. As a result, foo.h will be
     opened.
     ==> While the declaration was added, the header file is not yet
         reparsed with the new content - this can be verified by setting
         a custom color for "Function".

In this use case, the refactoring action opens the editor and
immediately modifies the document (RefactoringFile::apply).

Fix by sending the document content along for the very first
RegisterTranslationUnitForEditorMessage if the document was already
modified.

Change-Id: If20615a45b72dd0bef87e1870e403d0b277bc5d6
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-11-23 11:50:39 +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
Tim Jenssen
0e7103ede6 Revert "Clang: Replace macro usage with HostOsInfo"
This reverts commit cbdf673696.

It introduce a dependency to utils for a couple of lines,
so it is not worth.

Change-Id: I2f53ff3f63322719de6faed7f55c66282d1044e8
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-11-02 12:25:12 +00:00
Nikolai Kosjar
028018dcac Clang: Clear left-over preambles after crash
...otherwise they accumulate in the temporary directory.

Change-Id: I0841f3d168f30f559fc718d2825dd3e800515074
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-21 09:53:12 +00:00
Nikolai Kosjar
8c23b49376 Clang: Shorten output prefix
Change-Id: I89a48a2defa4dbee9a0a0f9206ed996ca7cc1538
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-21 08:49:38 +00:00
Nikolai Kosjar
07c5cf3a83 Clang: Clean up diagnostic widget
* Use a single QLabel - No need for all the QLabels we used. Also, a
  single QLabel enables selecting and copying all the diagnostics, which
  is handy when displayed in the info bar.
* Avoid call to Utils::ToolTip::hideImmediately() if the location is
  clicked from the info bar.
* Simplify code and API

Change-Id: Ib991364e4d6f40ef02dada8ebbb90fe6ff8ae1a1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-21 07:33:16 +00:00
Nikolai Kosjar
35f6a0b954 Clang: Fix uninitialized member
Change-Id: I31cbce287f1f8d2b0c55be23fde4288ec3472639
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-10-14 10:30:54 +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
9730513698 Clang: Stop sending data to backend on disconnect
This addresses

    SOFT ASSERT made fatal: "m_connection.isConnected()" in file
      src/plugins/clangcodemodel/clangbackendipcintegration.cpp, line 230

I could not reproduce the issue locally, so I'm leaving the soft asserts
untouched for now.

Change-Id: If1d55ba7bc7e2d1ac20ad992c6d0d43ceb0f5d73
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-07 12:48:43 +00:00
Tim Jenssen
02c43d8a42 ClangBackend: speedup qgetenv calls
Change-Id: I2968380064154844a8115413d3ebdcdb5748f254
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-09-27 14:50:43 +00:00
Orgad Shaneh
cbdf673696 Clang: Replace macro usage with HostOsInfo
Change-Id: Ie2d02785a6f06447a270170d12f580fa1704b7ce
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-09-22 10:19:37 +00:00
Nikolai Kosjar
f8a404c258 Clang: Clarify process output prefix
"stderr" is clearer and it does not get in the way when searching for
diagnostics starting with "error: ".

Change-Id: I7dcd679ad65964ee66d69385550d808f6dbf91ae
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-22 09:42:29 +00:00
Tim Jenssen
d4fe89a9dd Clang: test if the ipcClientProxy is set before sending an alive message
A crash can be happen if the back end is slow like a debug build on
windows.

Change-Id: I7352ef2732d29ac60bb0c6d9906c10b7ebefa262
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2016-08-31 10:07:51 +00:00
Marco Bubke
a0371d91e6 Clang: Make RefactoringClientProxy::setLocalRenamingCallback final
Change-Id: I4e0811e763c71cd427f0497a825967d983ac36eb
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-08 15:03:43 +00:00
Marco Bubke
092df2edaa Clang: Smallstring should not depend on std::ostream
We move the io operators in an extra header file because if we would
include ostream in smallstring.h we would blow the compile time.

Change-Id: Iea61ceedbbbcdd2adc6dc149794dab6e743084f8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-08 15:01:53 +00:00
Marco Bubke
44f62d10ad Clang: Remove unused RefactoringServerProxy::ioDevice
Change-Id: Ie2cb946750ada2f89aa329499f9daaded48ba88e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-08 14:57:19 +00:00
Marco Bubke
f56ec53fa1 Clang: Test for file path RequestSourceLocationsForRenamingMessage
Change-Id: Ia384deb60e644d8894d7c56f81b3deb8b7706c11
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-08-08 14:19:02 +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
Tim Jenssen
6fe82385d6 Revert "Clang: Inline LinePrefixer"
This reverts commit 3ea1eb3631.

not performance relevant

Change-Id: I3e0a4bdf2317c5eec858c7661b2e67fe8028aff5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2016-07-21 12:55:14 +00:00
Marco Bubke
9617520e52 Clang: Inline DocumentAnnotationsChangedMessage
Change-Id: Ib2f16cb48bf3413006a1eaebcabc7d6cca696970
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:55:30 +00:00
Marco Bubke
ce45b4cf8b Clang: Inline HighlightingMarkContainer
Change-Id: Idb19b65099f42023ff347b427b014b3c476a06c8
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:53:56 +00:00
Marco Bubke
08574a415e Clang: Inline UpdateVisibleTranslationUnitsMessage
Change-Id: I6cce81746a32fb97df64d21d1fd9e13f5b8ceacf
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:53:45 +00:00
Marco Bubke
07991a6f83 Clang: Inline UpdateTranslationUnitsForEditorMessage
Change-Id: I0e68c138d5eed394f9fece1bd3ca6fbd39575348
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:53:31 +00:00
Marco Bubke
7605bb1f84 Clang: Inline UnregisterUnsavedFilesForEditorMessage
Change-Id: Ida87917a5162cfbe75f3a80c144378b834f90ad4
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:53:22 +00:00
Marco Bubke
38d3d8e727 Clang: Inline RegisterUnsavedFilesForEditorMessage
Change-Id: I22c23c1875cd7c73321cda15ad8a1e18c43db818
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:53:13 +00:00
Marco Bubke
e0db7ddcd2 Clang: Inline RequestDocumentAnnotationsMessage
Change-Id: Ife327d5822ed04620bc651e9264e7fb7184123ff
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:53:03 +00:00
Marco Bubke
5ae44be34f Clang: Inline FixItContainer
Change-Id: I00067803e5cbf5b0183dcefe11deaf9b78a45964
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:52:52 +00:00
Marco Bubke
5ccc1ac14a Clang: Inline SourceRangeContainer
Change-Id: I04e5f1abbe17d6e007a2cba5cd28c84a3428bcbf
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:52:43 +00:00
Marco Bubke
6a220a1575 Clang: Inline DiagnosticContainer
Change-Id: I0d15b0b0d43f2a114d234f4b26f1eb8cf9d4a380
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:52:36 +00:00
Marco Bubke
3ea1eb3631 Clang: Inline LinePrefixer
Change-Id: I5e55f8c9912d5be5102a5cdf5eb795b786dc1282
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:52:23 +00:00
Marco Bubke
0d40cc4e56 Clang: Inline ProjectPartsDoNotExistMessage
Change-Id: I8476e0dcf2c5ce16c7fc76f6e91a7ec9d8512411
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:52:16 +00:00
Marco Bubke
85081a67a5 Clang: Inline ProjectPartContainer
Change-Id: I4bd55f6be216b1ac99039e74be853c9634ac2fd6
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:52:07 +00:00
Marco Bubke
12c5ff13d0 Clang: Inline CodeCompletionChunk
Change-Id: Ia581ae109fe1fa2c05db37f1cfbe678f2d8e8778
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-07-19 13:51:54 +00:00