Commit Graph

1472 Commits

Author SHA1 Message Date
Daniel Marjamäki 2cd8ea83a7 Fixed #9860 (unused template not removed properly by default) 2020-11-22 16:43:36 +01:00
Daniel Marjamäki 22d6160624 Improve handling of decltype 2020-11-16 20:11:26 +01:00
Daniel Marjamäki 7878eb2512 AST: Do not generate AST for decltype 2020-11-15 16:47:36 +01:00
Daniel Marjamäki 54a93c4374 Fixed #9452 (FP syntaxError - _Pragma before struct with two constructors) 2020-11-15 15:03:47 +01:00
Ken-Patrick Lehrmann 7c3afa0b36
9955: Fix ast when throwing a cast (#2900)
```
throw (std::string)"Error: " + strerror(errnum);
```
would result in a broken ast:
```
throw
`-::
  |-std
  `-string
```
instead of
```
throw
`-+ 'signed char *'
  |-( 'container(std :: string|wstring|u16string|u32string)'
  | `-"Error: " 'const char *'
  `-( 'signed char *'
    |-strerror
    `-errnum 'signed int'
```
2020-11-15 10:37:29 +01:00
Daniel Marjamäki bfa8c6fb98 Fixed cppcheck warning and corrected checkHeaders test 2020-11-11 15:28:32 +01:00
Daniel Marjamäki c95b0d2a51 Fixed #9977 (Template simplifier does not simplify in header) 2020-11-11 09:50:51 +01:00
Daniel Marjamäki 26e6eed189 Revert "AST: Adjust AST for variable declaration 'char var[] = str;'"
This reverts commit 376860f796.
2020-11-01 11:41:41 +01:00
Daniel Marjamäki 376860f796 AST: Adjust AST for variable declaration 'char var[] = str;' 2020-10-31 17:05:42 +01:00
Daniel Marjamäki 4eb829933e Tokenizer: Fixed unwanted unknownMacro warning for decltype 2020-10-27 09:08:13 +01:00
Daniel Marjamäki 3876b601d5 Fixed #9476 (Tokenizer: report unknown macro) 2020-10-24 22:12:10 +02:00
Daniel Marjamäki c3517924d0 Clang import testing: Compare AST 2020-10-04 11:27:31 +02:00
Daniel Marjamäki f956dee58a Tokenizer: Fixed simplification of parentheses in expression 'a=(b,c);' 2020-09-29 12:06:30 +02:00
Daniel Marjamäki fa42d8c49c Fixed #9920 (Tokenizer: The keyword is not replaced, leads to false positive) 2020-09-28 16:35:50 +02:00
Daniel Marjamäki 2748201d73 Fixed #9782 (Segmentation fault due to broken AST) 2020-09-27 20:41:09 +02:00
Daniel Marjamäki 0ec77879ea Fix crash in createAST when checking wiggle in daca@home 2020-09-26 19:22:24 +02:00
shaneasd 53a0760fdf
Improve ast generation for templated function parameters (#2803) 2020-09-14 18:44:50 +02:00
Daniel Marjamäki e802d85315 Fixed #9445 (Syntax error on typeof word in C) 2020-09-08 17:12:54 +02:00
Daniel Marjamäki c0ef640304 Fixed #9881 ((Regression) Hang with operator() in function call) 2020-09-07 21:32:29 +02:00
Daniel Marjamäki cfd41fea83 Fixed #9879 (Tokenizer: Better handling of operator() '(*this)(...)') 2020-09-07 20:07:21 +02:00
Paul Fultz II ac67049661
Fix issue 9858: Token::astOperand1() cyclic dependency on valid C++ code (#2784) 2020-09-07 10:54:32 +02:00
Daniel Marjamäki 136ac2c643 Fixed #9266 (handle operator() better) 2020-09-06 21:02:06 +02:00
Paul Fultz II cc2bc74084
Track lifetime for lambdas with explicit capture (#2776) 2020-09-05 07:56:01 +02:00
Daniel Marjamäki 12d51ae5c4 Fixed #9809 (Tokenizer; Fix handling of variable declaration with @) 2020-09-02 13:04:33 +02:00
IOBYTE 8774e97f26
fix #9771 (Syntax error; operator != <> ()) (#2757) 2020-08-26 18:39:33 +02:00
Daniel Friedrich 160b8f0f17 Add test case to reproduce bug
Add tokenizer test range based for with decltyle(x) *
2020-08-17 20:51:45 +02:00
Daniel Marjamäki 7e65b561f0 AST: Fix ast for 'for ((..initexpr..);;)' 2020-07-19 11:10:38 +02:00
Georgy Komarov 382f21a5c9
Fixed crash on garbage code: comparisson with an empty second operand
This will fix #9774.
2020-07-18 07:02:12 +03:00
Daniel Marjamäki af6e76d623 Fixed #9787 (Better handling of user defined literals) 2020-06-25 22:06:34 +02:00
Daniel Marjamäki 9b5986505e AST; Improved ast for variable declaration with assignment 2020-06-22 08:34:31 +02:00
Ken-Patrick Lehrmann 7ddb7aef7d 8526: Fix ast construction for ternary operator
This tries to decide a bit more properly when ':' can be part of a
ternary operator. More precisely, there are some times when we want to
delay the construction of the ast for ':', so that it is place
accordingly to the matching '?'.

Typically, this fixes an issue with
`return val < 0 ? throw 1 : val;`,
where the ast for ':' would be constructed during as part of the
`throw`, and the ast for `?` would be invalid.

This patch is a bit of a hardcode, stating that we don't expect ':'
inside a throw, unless there is a complete ternary operator in there
(there can't be a range based for loop, a case in a switch). When we
reach ':', we know we are and the end of the `throw`.
2020-06-14 18:57:18 +02:00
Ken-Patrick Lehrmann 4023a487ff 9768: Fix ast with throw in the middle of return
```
int f(bool x)
{
    return x ? 0 : throw 0;
}
```

The `throw` part was not included in the ast, leading to an invalid
ternary operator.
2020-06-14 14:49:10 +02:00
Daniel Marjamäki d31d778bf4 Fixed #9533 (Syntax Error: AST broken, 'for' doesn't have two operands incrementing pointer in initializer) 2020-06-09 20:57:00 +02:00
Simon Martin 1705d096f7
Simplify empty anonymous namespaces. (#2673) 2020-06-07 13:49:04 +02:00
Ken-Patrick Lehrmann a45c7752a5
9185: Don't syntax error on nested lambdas (#2672) 2020-06-07 08:58:12 +02:00
Paul Fultz II eed2e829a7
Revert "Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list." (#2666)
This reverts commit 187cde183d.
2020-05-30 11:23:22 +02:00
PKEuS 187cde183d Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list. 2020-05-29 21:21:07 +02:00
Daniel Marjamäki f7f26ffe90 Tokenizer: Better handling of c alternative tokens in const method 2020-05-25 15:07:23 +02:00
Ken-Patrick Lehrmann 084529575f
Skip ast validation inside template (#2661) 2020-05-23 21:11:08 +02:00
Daniel Marjamäki 43b58dbc9e Fixed #9729 (AST: lambda with noexcept) 2020-05-22 11:29:10 +02:00
Daniel Marjamäki ac1ceb85b6 AST: improved AST when expression starts with %char% or %str% 2020-05-22 09:35:55 +02:00
PKEuS fb1afe2345 Fixed test suite: Do no longer apply simplifyTokenList2 to token lists, except for those tests that test those simplifications, because checks are no longer run on that simplified token list
Changed failing unit test to TODO tests, as they indicate patterns we do no longer understand properly.
2020-05-20 18:54:16 +02:00
Daniel Marjamäki f5f7cb7ff7 test: Removed AstStyle::Verbose 2020-05-19 18:27:44 +02:00
shaneasd 44a3501f1b
cleanup after #9700 (#2648) 2020-05-19 18:15:05 +02:00
shaneasd 7bfd686f04
Fix #9700 duplicateBranch false positive from missing scope operator :: in ast (#2646) 2020-05-18 19:31:13 +02:00
Daniel Marjamäki 9eda399323 Less strict unknownMacro 2020-05-17 19:12:16 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki 06cb0e99d1 Tokenizer: Fix syntax error when operator* is called 2020-05-04 21:33:30 +02:00