summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/ExpressionUnderCursor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace GPL-3.0 with GPL-3.0-onlyKai Köhne2023-01-101-1/+1
| | | | | | | | | | | | | GPL-3.0 is deprecated by SPDX. Change done by find . -type f -exec perl -pi -e 's/LicenseRef-Qt-Commercial OR GPL-3.0(?!-)/LicenseRef-Qt-Commercial OR GPL-3.0-only/g' {} \; Change-Id: If316a498e3f27d2030b86d4e7743b3237ce09939 Reviewed-by: Lucie Gerard <lucie.gerard@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@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>
* endless loop when tokens do not represent a lambdaJasmin Fazlic2021-08-051-2/+2
| | | | | | | | | | | | | Fixes the endless loop when traversing the callstack while debugging and the tokens do not represent a lamda. for example: `return Class{}(var);` Change-Id: I2c4dbf9df24046158147a04347aa435a7ccd02bc Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unused private functionsAlessandro Portale2020-10-081-12/+0
| | | | | | | As found by Cppcheck. Change-Id: I697ea69992425ff41e35990ad00be312b35ba70a Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Clang: Do not show completions after comma in initializer listIvan Donchevskii2019-03-121-1/+1
| | | | | | | | | | Appends 0852f889d1. Do not automatically show global completion when initializer list does not have a type, e.g. auto foo = {{},<cursor>}; Change-Id: I233fef71c60bb79211000df70bf5b04fa2d9df37 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Clang: Treat brace initialization as constructor completionIvan Donchevskii2018-08-211-1/+1
| | | | | | | | | 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>
* TextEditor: Highlight punctuators as TextHugo Holgersson2018-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change limits the set of tokens that fall under Token::isOperator(). That allows cpphighlighter.cpp to distinguish operator tokens from punctuator tokens (without changing any logic in cpphighlighter.cpp). This change moves punctuators from "Operator" to the "Text" style category where they belong. Punctuators are not operators. Punctuators are dumb text tokens. Why don't we let the clang backend alone separate these tokens for us? 1. Clang is slow on big files. Sometimes the highlighting dictated by clang is painted _seconds_ after cpphighlighter.cpp runs. CppHighlighter is way faster so we use it to "prepaint" code while clang is busy in the background. 2. Secondly, clang cannot yet handle all operator types. In particular, none if its "operator cursors" CXCursor_UnaryOperator: CXCursor_BinaryOperator: CXCursor_CompoundAssignOperator: CXCursor_ConditionalOperator: includes the -> and . operators. We still need CppHighlighter to paint those tokens. However, once clang has finished processing the file some operator tokens will be repainted. We need clang to get all operators' semantics. In particular, we need clang to tell us if < is a "smaller than"-operator or part of a template parameter like set<int>. Task-number: QTCREATORBUG-19659 Change-Id: I952cb58f7c79134b3281e2a8221425cc1d0ad263 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
* Update License according to agreement with Free Qt FoundationTobias Hunger2016-01-191-17/+12
| | | | | | | * Update remaining files in src Change-Id: I1896f17fcf34f71c3310c87899fb5171b8e4afb1 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* C++: Accept language features in BackwardsScanner et alOrgad Shaneh2015-02-271-3/+4
| | | | | Change-Id: Id97ca27fa909979573efca12dc0cd14b28eacd17 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
* Update LicenseEike Ziller2015-01-161-6/+6
| | | | | Change-Id: I711d5fb475ef814a1dc9d2822740e827f3f67125 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* License updateEike Ziller2014-10-091-7/+8
| | | | | Change-Id: I3c22ef2685d7aa589f5d0ab74d693653a4c32082 Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
* C++: Use Token::utf16chars{Begin,End} where appropriateNikolai Kosjar2014-05-231-1/+1
| | | | | | | | ...especially in CppTools/CppEditor where the offsets are used with a QString/QTextDocument. Change-Id: Ic6d18fbc01fb9cc899a9bd2d7424cd2edae487f1 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* C++: Clarify units of a TokenNikolai Kosjar2014-05-151-1/+1
| | | | | | | | | | | | | This will avoid confusion when later more length and indices methods are added. In Token: length() --> bytes() begin() --> bytesBegin() end() --> bytesEnd() Change-Id: I244c69b022e239ee762b4114559e707f93ff344f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Incremented year in copyright infoRobert Loehning2014-01-081-1/+1
| | | | | | Change-Id: Ib5423fdd064e4546f848c0b640b0ed0514c26d3a Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Fix coding style for else statementsOrgad Shaneh2013-07-171-4/+5
| | | | | Change-Id: I1309db70e98d678e150388c76ce665e988fdf081 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* C++: code completion for lambda callsPrzemyslaw Gorszkowski2013-07-121-0/+24
| | | | | | | | | | | | | | support for lambdas, e.g.: struct S { int bar; }; []() { return new S; } ()->bar; [] { return new S; } ()->bar; []() ->S* { return new S(); } ()->bar; []() throw() { return new S(); } ()->bar; []() throw()->S* { return new S(); } ()->bar; Task-number: QTCREATORBUG-9523 Change-Id: I43fbf6f0ee0bb11411c53c984df75ef33a276466 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* fix include style relating to cplusplus librariesOswald Buddenhagen2013-04-031-1/+3
| | | | | | | | | | | ... and adjust INCLUDEPATH accordingly. while i'm at messing with include statements, also re-order the include blocks according to policy and sort them within bigger blocks. Change-Id: I7762abfd7c4ecf59432b99db2f424e4fa25733a5 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* Merge remote-tracking branch 'origin/2.6'Oswald Buddenhagen2013-01-311-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in src/plugins/debugger/qtmessageloghandler.cpp src/plugins/debugger/qtmessagelogwindow.cpp src/plugins/madde/maemodeployconfigurationwidget.cpp src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp src/plugins/qmldesigner/designercore/include/widgetqueryview.h src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp src/plugins/qnx/bardescriptormagicmatcher.h src/plugins/qt4projectmanager/profilekeywords.cpp src/plugins/remotelinux/deployablefilesperprofile.cpp src/plugins/remotelinux/deployablefilesperprofile.h src/plugins/remotelinux/deploymentinfo.cpp src/plugins/remotelinux/deploymentsettingsassistant.cpp src/plugins/remotelinux/profilesupdatedialog.cpp tests/auto/icheckbuild/ichecklib.cpp tests/auto/icheckbuild/parsemanager.cpp tests/auto/icheckbuild/parsemanager.h Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
| * Incremented year in copyright infov2.6.2Robert Loehning2013-01-291-1/+1
| | | | | | | | | | Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | Remove braces for single lines of conditionsOrgad Shaneh2013-01-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #!/usr/bin/env ruby Dir.glob('**/*.cpp') { |file| # skip ast (excluding paste, astpath, and canv'ast'imer) next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i s = File.read(file) next if s.include?('qlalr') orig = s.dup s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m| res = $& if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces res else res.gsub!('} else', 'else') res.gsub!(/\n +} *\n/m, "\n") res.gsub(/ *{$/, '') end } s.gsub!(/ *$/, '') File.open(file, 'wb').write(s) if s != orig } Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc Reviewed-by: hjk <qthjk@ovi.com>
* | C++: fix code completion: casting inside parenthesesPrzemyslaw Gorszkowski2012-12-061-0/+2
|/ | | | | | | | | | Included unit tests. Task-number: QTCREATORBUG-8368 Change-Id: I1b04124bc2c9eac050cfb2e6d3a5c1aca5311f4b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* Adjust license headershjk2012-10-051-21/+20
| | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* Contact -> qt-project.orgEike Ziller2012-07-191-3/+1
| | | | | Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Long live the king!hjk2012-01-261-1/+1
| | | | | Change-Id: I2b72b34c0cfeafc8bdbaf49b83ff723544f2b6e2 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
* all: s/info@qt.nokia.com/qt-info@nokia.com/hjk2011-11-031-2/+2
| | | | | Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* cplusplus: remove unneeded declaration and destructorhjk2011-05-301-3/+0
| | | | | | Change-Id: I5177c5d46409225a8debda2e0f78fffdea27b266 Reviewed-on: http://codereview.qt.nokia.com/208 Reviewed-by: hjk <qthjk@ovi.com>
* Fix/add copyright headersTobias Hunger2011-05-061-1/+1
| | | | Change-Id: I8b73d583be1ee7183f4074bce49d5390e38631a2
* Update license.hjk2011-04-131-14/+13
|
* It's 2011 now.con2011-01-121-1/+1
| | | | Reviewed-by: hjk
* License headers.con2010-12-171-7/+11
|
* Removing SimpleTokenErik Verbruggen2010-07-021-4/+4
|
* Removed the TokenCache.Erik Verbruggen2010-07-021-5/+4
|
* Introduced token caching to prevent repetetive tokenizing.Erik Verbruggen2010-06-141-4/+5
| | | | | | Also removed TokenUnderCursor as it's functionality is in the token cache. Reviewed-by: ckamm
* Revert "Introduced a token cache for the C++ editor."Erik Verbruggen2010-06-041-5/+4
| | | | This reverts commit c2393df02332618c8cf6159d9d6f6a40041ced89.
* Introduced a token cache for the C++ editor.Erik Verbruggen2010-06-041-4/+5
| | | | | This should speed things up a bit, because before, the line was tokenized at least 3 times.
* Disabled invalid ObjC++ discovery code.Erik Verbruggen2010-05-281-0/+2
| | | | | Task-number: QTCREATORBUG-1501 Reviewed-by: Roberto Raggi
* Added boundary check.Erik Verbruggen2010-03-121-5/+7
|
* Added bounds check.Erik Verbruggen2010-03-121-1/+1
|
* Long live the king!hjk2010-03-051-1/+1
|
* Fixed scope completion after a template-id. For example, when completing ↵Roberto Raggi2009-12-071-6/+13
| | | | std::list<int>::i...
* Changed ExpressionUnderCursor to handle Objective-C send-message operations.Erik Verbruggen2009-11-111-2/+39
|
* Added scope calculation for Objective-C classes.Erik Verbruggen2009-11-111-0/+2
|
* Initialize ExpressionUnderCursor's _jumpedComma.Roberto Raggi2009-10-211-0/+1
|
* Stop at the T_COMMA when searching backward for an expression.Roberto Raggi2009-10-121-0/+1
|
* Search for `complete' expressions followed by a T_COMMARoberto Raggi2009-10-081-2/+27
| | | | As a side-effect, we can finally complete things like connect(&a, SIGNAL(
* Added BackwardsScanner::mid(tokenIndex). Mid() returns a substring starting ↵Roberto Raggi2009-09-211-1/+1
| | | | from the position of the given token.
* Made the indenter more Qt friendly. Added support for moc keywords.Roberto Raggi2009-09-211-1/+1
|
* Automagically insert matching characters.Roberto Raggi2009-09-171-3/+1
|
* Added the helper class MatchingText and use it to automagically insert text ↵Roberto Raggi2009-09-171-47/+7
| | | | for curly braces.
* Added BackwardsScannerRoberto Raggi2009-09-171-87/+1
|