Commit Graph

1552 Commits

Author SHA1 Message Date
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
Paul Fultz II 8b1ed9cbe1
Another fix for 10739: internalAstError with decltype (#3738)
* Another fix for 10739: internalAstError with decltype

* Format
2022-01-22 07:22:57 +01:00
Paul Fultz II 57b50e4b00
Fix 10739: internalAstError with decltype (#3723) 2022-01-20 21:36:48 +01:00
Paul Fultz II abb0563cef
Fix 10726: Crash in CheckExceptionSafety::checkRethrowCopy (#3711) 2022-01-16 12:35:51 +01:00
Paul Fultz II 0b1cd8626d
Fix 10664: Crash in Token::linkAt (#3708)
* Fix 10664: Crash in Token::linkAt

* Format
2022-01-14 23:51:01 +01:00
Armin Müller 5a05631c84
Typos found by running "codespell" (#3702) 2022-01-13 17:24:26 +01:00
Paul Fultz II fa651272f0
Fix 10001: Syntax error on valid C++ code (#3697) 2022-01-12 22:04:28 +01:00
Paul Fultz II 7bf0ca8d00
Fix 10672: crash: CheckAutoVariables (#3657) 2022-01-01 00:14:36 +01:00
Paul Fultz II d69257e8cd
Fix 9740: FP accessMoved related to designated initialization (#3644) 2021-12-19 12:36:48 +01:00
Paul Fultz II ac4f4258a0
Fix 10651: Crash on static template method (#3633) 2021-12-16 22:32:44 +01:00
Paul Fultz II 16110b6157
Fix 10339: Lambda in leads to analysis fail (#3629) 2021-12-15 19:34:18 +01:00
Paul Fultz II c0af66bb52
Fix 10552: Internal error with unusedFunction (#3600) 2021-12-05 15:46:17 +01:00
Paul Fultz II 35f14962fc
Regression test for 9523: Syntax Error: AST broken, 'if' doesn't have two operands. (#3602) 2021-12-04 17:03:02 +01:00
Paul Fultz II 29dbded4af
Fix 10615: Crash in Token::linkAt (#3599) 2021-12-04 12:57:59 +01:00
Paul Fultz II bc31419da0
Fix 9301: Syntax error when specializing template variable array (#3601) 2021-12-04 12:56:25 +01:00
chrchr-github ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code (#3501) 2021-11-29 07:34:39 +01:00
chrchr-github 22eeeed17a
Add test for #6342 (#3569)
* Add test for #6342

* Format
2021-11-18 20:25:21 +01:00
chrchr-github 77069d810c
Add test case (#3554) 2021-11-08 20:31:45 +01:00
Paul Fultz II 5c3b69fe96
Fix 10496: crash: endless recursion (symbolDatabaseCreateExprId => isSameExpr => isSameExpr ...) (#3467) 2021-09-25 11:55:49 +02:00
Paul Fultz II edd435d5f0
Fix 10491: Crash in unusedFunction on valid C++ code (#3465) 2021-09-22 13:03:46 +02:00
Daniel Marjamäki 0d31486264 Fixed #10403 (Wrong AST for destructor call) 2021-08-28 22:11:30 +02:00
Paul Fultz II c0765c451d
Fix 10139: AST broken; std::enable_if_t<> (#3424) 2021-08-28 09:28:56 +02:00
Paul Fultz II 422e411b6c
Fix 9444: Syntax error on valid C++14 code (#3403) 2021-08-15 07:43:02 +02:00
Paul Fultz II 6d65f86871
Fix 9245: Synax error on valid C++14 code: AST broken, binary operator '=' doesn't have two operands. (#3400) 2021-08-14 22:50:58 +02:00
Paul Fultz II 818fd248e1
Simplify template keyword bracket (#3399) 2021-08-14 21:16:27 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Paul Fultz II 00eb71fd49
Remove constexpr -> const simplification (#3346) 2021-07-22 07:22:26 +02:00
Paul Fultz II 2300a773e1
Fix 10336: AST cyclic dependency on valid C++ code (#3331) 2021-07-09 07:22:24 +02:00
Daniel Marjamäki 00a9671f46 misra: implement 8.1 2021-07-07 13:34:55 +02:00
Daniel Marjamäki e1cff1d1ef Fixed #10334 (AST: hang with c++ initializer and emplace_back) 2021-06-30 21:40:45 +02:00
Daniel Marjamäki 2a2e071a85 Tokenizer::simplifyAttribute; Set function attribute for function pointer 2021-06-26 14:23:39 +02:00
Paul Fultz II b13e44fce5
Fix 10309 and 10034: internalAstError with init lists (#3303) 2021-06-24 08:25:13 +02:00
Paul Fultz II 6e74fc64b9
Fix 10317: Regression: internalAstError on valid C++ code (#3302) 2021-06-24 08:22:03 +02:00
Daniel Marjamäki 3c3435dd10 Fix bug in Tokenizer::simplifyVarDecl 2021-06-06 08:13:40 +02:00
dummyunit 9652ca39a3
Improve support for labels in simplifyAddBraces step (#3278)
Previously only a single regular label before a compound statement was
allowed in simplifyAddBracesPair() after if/switch/do/while/for.
This patch adds support for:
* case-labels;
* labels before a single statement;
* labels before try/catch blocks;
* multiple consecutive labels.

Additionally the code for skipping a case label was extracted into a
separate function from simplifyLabelsCaseDefault() and reused in
simplifyAddBracesPair().
2021-06-02 07:00:37 +02:00
keinflue 0a84ad874c
Fix case ranges with single quotes and escape sequences (#3248) 2021-05-08 11:24:07 +02:00
Daniel Marjamäki be95e2bf21 Fixed #10271 (AST; Token::astOperand2() cyclic dependency in static_assert) 2021-05-07 13:19:28 +02:00
Daniel Marjamäki b8de69489d Fixed #10079 (AST: switch does not have two operands) 2021-05-04 20:15:57 +02:00
Daniel Marjamäki 2f984b201a AST; Fix wrong AST for initializer list 2021-05-04 19:02:29 +02:00
dummyunit 661ebd3a96
Fix AST for brace initialization after decltype() (#3245)
Currently sub-expressions like decltype(x){} break AST creation for
subsequent tokens in the whole expression. In some cases this triggers
validation checks in validateAst() and analysis on the file stops.
For example, code like this:
    int x = decltype(0){} ? 0 : 1;
currently produces internalAstError.

To fix the issue iscpp11init_impl() was changed to recognize { preceded
by decltype(expr) as a start of C++11 brace initialization expression.
2021-05-03 21:40:49 +02:00
Daniel Marjamäki 70ab30e3c6 AST; Fixed problem with initializer list and cleanup of compileScope 2021-05-03 20:22:08 +02:00
dummyunit ac505afe69
Fixed #9729 (AST broken: lambda with noexcept keyword) (#3243)
The previous fix for the issue (43b58dbc9e) didn't seem to actually fix
it because it added a check for noexcept without a condition, but when
AST is created noexcept always has a condition due to simplification
from "noexcept" to "noexcept(true)" in Tokenizer::simplifyKeyword().
The issue from the ticket couldn't be reproduced neither on 43b58dbc9e
nor on the previous commit, so it is hard to tell whether the fix was
effective or not.

The issue appeared again after a refactoring of AST code in ac67049661.
Test added with the original fix was unable to catch that because it
used testAst() helper function which skips most simplification steps.

To fix the issue we now check for noexcept with a condition and add a
proper regression test that:
1. Uses tokenizeAndStringify() to ensure that all simplifications are
   performed before AST is created.
2. Parses the code snippet from the ticket, as having "if (cond)" is
   crucial to reproducing the original issue (internalAstError).

Also fix AST creation for lambdas that have both constexpr and mutable
keywords.
2021-05-02 21:34:28 +02:00
dummyunit da27159d7c
Fixed #9728 (Support function level try blocks) 2021-05-02 09:05:12 +02:00
Daniel Marjamäki 07c1f28035 astyle formatting 2021-05-01 07:35:03 +02:00
DGarry82 d3035c246f
Attribute lists support (#3239) 2021-05-01 07:33:55 +02:00
Daniel Marjamäki b798b99777 Parser; do not remove alignof and alignas in the same way 2021-04-26 11:44:08 +02:00
Daniel Marjamäki 28a7bb63ec Parser; simplify (break out) init expression from if/switch/range-for 2021-04-25 14:37:27 +02:00
Daniel Marjamäki 4f43dbf954 Parser; fixed ast and auto type deduction for c++17 braced init lists 2021-04-25 10:38:33 +02:00
Daniel Marjamäki c9dc92c266 Parser; C++20 for loop with initialization expression 2021-04-24 11:47:51 +02:00