summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel
Commit message (Collapse)AuthorAgeFilesLines
* Clang: Do not assume that one of the overloads always has parametersIvan Donchevskii2019-02-221-1/+1
| | | | | | Fixes: QTCREATORBUG-21841 Change-Id: I5d4fc5d10cdf38d124e84952862b9aaf66888c88 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Fix stack-use-after-scope sanitizer error in diagnostic filterKirill Burtsev2019-02-191-1/+1
| | | | | Change-Id: I97d69caf9c7b642bef277fdfa0df80820fcdbe2f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Stop going to F2 location if invocation context changedNikolai Kosjar2019-01-081-3/+10
| | | | | | | | | If follow symbol takes longer than expected and the user switched to another file or mode, abort processing the result in order to avoid confusion. Change-Id: I0106d49006d2cfd8c8dad0af66d97cee5e5c36de Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Avoid multi-line display name for completion itemsNikolai Kosjar2018-12-072-0/+15
| | | | | | | | | | These come directly from clang. If converting for display in the completion list widget, skip new line chunks. Fixes: QTCREATORBUG-21600 Change-Id: I83749ed73fa68658ec073d97177768f59a87cebf Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix providing snippets for another caseNikolai Kosjar2018-11-271-0/+1
| | | | | | | | | | | | | We have to indicate snippet addition for the PassThroughToLibClang case. This completes commit d946ff540312210f1da8cc509c474a39da45117c Clang: Fix adding completion snippets after { Change-Id: Ib543c415d4fdcc99d8bbf4815930f3d8481bc810 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Change dot <-> arrow if all completions require itIvan Donchevskii2018-11-133-2/+40
| | | | | | | | | | Return the behavior that existed before completion fix-its were introduced. Apply it only for the cases when all items require the fix-it. Fixes: QTCREATORBUG-21367 Change-Id: Idc358255135f72353f3fd3204b653fc2fc55e7a0 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Allow overtyping ) after completing function like snippetsNikolai Kosjar2018-11-131-3/+22
| | | | | | Fixes: QTCREATORBUG-21166 Change-Id: I02e20a230012ce82aed668a46f5fd4a02796135b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Utils: Adjust column numbers affected by convertPosition changeIvan Donchevskii2018-11-091-7/+7
| | | | | | | | | | | | | | convertPosition change was introduced in 931ec39f64a. It changed 0-based column to 1-based which is how it naturally is in Qt Creator. This fixed some usages but broke many more. This is an attempt to fix the remaining use cases. Fixes CppEditor auto-tests. Change-Id: Ia8d14da0ebb035cd2fdd6da4ff6ec89c1c5121a8 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Work around crash when dragging text from tool tipEike Ziller2018-11-091-1/+9
| | | | | | | | | | Disallow text selection for the code model tool tips because dragging the selection somewhere crashes. Task-number: QTCREATORBUG-21430 Change-Id: I3aed4e16bf429162258d2dfafaa45fff25ba700a Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Fix unresolved #includes for ui_*.h headersNikolai Kosjar2018-10-317-15/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...with an extra parse. Previously, the creation of an e.g. "Qt Widgets Application" from the wizard could show code model errors in mainwindow.cpp. Depending on timing issues, the first error is either 1. 'ui_mainwindow.h' file not found (QTCREATORBUG-15187) The parse happened before the in-memory ui_mainwindow.h was generated by uic. The file system watcher can't help here as the #include was not resolved successfully. And libclang's reparse does not handle this case (it would need to remember all failed #include stats...). ==> Detect this case with the help of the include paths and trigger a full parse. 2. or: allocation of incomplete type... (QTCREATORBUG-15187) The parse happened after the generation of the in-memory ui_mainwindow.h, but before the clangbackend received the unsaved file. ==> Fix this by also writing the content of the unsaved file to our behind-the-scenes-created ui_mainwindow.h. Fixes: QTCREATORBUG-15187 Fixes: QTCREATORBUG-17002 Change-Id: I4f3a81adaa3d604746977a402c29f83fbc5b0e44 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Do not insert "::" after namespace completionNikolai Kosjar2018-10-301-2/+10
| | | | | | | | | | | | | | ...as currently libclang does not provide "::" consistently and it confuses users. Ideally, once libclang provides it consistently, we probably want to insert "::", but allow to "overtype" it by the user, similar to what we do with function parentheses. That is, if the user accepts such a completion and types "::" due to muscle memory, he should not end up with "::::". Change-Id: Ibfd19c22457641956ace0ba976672eddc51ecc88 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Adapt plugin test testCompleteWithDotToArrowCorrectionNikolai Kosjar2018-10-251-1/+1
| | | | | Change-Id: Ibc272eb768f6d92c4b02c3164f7171fc769cfd41 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix adding completion snippets after {Nikolai Kosjar2018-10-253-1/+6
| | | | | | | | | | | | | | | | | | | ...e.g. as in "void f() {". The criteria whether to change snippets got invalidated with commit 8d0391a4f9b91fb15ee3d20db725c7a37c4646aa Clang: Treat brace initialization as constructor completion as the completion operator might be T_LBRACE now instead of T_EOF_SYMBOL for normal completions. This fixes the plugin test ClangCodeCompletionTest::testCompleteGlobals. Add also unit tests. Change-Id: I85cf522b9b307359c5c3e25198dd228cbb68ded0 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Adapt priorities for the same method/constructor overloadsIvan Donchevskii2018-10-251-2/+1
| | | | | | | | | | | | CXXMethod and CXXConstructor may have different priorities depending ony their origin and attributes. To keep them together in the sorted list we adapt their priorities to have the same value if their names match. To continue keeping ClassCompletion before ConstructorCompletion change the order of the completion kinds for the sort purposes. Change-Id: I36efe5d5dbaa77d604a54b1dafe07d67f44db4c9 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Fix the completion fix-it wordingIvan Donchevskii2018-10-241-1/+1
| | | | | Change-Id: Ifc3ab9946caf3716681a1bffd590f0780b796176 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Clang: Use multi-arg version of arg()Robert Loehning2018-10-241-2/+1
| | | | | | Change-Id: Iaaf95ea7a8057a66f044ece79c9b40ecd825d59c Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix naming conventions for *ModelManagerSupport* classesNikolai Kosjar2018-10-237-72/+72
| | | | | | | We use "Builtin" and "Clang" as prefixes, not suffixes. Change-Id: I6926aeb8f005176ef420c4421c257e3df61ee0b7 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Move text cursor utility methods into ClangCodeModelIvan Donchevskii2018-10-183-7/+57
| | | | | | | These 3 are only used in ClangCodeModel. Change-Id: Id7c2cead40473bcb746e4b105aa36cb7d51a2740 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Fixes: Clang: Sort the initial list of includes for the code completionIvan Donchevskii2018-10-171-0/+6
| | | | | | Task-number: QTCREATORBUG-6242 Change-Id: Icdd5671801079a547a08b1276a6dbc76fed4bd30 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Fix abandoning the parentheses for functionIvan Donchevskii2018-10-171-1/+1
| | | | | | | | | Was introduced in 0f96f735f0 because the the incorrect move to the '&' character. Task-number: QTCREATORBUG-21305 Change-Id: I55d79e68795f55b758aa95072fca10bc00d49037 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Avoid starting backend jobs for inactive app and during VCS operationsNikolai Kosjar2018-10-164-4/+53
| | | | | | | | | | | | | | | | | | | | | ...to reduce file locking on Windows caused by clangbackend's parse/reparse jobs. Considering inactive application state should help for external VCS operations, e.g. on the command line. However, activating Qt Creator while such a VCS operation runs might still lead to undesired behavior, but this should be the less common case. VCS operations started from within Qt Creator should see less locking conflicts as we know when they start and finish. However, we just avoid starting new jobs - there might be still jobs running. Pending or new jobs will be started once Qt Creator is activated again and all VCS operations finished. Task-number: QTCREATORBUG-15449 Change-Id: I5f04c34f006e66162368efbdd58bd822a706f35e Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Improve debug log messageNikolai Kosjar2018-10-151-4/+5
| | | | | Change-Id: I82b8f4fc72614f6671815e3b1dbfad87a062ae98 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Remove hard-coded disabling of debug logsOrgad Shaneh2018-10-133-3/+3
| | | | | | | | | | | Instead, set the default level of all logs to QtWarningMsg. The call to setFilterRules overrides the user preferences in qtlogging.ini. Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Clang: Remove explicit ClangHoverHandler::ClangHoverHandlerNikolai Kosjar2018-10-112-5/+0
| | | | | Change-Id: I131504e8f31210a928a802ad7c5dc069ac11b2f3 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Don't remove __cplusplusMarco Bubke2018-10-101-0/+1
| | | | | | | | | | | For the indexing we need all tool chain macros. Originally it was a fix because the C++ version of the project part and __cplusplus could be different but now they should be the same. They will be now removed in the compiler options builder. Change-Id: I7ae8721a29632473e76ecedb411a6c9001e5e199 Task-number: QTCREATORBUG-21265 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* CppTools/ProjectExplorer: Remove enum duplicationNikolai Kosjar2018-10-081-1/+1
| | | | | | | | ... between CppTools::ProjectPart and ProjectExplorer::ToolChain. Change-Id: I8b448747e454adbed77547460383b8515462cc81 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang: Fix the crash in function overload completionIvan Donchevskii2018-10-051-1/+1
| | | | | | | Check that the completions container is not empty. Change-Id: I399b8cce42995d758013441d2d3d9f3d8156dc06 Reviewed-by: hjk <hjk@qt.io>
* Clang: Fix C++ method code completionIvan Donchevskii2018-10-051-5/+13
| | | | | | | | | | | | Clang returns no result type when the virtual method from the base class is called in the same method override in the derived class. This is not a problem for us because it's not a method definition and therefore it does not require special handling. Change-Id: I736989165c1f031dc1937c7935e26da8236d9e9e Reviewed-by: hjk <hjk@qt.io>
* Clang: Move the majority of completion items sorting to ClangBackendIvan Donchevskii2018-10-022-77/+33
| | | | | | | | | | | | | | With this change ClangCodeModel only needs to sort completions by prefix. Also some other optimization have become possible and are implemented here: 1. Getting completions after '{' for constructor overloads by replacing it with '(' inside usaved file. 2. Checking for all overloads requires only previous item check because all Class completions are already sorted to go before all CXXConstructor completions. Since they are not mixed no extra search is required. Change-Id: Ie0187ad96a20857a63c1d71ddec74606b803f572 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Change the way completion fix-its are shownIvan Donchevskii2018-10-023-36/+70
| | | | | | | | Move the completion information to the tooltip and show fix-it icon on the right of such item. Change-Id: I7eff410384104387e547695171e4864760c07fb9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* Clang: Remove project tracking on clangbackend sideNikolai Kosjar2018-09-2612-179/+31
| | | | | | | | | | | | ...as it is not needed. Just provide the compilation arguments as part of the Document. As a side effect, re-initializing the backend after a crash is cheaper and will not freeze the UI anymore (referenced bug). Task-number: QTCREATORBUG-21097 Change-Id: I866e25ef1fd5e4d318df16612a7564469e6baa11 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Merge remote-tracking branch 'origin/master' into 4.8Eike Ziller2018-09-261-5/+9
|\ | | | | | | Change-Id: Iaad349302545619f5299fbab26aff11790ca122e
| * Clang: Fix compile commands generation for large projectsOrgad Shaneh2018-09-251-5/+9
| | | | | | | | | | | | | | | | | | ...such as Qt Creator. Avoid storing the entire JSON in-memory. Instead, write as you go. Change-Id: Ie298af546b25d80813a75d8dc09f3244488b8658 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* | Clang: Remove unused functionNikolai Kosjar2018-09-241-1/+0
|/ | | | | Change-Id: I78743489c6b5dc617c4a9966e83d3bf987707bc9 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Clang/CppTools: Replace Q_DECL_NOEXCEPT with noexceptOrgad Shaneh2018-09-202-2/+2
| | | | | Change-Id: I105a5ed5e4a5c647f947a413ae8123d02bfdae3f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Add compiler name to each compilation database entryIvan Donchevskii2018-09-191-1/+3
| | | | | | | In all examples there's a compiler as a first argument. Change-Id: I37ec4073254d68f29357e9b2447a035a1b15e02f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Merge remote-tracking branch 'origin/4.7'Eike Ziller2018-09-191-2/+2
|\ | | | | | | | | | | | | Conflicts: src/plugins/qnx/qnxrunconfiguration.cpp Change-Id: I6069e6a644c6d50c3d2821d51c368129b6957017
| * Clang: Fix possible out of bounds access in ClangFollowSymbolIvan Donchevskii2018-09-181-2/+2
| | | | | | | | | | Change-Id: I80132dca9c26a54059f2c1ba872b102df8e6e0d7 Reviewed-by: hjk <hjk@qt.io>
* | Clang: Skip built-in includes when exporting the compilation databaseIvan Donchevskii2018-09-171-1/+4
| | | | | | | | | | | | | | We don't want to have compiler-specific paths there. Change-Id: If26434ea3760d4f2ca4c25bbcf0340f4ea781072 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | ProjectExplorer: Remove HeaderPath::isFrameworkPathTobias Hunger2018-09-131-1/+1
| | | | | | | | | | | | | | None of the other types has a query function, so remove this one, too. Change-Id: I936d162e092c8f9361b0e3bb86676e68905d2f4b Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | ProjectExplorer: Rename IncludePathType to HeaderPathTypeTobias Hunger2018-09-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | It is the type used by the HeaderPath class, so reflect that in the name. I also considered to rename HeaderPath to IncludePath, but that name is reflected in a lot of users, which would also need to be adjusted for consistency. That would blow up the patch size for little value IMHO. Change-Id: I51421dbd3ab8b2874dc32fc82dc394c9b93ce5e9 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | Highlighting: Add highlighting style for punctuationIvan Donchevskii2018-09-132-1/+4
| | | | | | | | | | | | | | | | | | Currently only operators have their own style but not punctuation tokens. Make possible to highlight both. Task-number: QTCREATORBUG-20666 Change-Id: I9533e0f1bef65b86c4e4f5c9756571103584124b Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | Clang: Enable follow symbol for 'auto' keywordIvan Donchevskii2018-09-121-1/+3
| | | | | | | | | | | | | | | | | | It will follow to the Type which is deduced from auto or to the pointee type if auto is deduced to pointer. Task-number: QTCREATORBUG-17191 Change-Id: I57db3f9b68c3da861691ab148fe39774ad5fceec Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | Add system include path to HeaderPath and merge ProjectPartHeaderPathMarco Bubke2018-09-104-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | System include paths are appended after other includes by the compiler. So we should set them as system includes and not as normal includes. Otherwise we change the include order. Headers in system include paths are not cluttering the screen with unwanted warning and by the way improve performance too. ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them. Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* | Clang: Fix completion after '{'Ivan Donchevskii2018-08-301-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up fix for 8d0391a4f9. Do not complete after '{' coming not after an identifier. Take constructor completions only for '{' and function completions only for '('. Filter constructor completions by class/struct type. Task-number: QTCREATORBUG-21004 Change-Id: I7ae2d6bee23cf907648c42b93eb12742942833f6 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | Clang: Do not replace class completion with constructor completionIvan Donchevskii2018-08-296-5/+39
| | | | | | | | | | | | | | | | | | Both completion kinds have the same name. Do not merge them together when looking for constructor overloads. Task-number: QTCREATORBUG-21010 Change-Id: I4c851033d63ad4e242b6179491f1fba00af466f6 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Clang: Fix include paths orderIvan Donchevskii2018-08-271-56/+4
| | | | | | | | | | | | | | | | | | | | C++ include paths should come before Clang include folder. Therefore parse all options for include/c++/v1, include/c++/{version}, include/g++ and /usr/local/include. Task-number: QTCREATORBUG-20231 Change-Id: I22c41f07d241e1e564069bb192d4fe637ff05e87 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | Clang: Treat brace initialization as constructor completionIvan Donchevskii2018-08-216-16/+32
| | | | | | | | | | | | | | | | | | Try to complete constructor after left brace with fallback to normal completion. Task-number: QTCREATORBUG-20957 Change-Id: I6c33790a3ee1e623a3d8abe9a44cfd821b6f3106 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* | Fix references to the clang code model documentation fileChristian Kandeler2018-08-203-3/+3
| | | | | | | | | | | | | | Was forgotten in 7ab07a4e8f. Change-Id: I2c6d21b79658e3946eb6ecdcf7b11992c0bf865e Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Clang: Fix menu button text capitalizationIvan Donchevskii2018-08-201-2/+2
| | | | | | | | | | Change-Id: I771cbaebbb801665e96cc3d6ea337ebe15872803 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>