summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppsourceprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge CppTools into CppEditorChristian Kandeler2021-09-011-521/+0
| | | | | | | | | | | | | | | | 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>
* Add convenience functions for creating ProjectExplorer::HeaderPathsChristian Kandeler2021-08-301-4/+4
| | | | | Change-Id: I7b1f63caca6b70ba4ec1b1870b83cbf20aa6564a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: filepathify TextFileFormatDavid Schulz2021-05-181-2/+5
| | | | | | Change-Id: I6a4e2d38b0bbdec661a4a492901d9182a9f2e502 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Standardize on int for line and column valueshjk2019-07-261-11/+11
| | | | | | | | | | | | | | | Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: modernizeAlessandro Portale2019-01-211-7/+4
| | | | | | Change-Id: Iaf02e4d026f1ac8b216833d83cd7a735e21ff60a Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Remove hard-coded disabling of debug logsOrgad Shaneh2018-10-131-1/+1
| | | | | | | | | | | 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>
* ProjectExplorer: Rename compiler includes from System to BuiltInIvan Donchevskii2018-09-171-3/+3
| | | | | | | | | System include are those used with -isystem keyword, built-in includes on the other hand come from compiler and always follow in the end of the include list (after system includes). Change-Id: I95c2fec36d2e5b43f014fe0a88d59c6769edfa1f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ProjectExplorer: Remove HeaderPath::isFrameworkPathTobias Hunger2018-09-131-2/+2
| | | | | | | 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: Remove HeaderPath::isValid and related codeTobias Hunger2018-09-131-1/+1
| | | | | | | | HeaderPath with an Null path are invalid, there is no need to have a special type for that. Change-Id: Ied102fbe523a8cf17e8b385ee89b099517a6d598 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* ProjectExplorer: Rename IncludePathType to HeaderPathTypeTobias Hunger2018-09-131-4/+4
| | | | | | | | | | | | | 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>
* Add system include path to HeaderPath and merge ProjectPartHeaderPathMarco Bubke2018-09-101-10/+11
| | | | | | | | | | | | | 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>
* CppTools: Replace "\r\n" with "\n" in cpp file contentIvan Donchevskii2018-02-231-0/+1
| | | | | | | | | | | When we get the file working copy it never contains "\r\n" line endings. Let's provide the same behavior when we have no working copy and read the file from disk. Task-number: QTCREATORBUG-19905 Change-Id: I720d62426860dcdcdd8520db5430d9f4f5900ab6 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Convert macros from plain QByteArray to a vector of structsMarco Bubke2017-09-141-10/+11
| | | | | | | | | | | The old code model expected the macros as C++ formatted text ("#define Foo 42) but newer targets like the Clang codemodel expect key value arguments like "-DFoo=42". So instead of parsing the text again and again we use an abstract data description. Task-number: QTCREATORBUG-17915 Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
* Replace a few occurrences of QStringList() << ...hjk2017-02-081-1/+1
| | | | | | | ... by something shorter. Change-Id: I363b4e509adb07997517b2d233246a333aea4aea Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppTools: Add UI for file size limit of indexerNikolai Kosjar2016-08-311-1/+6
| | | | | | | Task-number: QTCREATORBUG-16712 Change-Id: I92db8cbcac9669cbd5e4ee5f7ef6f613797c753a Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* CppTools: Cancel parsing if editor is closedNikolai Kosjar2016-07-291-0/+5
| | | | | | | | | | | | The m_parserFuture.cancel() in ~BuiltinEditorDocumentProcessor() did not cancel anything. Thus, closing a document while the parser was running led to a blocking UI thread. Now it cancels at the next include directive it encounters. Change-Id: I092fddbbd747e0bc95265b6e9b4fcc26b3f76cb3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* CppTools: Fix include/framework search orderFinn Brudal2016-06-221-18/+12
| | | | | | | Task-number: QTCREATORBUG-11599 Change-Id: Ie0bd25e0d6376b5e2c0e251e64aad8dfb773e76e Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* CppTools: Fix include filename cache logicFinn Brudal2016-05-241-21/+18
| | | | | | | | | | | When resolution of a local include fails, a global resolution must be done. When doing so, re-use the cache. This will speed up the resolution for projects that mainly use the local include directives also for global headers. Change-Id: I7488c1977a44b881f90faa863d22f6276c20b147 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
* CppTools: Avoid inserting invalid entries into cacheNikolai Kosjar2016-02-261-1/+2
| | | | | | | | | | | | | | | | ...of resolved files. This is an issue when first a misconfigured project (missing include paths) is indexed. E.g. then <QtTest> resolves to "", which is inserted into the cache. Resolving the same header for subsequent projects has returned the empty string although their header paths were correct. This led to wrong includes of documents from the global snapshot. Task-number: QTCREATORBUG-15736 Change-Id: Ia3e3a06775a50dd75bc62a46d674c7b46a1c5965 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update files in src/plugins Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* CppTools: Move ProjectPart in its own header fileMarco Bubke2016-01-131-10/+10
| | | | | | | | Also extracting inline HeaderPath class and change projects list in vector because the size is larger than a pointer. Change-Id: I885fdff3fe9bccc877634d1615249755f5b674fd Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* CppTools: Allow to limit the files to process by file sizeNikolai Kosjar2015-05-131-1/+5
| | | | | | | | ...with the environment variable QTC_CPP_FILE_SIZE_LIMIT_MB. Task-number: QTCREATORBUG-14390 Change-Id: Iaefaa1a3db023b58f9351b96e1b9e2139797e280 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* CppTools: Remove separate indexing revisionNikolai Kosjar2015-04-241-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | For indexing we used a custom revision that was updated on each modelManager BuiltinIndexingSupport::refreshSourceFiles() call. This could lead to rejection of updated documents triggered by refactoring actions, like for the following case: 1. Open a project containing a.h and a.cpp 2. Open a.cpp, insert some new lines, save and close the document 3. Open a.h and rename a function that is defined in a.cpp --> The refactoring action modifies a.h and a.cpp, so re-indexing of those is triggered. Since a.cpp has already a higher revision (step 2) than the updated document, the updated document is discarded. As a consequence find usages and follow symbol fails for the renamed function. Now the document call back provided to CppSourceProcessor is responsible for updating the document revision based on the latest revision in the global snapshot. Change-Id: I4dfa0a4d34991655acfa749109f00c47b0fbfdbe Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
* Don't mix iterator and const_iteratorKai Koehne2015-04-021-2/+2
| | | | | | | | | | | This avoids unnecessary detaches of the Qt container data. The mismatches where detected by defining QT_STRICT_ITERATORS; however, this define violates the ODR (causing linker errors), and therefore is not added permanently. Change-Id: Idd336a9c8b394214a820437ef1b92d2101f6101c GPush-Base: 62b0848b9cf357bcded4184c71d490bae56c773b Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
* C++: Use correct features for document parsingOrgad Shaneh2015-02-201-0/+7
| | | | | | Task-number: QTCREATORBUG-8007 Change-Id: Ic96aaa433442812a99bac9d16bb9124d66762e8c Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Merge commit '3c85058694ee2e41658d17f524fb48f0b187d2fe'Eike Ziller2015-02-121-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Update LicenseEike Ziller2015-01-161-6/+6
| | | | | | | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* | C++: Finish gcc's include_next supportNikolai Kosjar2014-12-151-10/+24
|/ | | | | | | | | | | | | | | | | This implements the actual include_next logic and thus completes commit b934cc1 C++: pass #include_next down to CppPreprocessor::tryIncludeFile commmit 140b502 C++: Highlight argument to gcc's #include_next extension Based on https://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html Task-number: QTCREATORBUG-10225 Change-Id: I7eef7f5ea64a114f6d092304d32b72c55c2ce134 Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* CppTools: Make use of QLoggingCategoryNikolai Kosjar2014-11-031-3/+4
| | | | | | | ...for document processing and highlighting. Change-Id: I31d42a5a5010260643ec76688080fd14a486f7e3 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* License update.Eike Ziller2014-10-151-7/+8
| | | | | Change-Id: I0acde2c3b995693de682679471f03af85bdd0a61 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* C++: Change QStringList to QSet<QString> to prevent conversions.Erik Verbruggen2014-09-041-2/+4
| | | | | | | | | This eliminates a bunch of list->set->list conversions. Especially the ProjectInfo::appendProjectPart takes lots of time converting for every part added. Change-Id: Ib3c8cd4b0ad6c012ccbeed12ebedd46b9b6cca95 Reviewed-by: Daniel Teske <daniel.teske@digia.com>
* Add copyright commentNikolai Kosjar2014-08-221-0/+29
| | | | | Change-Id: Ia16f38f4823a0d740391ef4450b858d10f3184e5 Reviewed-by: hjk <hjk121@nokiamail.com>
* CppTools: Move WorkingCopy to new cppworkingcopy.{h,cpp}Nikolai Kosjar2014-08-201-3/+3
| | | | | Change-Id: I447acf28849bffb52c1e6b6eafdde221ec0b179e Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Auto-include pre-compiled headersNikolai Kosjar2014-07-241-3/+10
| | | | | | | | | | | | So far the pre-compiled headers were processed (thus defines from those headers were visible), but the actual includes for the documents were not added, which is necessary for lookup/completion. Note that this will be only done if pre-compiled headers are not ignored (Options > C++ > Code Model > [] Ignore pre-compiled headers). Change-Id: I54a8e6b00597af164d958e3e9f2a1075ea187788 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: fix include/framework path handling.Erik Verbruggen2014-07-041-38/+29
| | | | | | | | | | Instead of having two lists of paths, now only one list is used where both include paths and framework paths can be mixed. This reflects the way the compiler is invoked, and retains the (correct) search order. Task-number: QTCREATORBUG-11599 Change-Id: I373953e3e305df5b7a0d10920e12d146584adf9f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* C++: move post-sourceprocessing action into callback.Erik Verbruggen2014-06-181-25/+7
| | | | | Change-Id: Iac6c9fe1ada27ac0d96417e490cc5723e6969541 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* CppTools: Clean up CppSourceProcessorNikolai Kosjar2014-06-041-101/+87
| | | | | | | This mostly makes sourceNeeded() a bit more readable. Change-Id: I8da40090fb499837ec56276e7a4273211920c2d2 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* CppTools: Rename CppPreprocessor to CppSourceProcessorNikolai Kosjar2014-06-041-0/+502
...since it does quite a bit more than only preprocessing, as the name suggests. We use that class to process source files in general. The output is not a preprocessed source, but a set of CPlusPlus::Documents with symbols. Change-Id: I787d0f22f9f042ddf0c99e8c2f0bdb9aa7001735 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>