summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel/clangcodemodelplugin.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}Jarek Kobus2023-05-031-1/+1
| | | | | | | Follows AsyncTask -> Async rename. Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225 Reviewed-by: hjk <hjk@qt.io>
* ClangCodeModel: Use QtConcurrent invocation for async runJarek Kobus2023-03-091-2/+2
| | | | | Change-Id: Id404d3a7699f12cdbc1e51390b3e5218ab3459b6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ProjectExplorer: Move some not-fully-session related bitshjk2023-03-011-9/+10
| | | | | | | | | | | | | | | ... out of SessionManager. The idea is to later move SessionManager into the Core plugin, which both is sensible conceptually and also prerequisite to merge the Bookmark plugin into TextEditor plugin. Currently, only the interface is split, as the load/save implemetations are non-mechanical to disentangle. Change-Id: I31631db3094ea192825a2ccaa6add6188662940b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Merge remote-tracking branch 'origin/10.0'Eike Ziller2023-02-161-24/+16
|\ | | | | | | | | | | | | Conflicts: src/plugins/clangcodemodel/clangcodemodelplugin.cpp Change-Id: Idb3d6e8fdfd278979f6180dc3795a2138bc2e61d
| * Clang*: Use new plugin test setup schemehjk2023-02-151-23/+15
| | | | | | | | | | Change-Id: I636b93d74b4f9ab9ade28c46c6e84b461ccf34be Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | ClangCodeModel: Remove unneeded codeChristian Kandeler2023-02-151-20/+0
|/ | | | | | | This was liblclang-specific. Change-Id: I3fe8a8d2d49b1c7b92a54a90864e4ead7152e4ae Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Use simpler Plugin::initialize() when feasiblehjk2023-01-201-6/+1
| | | | | Change-Id: I567965d266f20526bda9f823e31a04b354d53fb1 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ClangCodeModel: Tr::trhjk2023-01-191-37/+34
| | | | | Change-Id: I60aeadd38471cc65de250f66f0f09ba2931b3da2 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ProjectExplorer: Add "Generate" sub-menu to build menuChristian Kandeler2022-12-081-25/+28
| | | | | | | | Preparation for adding more generators. Task-number: QTCREATORBUG-28149 Change-Id: I4afa183a6fbd8ee88fc978b382f28cf9e52f09e9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangTools: Pass context object to lambda connectionsJarek Kobus2022-12-081-1/+1
| | | | | | | | | Remove some unneeded lambda () brackets. Change-Id: I502eb5cd89505fb77c02abf44b7ce19541a8ac2f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* ClangCodeModel: Implement per-session mode for clangdChristian Kandeler2022-09-051-1/+1
| | | | | | | Fixes: QTCREATORBUG-26526 Change-Id: If9e018475b4e2f0557d9bf64ad9a7921c9dd6046 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* Clang/C++: Use qtcEnvironmentVariable* instead of qEnvironmentVariable*Eike Ziller2022-08-291-2/+3
| | | | | | | | | | | | And instead of qgetenv. Takes Qt Creator's setting at "Environment > System > Environment" into account, which makes it easier on some platforms to set them (e.g. macOS), can be configured differently in different settings paths, and potentially can be changed at runtime (depending on usage). Change-Id: I7678b8e429b5eff79f87eb637f6f2131be43d904 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* CppEditor: Clean up ModelManagerSupport creationChristian Kandeler2022-08-021-1/+3
| | | | | | | | No need for "providers" etc. Change-Id: I4ae9e8ecd6b3554711e002f233c13fd7758f01e4 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ProjectExplorer: Remove unneeded #include in projectexplorer.hhjk2022-07-271-0/+1
| | | | | | | | | And fix side effects. Change-Id: Ib6f0c5618092f80204b409edec0a92004f2350d2 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
* Code cosmeticshjk2022-06-241-0/+1
| | | | | | | | | | Mostly unused #include's, also sort them or reduce scope. A few namespaces, ... Change-Id: I9ee71e07de7157c9942125672addf87dd41e78f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* ClangCodeModel: Move a test over from unittestChristian Kandeler2022-06-231-1/+2
| | | | | | Change-Id: Iac295216fff274fbe4a109477b1a4c2bd2c98d5d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangCodeModel: Do not dump compile_commands.json into project dirChristian Kandeler2022-06-151-3/+8
| | | | | | | | | | | We can't know if it's safe to put there; e.g. we might overwrite an existing one. Fixes: QTCREATORBUG-27573 Change-Id: I928408996759aaccb84332fcf95cf43d7f3bf083 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Move clang diagnostics config settings to clangd settings pageChristian Kandeler2022-05-231-17/+3
| | | | | | | | | | | It was confusing to have both "Clang Code Model" and "clangd" project settings pages, so we merge them. Along the way, a lot of code dropped off. Change-Id: I780850b716195c3729403ae59f0794c11b5c556d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Use Utils::runAsync instead of QtConcurrent::runEike Ziller2022-05-121-7/+7
| | | | | | | | | | That works the same with Qt 5 and Qt 6. This reverts commit c1fcaa28775240af47c62c479918d6f08e74617d. Change-Id: I603e50c793c2477454253a57bfe01eb25ecab6e3 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* ClangCodeModel: Fix build with Qt 5.15Christian Kandeler2022-05-111-2/+2
| | | | | | | | | | Artificially lower the number of function parameters in generateCompilationDB(), to accommodate Qt5's QtConcurrent::run(). Change-Id: Ide88925deb443378b9308d924406ec6f6f90e8aa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* ClangCodeModel: Use clangd's include pathChristian Kandeler2022-05-101-1/+2
| | | | | | | | | ... rather than the one from the LLVM that Qt Creator was compiled against. Task-number: QTCREATORBUG-27120 Change-Id: I4f211345ed547cd13f0b0774b99bc0f199a9cd44 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Speed up compilation db generationChristian Kandeler2022-05-061-2/+4
| | | | | | | | | | | We needlessly re-evaluated the same compiler options again and again for all files in a project part. Now we only do the actual file-related work per file. Along the way, we dissolved some unneeded classes and made CompilerOptionsBuilder non- polymorphic. Change-Id: I9710d641a57032936cc0812515974dbc91676c8c Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Move fix-it tests into pluginChristian Kandeler2022-05-041-0/+2
| | | | | Change-Id: If53df602a42d8c1ffde5db6c8cb1e7fc269bb272 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Remove libclang-based completion and function hintsChristian Kandeler2022-05-021-2/+0
| | | | | Change-Id: I742fb14b1aba3ba1f35a5c80bf553d2a735cac48 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Use more suitable location for compile_commands.jsonChristian Kandeler2021-10-201-1/+1
| | | | | | | | | | | ... for clangd. Putting it in the build directory seems sensible in principle, but that can be problematic for in-source builds. So introduce another level of nesting to prevent conflicts. Fixes: QTCREATORBUG-26431 Change-Id: Id66aa0852d206695f2fc2ec42292b1cecefe2b59 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Force clangd restart on external changesChristian Kandeler2021-09-071-0/+1
| | | | | | | | | | | Neither we nor clangd can afford to watch all source files, which means that after e.g. a branch switch we can easily end up in an inconsistent state. We alleviate this problem by restarting clangd if at least one open file was changed externally. Change-Id: I7e0d14835e3afbd7a64c3233614f2161282dddc0 Reviewed-by: David Schulz <david.schulz@qt.io>
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-5/+5
| | | | | | | | | | | | | | | | There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: Use only const pointers for ProjectInfo and ProjectPartChristian Kandeler2021-08-271-1/+1
| | | | | | | | All members were already const, but this makes it clear at all points of use that these data structures are immutable. Change-Id: Iea615c090bde462c445d15223caccc561b0c713d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* ClangCodeModel: Use clangd for completion and function hintChristian Kandeler2021-08-231-0/+1
| | | | | Change-Id: I80160f3a40da18ac178682afe6caba5e5af6e3eb Reviewed-by: David Schulz <david.schulz@qt.io>
* CppTools: Turn some classes into pure value typesChristian Kandeler2021-08-131-5/+10
| | | | | | | | | | | | | ProjectInfo, ProjectPart and ProjectUpdateInfo used to carry pointers to Project and/or Toolchain, even though they were used in contexts where these pointers were either unsafe to access or not guaranteed to be valid anymore, which made their use difficult and error-prone. We turn these classes into pure value types by copying in all relevant information before the first async operation takes place. Fixes: QTCREATORBUG-25678 Change-Id: I1914b0dbda6c7dfba6c95e5e92f2d69977755590 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* ClangCodeModel: Provide highlighting via clangdChristian Kandeler2021-07-051-0/+1
| | | | | | | | | | | | Note that we lose the highlighting for virtual function calls. We need to amend clangd to add the respective information to its semantic tokens message. Also, Qt properties are no longer highlighted as class members. We'll investigate how to best restore this feature. Change-Id: I403712aada3d7a8e1c7b7c1277f43f7f64f8450b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Provide tooltips via clangdChristian Kandeler2021-06-301-0/+1
| | | | | | | | | | | | Note that we temporarily lose the ability to hover over an include and get the full path of the header file. This is a valuable feature that we need to restore, preferably by fixing clangd itself. Fixing the remaining few test failures would likely require more complicated code as well as additional LSP round-trips, and as of now I'm not convinced it is worth the effort. Change-Id: I08c72c4bd1268bbd67baeb57bbfd29d9b11303a5 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Use clangd for local renamingChristian Kandeler2021-06-211-0/+1
| | | | | Change-Id: I1536265a8d46c9840e722bdfcb8638906d3f45cf Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Add test for "follow symbol"Christian Kandeler2021-06-031-1/+2
| | | | | | | | These are the tests from clangbackend, so we are now up to par coverage- wise. Change-Id: I7b8a63109bff17745782a646f684fd795f732672 Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Support access type categorizationChristian Kandeler2021-05-181-0/+2
| | | | | | | | | | | | | | | | | ... with "Find Usages", as we do in the built-in code model. Note 1: This is very slow, so it's for now only enabled if the search results come from a small number of files. Possible ways of speeding up the operation to be investigated. Note 2: All test cases from the old code model also pass here, but checking with non-trivial real-world projects shows a lot of mis-categorizations. Well will fix them one by one. Note 3: This functionality requires clangd >= 13. Change-Id: Ib3500b52996dbbf9d7d9712d729179bcbd3262fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
* ClangCodeModel: Add experimental clangd supportChristian Kandeler2021-04-221-1/+2
| | | | | | | | | | | | | If the user has enabled clangd (default is off), we start up one instance per project when it is opened/changed (including build config switches), and trigger background indexing. So far, the index is used to provide results for locators and "Find Usages". Per-document functionality such as semantic highlighting and completion is still provided by libclang. Change-Id: I12532fca1b9c6278baab560e7238cba6189cde9f Reviewed-by: David Schulz <david.schulz@qt.io>
* Use new, more evocative MessageManager APIEike Ziller2020-12-161-1/+1
| | | | | | | At various places where semantics doesn't change. Change-Id: Ib4d4a5c9f067e109126c6de88257f9e198a71447 Reviewed-by: hjk <hjk@qt.io>
* ClangCodeModel: Replace nested ClangCodeModel::Utils namespacehjk2020-07-061-6/+8
| | | | | | | | | | | | | | | | | ... by the customary ::Internal. It adds only noise on the user side and conflicts regularly with the top-level ::Utils namespace. Remove a (now) duplicated definition of setLastSentDocumentRevision(). Plus minor namespace related fixes. There are still minor conflicts between Utils::Text and ClangCodeModel::Text Change-Id: I2e8df6b3c6c3599192774032822ee7e778355bba Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Provide an empty default IPlugin::extensionsInitialized()hjk2020-02-071-4/+0
| | | | | | | And remove all empy re-implementations. Change-Id: I19f0b4e55c042c96693ecb89766f97f0a97b54ae Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* ProjectExplorer: Consolidate some Session::active* accesseshjk2019-11-291-4/+5
| | | | | Change-Id: I47b0f6c2c60b2f7c86b6ffd1ad3df393d1321c8b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Avoid warning on empty expressionshjk2019-07-231-2/+2
| | | | | | | | For some reason, Q_UNUSED includes already a semicolon, adding one on the user side creates an additional empty statement. Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.10'Eike Ziller2019-06-281-1/+1
|\ | | | | | | | | | | | | | | Conflicts: CMakeLists.txt tests/unit/unittest/unittest.pro Change-Id: I64296ad31502d9b35012da129a28e9277e9fcf8e
| * Clang Code Model: Fix product name capitalization in UI textLeena Miettinen2019-06-251-1/+1
| | | | | | | | | | Change-Id: I81d7e411d47e64d5304f30ca295c3f4b1f0d51b5 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* | Enable macro editing for the Clang indexerMarco Bubke2019-06-131-3/+2
|/ | | | | | | | Refactor much of the code from Environment* classes to NameValue* classes to share it with the preprocessor macro settings. Change-Id: Ica4ee817aa338230c422b30d91240d266248d226 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* ExtensionSystem: Move away from QListEike Ziller2019-05-271-1/+1
| | | | | | | | Qt 6 API will move away from it. Use QVector for API and some std container for internal things. Change-Id: Iff14d48a47d5ac52ade875d9c8c84ad8a4f577d8 Reviewed-by: hjk <hjk@qt.io>
* Compilation database: Add information to message paneChristian Kandeler2019-03-151-3/+15
| | | | | | | | We must tell users where we generated the file, and also inform them about errors. Change-Id: I6383655e2f731f41b9121b2a6a31bba551d1c1de Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CompilationDatabase: Show the progress bar while generatingIvan Donchevskii2019-03-151-3/+5
| | | | | | Change-Id: Ie8df9257f92a9dba110847fda2783c6090a23fdf Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang: Save compilation database to the build directoryIvan Donchevskii2019-03-141-5/+4
| | | | | | | | | | | For example CMake puts compile_commands.json into the build directory and it makes sense because it uses some target-specific command line options. Change-Id: I92a5b391f35e3f75bbcf41b8efff448f197895bb Reviewed-by: Marco Bubke <marco.bubke@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>