aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/cplusplus/Parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* CPlusPlus: Support "typename" in template template parametersChristian Kandeler2025-09-171-1/+1
| | | | | | | This is allowed in addition to "class" from C++17 on. Change-Id: Ib77ea503ecbcad187727d38c3f222ab5c043ea6b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing constant template parameters with default valueChristian Kandeler2025-09-031-1/+1
| | | | | | Task-number: QTCREATORBUG-22954 Change-Id: Iba42b7bf85e527e0569af5a4a0c08552882b358e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix pretty-printing of constrained function parametersChristian Kandeler2025-09-011-0/+1
| | | | | | | | | | | | | | | This consists of three parts: 1) Fix parsing of contrained types. In a declaration func(MyConcept auto p); the parameter p was mis-parsed as a type name. 2) Properly handle the resulting AST so that a constrained parameter gets the right type. We re-use NamedType and combine it with the "auto" flag. 3) Teach the TypePrettyPrinter to handle such types. Task-number: QTCREATORBUG-33005 Change-Id: I2c6e3a64a2b9fb3d294a580fbc43ceb80f5d75e1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add null pointer checksChristian Stenger2025-08-291-2/+2
| | | | | Change-Id: Ic588084caaa6428e6ad57492e0a1ea6c48ba4377 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Teach the parser about __int128Christian Kandeler2025-08-281-0/+1
| | | | | | | | Otherwise, we stumble over header files where this built-in type is used in conjunction with unsigned. Change-Id: Ia3e0c31874901454ff70b3d541442975df66e238 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add parser support for consteval-ifChristian Kandeler2025-08-281-0/+29
| | | | | Change-Id: I076989cc196124d8c75b80586f382a0b97956fd2 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing simple template namesChristian Kandeler2025-08-281-0/+2
| | | | | | | | ... following a "template" keyword after e.g. a nested name specifier. We erroneously allowed only template ids there. Change-Id: I9981f6b67d1d3c2352482b880007cd099bbd6b7e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add parser exceptions for built-in type traitsChristian Kandeler2025-08-281-2/+27
| | | | | | | | | | | | | In header files of compiler vendors, we find constructs such as this one: template<typename T> requires __is_enum(T) struct E {}; This is rightfully rejected by our parser, as non-parenthesised function calls are not allowed in a requires clause. However, as compilers apparently have special handling for these built-in type traits, we behave the same way as not to needlessly stumble over library headers. Change-Id: Ib3199711dab706b8e27412f91f16f95748a1e3bb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing the noexcept operatorChristian Kandeler2025-08-271-1/+4
| | | | | | | Amends 158b07c9c84c8bcd77620f36fe6f1e3eb8d7f224. Change-Id: I039c7b1ea80eb63928f4e53f45b3b4756d9c35b5 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CplusPlus: Add parser support for char8_tChristian Kandeler2025-08-271-0/+2
| | | | | Change-Id: I13534e9cc6dfc3ffd4dbff516f65f6b6d4aa6805 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Support placeholder type specifiers in return typesChristian Kandeler2025-08-271-17/+28
| | | | | Change-Id: I78c818dda319f160340c7d4014ccba3932f82619 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Support explicit object parametersChristian Kandeler2025-08-271-0/+4
| | | | | Change-Id: I9324ee2dbf34fc15ea4573a7c13359611b313f10 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Support fold expressionsChristian Kandeler2025-08-271-3/+124
| | | | | Change-Id: Iaae3288e53c43f1fceac6d9cb8dd042fb3ae96ca Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing of attributes appearing after an operator nameChristian Kandeler2025-08-271-0/+10
| | | | | Change-Id: Iff083edb79d83a1cea15b8f2f6fd8c0c97efc7b1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing of friend declarations with simple type specifierChristian Kandeler2025-08-261-5/+9
| | | | | Change-Id: I2b971cf0defcaf268fc2ed5742bb2f79e7b58022 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add parser support for template deduction guidesChristian Kandeler2025-08-261-4/+51
| | | | | Change-Id: Ia5c6be3b165dfde10653da8d8015f2893229e378 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add null pointer checkChristian Stenger2025-08-261-1/+1
| | | | | | | Amends 197458af34babe8585cd9bfebc9ce5a10c2c52d2. Change-Id: I704c3f52aecac1942db31d0bdf2f9adf48c65640 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* CPlusPlus: Support the single-parameter variant of static_assert()Christian Kandeler2025-08-251-2/+4
| | | | | Change-Id: Icb7cdd88f7769948f1c25f9412f0c57d3e1a58d0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing a trailing requires-clauseChristian Kandeler2025-08-251-2/+2
| | | | | | | | The way that was implemented prevented it to appear in a defaulted or deleted function. Change-Id: Ie010569f8a045e149a4763816baa7192afc760de Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parse error in requires-clauseChristian Kandeler2025-08-251-1/+2
| | | | | Change-Id: I19689ce5745c8bc33b70af27bda2e21c2145372b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix backtracking when parsing template declarationsChristian Kandeler2025-08-131-1/+4
| | | | | Change-Id: Ia042d5299e50a619a5bd5c47d71089726bc5ec9b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parsing compound requirementsChristian Kandeler2025-08-131-0/+3
| | | | | | | The "->" part was forgotten. Change-Id: I507e06607d08dd69673f890b9530e8dda1a37952 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Support specifying base classes via decltype()Christian Kandeler2025-08-131-3/+10
| | | | | | | This has been allowed since C++11. Change-Id: Idb88fea4e0b196902412f684780bb7caf2301873 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Add proper support for defaulted and deleted functionsChristian Kandeler2025-08-061-0/+19
| | | | | | Fixes: QTCREATORBUG-26090 Change-Id: If9946b5b635ba224abd0471f44e2223cf6fa030f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Store concept name as QualifiedNameASTChristian Kandeler2024-12-101-2/+3
| | | | | | | | | This simplifies the code and improves handling of nested template type parameters in some contexts. Fixes: QTCREATORBUG-32079 Change-Id: Ifb28fc19ab3cb1747df097589027bb8e33cf037a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/15.0'Eike Ziller2024-12-021-10/+14
|\ | | | | | | Change-Id: I13e6beb4741be5aa79b2798aa6b674e45ad109f2
| * CPlusPlus: Add missing error check to parseExpressionStatement()Christian Kandeler2024-11-291-10/+14
| | | | | | | | | | | | Fixes: QTCREATORBUG-32043 Change-Id: Ic4f1716339d1277d0a2d5a237fd6ae0389ed2485 Reviewed-by: hjk <hjk@qt.io>
* | CPlusPlus: Add support for init statements in range-based for loopsChristian Kandeler2024-11-061-0/+12
|/ | | | | | Fixes: QTCREATORBUG-31961 Change-Id: I2002c0248e8f853ba5dae555b6a4cf9f6e91af9c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/14.0'Eike Ziller2024-08-091-10/+9
|\ | | | | | | | | | | | | | | Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs Change-Id: I00c2cdccf7f2fa9203d1018e90511133b2e08310
| * CPlusPlus: Allow empty initializer lists in placement newChristian Kandeler2024-08-081-1/+1
| | | | | | | | | | | | Fixes: QTCREATORBUG-30798 Change-Id: Ib9945e4e721aca5f88665bd8a289ae3c54c69e65 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
| * CPlusPlus: Allow empty argument list in member initializationChristian Kandeler2024-08-071-10/+9
| | | | | | | | | | | | Fixes: QTCREATORBUG-30797 Change-Id: I6de0f05e071a5e73317d7a8e3d035e23e23a41aa Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Add parser support for declarations of user-defined literalsChristian Kandeler2024-08-071-6/+13
|/ | | | | | | ... without a space before the identifier. Change-Id: I977ffae82eb86f5ae6ea594cba17cc486e63bf6c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix parser crashChristian Kandeler2023-11-241-2/+2
| | | | | | | | | The parseCompoundStatement() function can return without setting the output parameter if the maximum statement depth is exceeded. Task-number: QTCREATORBUG-29847 Change-Id: Ifd76cd948c30498863246a1b80bd0657950101ca Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Fix crash on weird-looking constructChristian Kandeler2023-08-181-0/+5
| | | | | | | | | | | This was misparsed as a function with an initializer (e.g. "= default"), and then the empty id caused trouble later on. Fixes: QTCREATORBUG-29386 Change-Id: I85a35db544e11ad85f50e3a15b1a071b36e79cd0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* CppEditor: Revert changes to parseExpressionStatement()Christian Kandeler2023-05-261-12/+22
| | | | | | | | | | | | | Amends c8f29b9e0148202ab1959466e14fa23411fd8214. It turns out that there are contexts where we want to parse an expression statement even with the semicolon missing (e.g. completion on incomplete code). So leave the existing functions unchanged and do the thorough check afterwards in parseIfStatement(). Change-Id: Id6209ef1abfe9d155c5b9381e6ae655cc721feb2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CppEditor: Add support for init statements in if conditionsChristian Kandeler2023-05-251-6/+21
| | | | | | Fixes: QTCREATORBUG-29182 Change-Id: I9b7969da694b368236246123ad0028d8e754e903 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add parser support for generic lambdasChristian Kandeler2023-03-131-2/+28
| | | | | | Change-Id: Id17975a4296925c10b1b43f963412eea61ccfa5d Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Add support for coroutinesChristian Kandeler2023-03-061-18/+59
| | | | | | | | | Also fix some concept-related bugs uncovered by the test case. Change-Id: Ia67c971026bcd85d9cc252f46cd4f56c2865d432 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>
* CPlusPlus: Support requires clause in parserChristian Kandeler2023-03-031-0/+18
| | | | | | | Change-Id: Ice6a7a287453516a1cfc296e2c9f16160b3ea130 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>
* CPlusPlus: Handle C++20 concepts in parserChristian Kandeler2023-02-281-1/+184
| | | | | | | Change-Id: I8c6b8b1ba3f36b83cd1d667bec9830271147b1ac 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>
* Cpp: support space ship operator in lexerDavid Schulz2023-01-301-18/+21
| | | | | | Fixes: QTCREATORBUG-27503 Change-Id: Idbff5a9b5b2e6e841e298ca6f706ef3c6aa1622b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* CPlusPlus: Allow " = default" also on function implementationsChristian Kandeler2022-10-241-1/+1
| | | | | | | | | | | Note that we only make sure not to trip over valid code; we make no effort to check whether default/delete is actually allowed at this type of declaration. Fixes: QTCREATORBUG-28102 Change-Id: Ic693319b9dfaf8652cf4cae9cd907a6e258ad773 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* CPlusPlus: Remove unused parser functionsChristian Kandeler2022-10-211-50/+0
| | | | | | | | | | It's unclear whether they should actually be used, but right now their presence is confusing. Change-Id: I15d8a7a2524c3abc668bcd0a4b3e0e956f68b065 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>
* CPlusPlus: Fix mis-parsing array-related constructsChristian Kandeler2022-08-251-18/+25
| | | | | | | | | | | ... as structured bindings. Also add a safety check to Bind that might be needed for invalid code. Amends ca00b874a7. Change-Id: I7b174b80ad97ed7424f1e369b876c99acf7e95d2 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>
* CPlusPlus: Support structured bindingsChristian Kandeler2022-08-231-0/+42
| | | | | | | | | | While we do recommend clangd for modern code bases, we should still be able to parse basic language constructs. Fixes: QTCREATORBUG-27975 Change-Id: I189b991685a5cd5f62f2afce77878b60c895e8f9 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* CPlusPlus: Increase maximum statement depthChristian Kandeler2021-04-201-1/+1
| | | | | | | | | | We're hitting the limit in a real-world project. (Of course, it's pretty horrific that we unconditionally access pointers that can legally be null, but that's difficult to change now.) Fixes: QTCREATORBUG-25606 Change-Id: I1d8c883550e8968bbfa6ce26965573697774361f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Merge remote-tracking branch 'origin/4.14'Eike Ziller2021-01-121-0/+2
|\ | | | | | | Change-Id: I26a53ef81a54a2f7aa482448118298895b712941
| * CPlusPlus lib: Add support for BINDABLE in Q_PROPERTYLeander Schulten2021-01-081-0/+2
| | | | | | | | | | Change-Id: I8ca00aff63261eea997267d41b12c2397d676748 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* | CPlusPlus: Support C++11 attributes also for function parametersChristian Kandeler2020-11-121-0/+5
| | | | | | | | | | | | Fixes: QTCREATORBUG-24636 Change-Id: I9dc3d2cc6ca102b09f6b040455fa901c362dae7d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* | CPlusPlus: Expose "static" specifier also for function declarationsChristian Kandeler2020-11-111-0/+3
| | | | | | | | | | | | | | | | | | | | To be able to do this, the parser needs to store the decl specifier list in FunctionDeclaratorAST objects, the same way it is done for FunctionDefinitionAST. Task-number: QTCREATORBUG-24894 Change-Id: I475fb08b1f14c63f3050d72dff200c1b08df5789 Reviewed-by: Christian Stenger <christian.stenger@qt.io>