summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/PPToken.h
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>
* cplusplus: `PPToken` - introduce move constructorTim Blechmann2021-04-271-0/+4
| | | | | | | | | | | profiling qt-creator on my codebase i saw quite a few instances where reference counting of `QByteArray` showed up in `Preprocessor::handleFunctionLikeMacro` (hundreds of milliseconds of CPU time when profiling for a few seconds). using move semantics we can avoid this source of reference counting. Change-Id: I19a88a0501064f53d8095f7377bf901e462d25a0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Fix lexer crashChristian Kandeler2020-06-181-0/+11
| | | | | | | | | | | | | At some point in the preprocessing stage, some tokens get "squeezed", so their associated string no longer refers to the document content, but only to their own symbol. However, there is at least one context that operated under the assumption that the token's offset still pointed into the "global" string. As the token's offset is zero after parsing, this lead to the same piece of code being preprocessed in an infinite loop. Fixes: QTCREATORBUG-19525 Change-Id: I231ba51811cfa0b5c6dfe7f75fe0384472252c6f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Wholesale conversion to #pragma oncehjk2016-03-301-4/+1
| | | | | | | Kudos to cgmb and https://github.com/cgmb/guardonce Change-Id: Ifa8970734b8d43fd08c9260c645bdb0228633791 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
* 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>
* 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++: Clarify units of a TokenNikolai Kosjar2014-05-151-2/+2
| | | | | | | | | | | | | 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>
* C++: Use more direct approach to recognize special Qt tokenshjk2013-04-191-6/+1
| | | | | Change-Id: I45399a196500cbc6aecedfaa94a50890914906f1 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
* fix include style relating to cplusplus librariesOswald Buddenhagen2013-04-031-2/+2
| | | | | | | | | | | ... 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>
* | C++: fix PPToken equals operator for c-strings.Erik Verbruggen2013-01-111-1/+1
|/ | | | | Change-Id: I37411faa1724fb69467036279b2821e33cad26b5 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
* Adjust license headershjk2012-10-051-0/+29
| | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* C++: Core changes in preprocessingLeandro Melo2012-06-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of most relevant items: - Preprocessor output format change. No more gen true/false. Instead a more intuitive and natural expansion (like from a real compiler) is performed directly corresponding to the macro invocation. Notice that information about the generated tokens is not lost, because it's now embedded in the expansion section header (in terms of lines and columns as explained in the code). In addition the location on where the macro expansion happens is also documented for future use. - Fix line control directives and associated token line numbers. This was not detected in tests cases because some of them were actually wrong: Within expansions the line information was being considered as originally computed in the macro definition, while the desired and expected for Creator's reporting mechanism (just like regular compilers) is the line from the expanded version of the tokens. - Do not allow for eager expansion. This was previously being done inside define directives. However, it's not allowed and might lead to incorrect results, since the argument substitution should only happen upon the macro invocation (and following nested ones). At least GCC and clang are consistent with that. See test case tst_Preprocessor:dont_eagerly_expand for a detailed explanation. - Revive the 'expanded' token flag. This is used to mark every token that originates from a macro expansion. Notice, however, that expanded tokens are not necessarily generated tokens (although every generated token is a expanded token). Expanded tokens that are not generated are those which are still considered by our code model features, since they are visible on the editor. The translation unit is smart enough to calculate line/column position for such tokens based on the information from the expansion section header. - How expansions are tracked has also changed. Now, we simply add two surrounding marker tokens to each "top-level" expansion sequence. There is an enumeration that control expansion states. Also, no "previous" token is kept around. - Preprocessor client methods suffered a change in signature so they now receive the line number of the action in question as a paramater. Previously such line could be retrieved by the client implementation by accessing the environment line. However, this is not reliable because we try to avoid synchronization of the output/environment lines in order to avoid unnecessary output, while expanding macros or handling preprocessor directives. - Although macros are not expanded during define directives (as mentioned above) the preprocessor client is now "notified" when it sees a macro. This is to allow usage tracking. - Other small stuff. This is all in one patch because the fixes are a consequence of the change in preprocessing control. Change-Id: I8f4c6e6366f37756ec65d0a93b79f72a3ac4ed50 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix warning about truncation from size_t to quint.Friedemann Kleint2012-05-071-1/+1
| | | | | | | qstrncmp() takes a quint. Change-Id: I6e11155a793e3a4d9d29861ebb7c7a9c5c2f31c8 Reviewed-by: hjk <qthjk@ovi.com>
* Fix out-of-memory crash when indenting generated tokens.Erik Verbruggen2012-04-231-2/+5
| | | | | | | | | | | | Generated tokens do not have a position in any source file, so not try to indent them. Previously, the 'source' used was the scratch buffer, which would not contain newlines, so the indent depth would be the length of the scratch buffer at that point. Task-number: QTCREATORBUG-7262 Change-Id: If94213d6dffd13dd2b47c7038ec2398ad925d904 Reviewed-by: Yuchen Deng <loaden@gmail.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* preprocessor: make CPlusPlus::Internal::ByteArrayRef publichjk2012-04-191-1/+2
| | | | | Change-Id: Ief6ea71f750b6ba19b650050bae376f4ad82d9d2 Reviewed-by: hjk <qthjk@ovi.com>
* preprocessor: save cycles by using ByteArrayRefhjk2012-04-191-0/+5
| | | | | Change-Id: I339696763b045ef1bda17dd55746738ef4ddbb67 Reviewed-by: hjk <qthjk@ovi.com>
* preprocessor: streamline ByteArrayRefhjk2012-04-191-14/+9
| | | | | Change-Id: Iec09651a6aa2fe3b8a50e631fd2fdc57830892a5 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* preprocessor: provide direct char* overloads for ByteArrayRef::operator==hjk2012-04-181-0/+5
| | | | | Change-Id: I58de7e704bdbd3861a4a534d8080cc2a8399b7eb Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* preprocessor: avoid branches in tight codehjk2012-04-171-8/+13
| | | | | Change-Id: I8dc0910f1cf11e506eb415a6f313b47ad2d41eae Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* preprocessor: make PPToken inlineable.hjk2012-04-171-1/+1
| | | | | Change-Id: Ie86b4ff4a6f1987a15fcc46e8de9db487af1729a Reviewed-by: hjk <qthjk@ovi.com>
* [C++] Rewrite of the preprocessor.Erik Verbruggen2012-03-291-0/+106
This rewrite fixes a couple of issues with the pre-processor. It now supports: - macros in macro bodies - stringification of parameters [cpp.stringize] - the concatenation operator [cpp.concat] - #include MACRO_HERE - defined() inside macro bodies used in pp-conditions. Change-Id: Ifdb78041fb6afadf44f939a4bd66ce2832b8601f Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>