IOBYTE
e7bdf5f71c
remove cleanupAfterSimplify from the template simplifier ( #2998 )
...
The template simplifier works well enough now so cleanupAfterSimplify is
no longer necessary. In fact cleanupAfterSimplify was introducing a bug
which improperly simplified C++ style casts.
Bugs should be exposed and fixed properly rather than just hiding them.
Co-authored-by: Robert Reif <reif@FX6840>
2020-12-31 09:33:23 +01:00
Daniel Marjamäki
d024eb3ee0
Fixed #10051 (AST: Wrong ast for function call with initializer list)
2020-12-26 18:33:54 +01:00
Daniel Marjamäki
37a5ec8cd5
Summaries: Moved to its own files
2020-12-20 19:53:58 +01:00
Daniel Marjamäki
96caaedbd5
Generate basic function summaries
2020-12-19 19:02:42 +01:00
IOBYTE
8161baf1e9
fix template debug output line numbers ( #2938 )
2020-12-08 10:35:13 +01:00
Daniel Marjamäki
cbb388d458
Tokenizer: Avoid wrong simplification of template right angle bracket
2020-12-02 20:21:32 +01:00
Daniel Marjamäki
c69bfbf495
AST: Fixed ast for multidimensional array initialisation
2020-12-02 07:38:21 +01:00
Daniel Marjamäki
8a1c16a560
Tokenizer: add daca debug messages when right angle brackets in templates are not handled well
2020-11-29 16:07:56 +01:00
Daniel Marjamäki
7112f69d7b
Fixed bug in fixAngleBrackets
2020-11-29 12:56:13 +01:00
Daniel Marjamäki
fd75837494
Tokenizer: Remove extra 'template' keywords
2020-11-28 21:57:06 +01:00
Daniel Marjamäki
af26697ceb
AST: Generate proper AST for 'f = []() -> foo&& {}'
2020-11-28 06:53:46 +01:00
IOBYTE
1ea89bcad8
add support for template constructors ( #2911 )
2020-11-24 07:21:37 +01:00
Daniel Marjamäki
b4db52bf61
Fixed #9860 (wrong ast for placement new 'new ( uBAR ? uBAR : sizeof ( T ) ) T')
2020-11-23 22:03:50 +01:00
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
Oliver Stöneberg
1af959af2c
fixed -Wextra-semi-stmt Clang warnings ( #2553 )
...
* fixed -Wextra-semi-stmt Clang warnings
* adjusted REDIRECT macro to require a semicolon
* testmathlib.cpp: rolled back accidental change
2020-04-21 17:27:51 +02:00
Daniel Marjamäki
bda73600e0
Tokenizer: Improved removal of unused template ( #9588 )
2020-04-20 20:48:22 +02:00
Zorgovskiy
08fc956990
Fixes issue #9664 ( #2614 )
2020-04-20 08:59:35 +02:00
Daniel Marjamäki
3c56ccc33f
Fixed #9531 (Syntax Error: AST broken, 'for' doesn't have two operands.)
2020-04-19 17:00:22 +02:00
Daniel Marjamäki
98be091d80
Fixed typedef simplification for array of function pointers
2020-04-13 16:28:01 +02:00
Daniel Marjamäki
97b04ba9a7
Syntax check: Using keyword in global scope
2020-04-11 17:36:22 +02:00
Daniel Marjamäki
e8e3c2660d
Detect syntax error 'x ==> y'
2020-04-11 11:05:27 +02:00
Daniel Marjamäki
0725c2290c
Tokenizer: Do not simplify function pointers to normal pointers as we loose important information
2020-04-10 11:53:32 +02:00
Paul Fultz II
40e1e82a65
Fix issue 9644: Token::astOperand1() cyclic dependency on valid C++ code ( #2590 )
...
* Remove check for lambda
* Add test case
2020-04-04 10:55:31 +02:00
Daniel Marjamäki
e0acd1abf8
Tokenizer: Report unknown macro that contains '.x=..' argument
2020-04-04 10:32:56 +02:00
Paul Fultz II
58e3f19ed8
Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code ( #2589 )
...
* Fix issue 9662: AST broken, ternary operator missing operand(s) on valid C++ code
* Add test for issue 9537
2020-04-03 10:04:10 +02:00
Daniel Marjamäki
1173186876
Fixed daca@home crash by stopping for unknown macro 'MACRO(a();b();)'
2020-03-12 13:28:09 +01:00
Daniel Marjamäki
900b99fbd8
Tokenizer; Report unknown macro used in function declaration
2020-03-10 20:22:46 +01:00
Daniel Marjamäki
5376ba1701
AST: Throw validation exception if ternary operator is missing operands
2020-03-07 21:46:38 +01:00
Daniel Marjamäki
5df6d5bc7c
Tokenizer; Warn about unknown macro used in string concatenation
2020-02-28 21:52:01 +01:00
Daniel Marjamäki
38b570138f
AST: Try to handle c++17 for properly 'for (auto [a,b]:c)'
2020-02-27 09:58:53 +01:00
Daniel Marjamäki
e4937ed621
AST: Fixed wrong AST for cast '(std::vector<int>&&)s->second'
2020-02-25 21:05:49 +01:00
Daniel Marjamäki
ef26b55737
AST: Fix wrong handling for '{scope} (expr)'
2020-02-23 15:01:06 +01:00
Daniel Marjamäki
f07a71e3e1
Report unknown macros for pattern '%name% %num%'
2020-02-22 11:57:36 +01:00
Daniel Marjamäki
cf10b1a220
fix ast for expression that starts with number
2020-02-21 21:11:32 +01:00
Daniel Marjamäki
ec8c733afb
Improved Qt simplification
2020-02-21 19:04:21 +01:00
Daniel Marjamäki
388b5118df
Fixed bad ast (wrong result from iscast())
2020-02-21 17:15:33 +01:00
Daniel Marjamäki
6f6f9dd5bc
Tokenizer: Throw unknownMacro in non-executable scope
2020-02-19 21:12:58 +01:00
Rikard Falkeborn
f6e7fb4bd9
Bugfix valuetype for some integer constants ( #2545 )
2020-02-19 07:51:39 +01:00
Daniel Marjamäki
ae0a73a538
Fixed #9618 (isCast flag not set for c++ casts)
2020-02-16 16:46:40 +01:00
Daniel Marjamäki
a350ed9bc2
Fixed #9023 (AST: wrong lhs for a = b + foo(A::Hash{}("")))
2020-02-16 13:58:43 +01:00
Simon Martin
2840173a72
Ticket #9569 : Do not substitute type aliases within enum definitions. ( #2504 )
2020-01-25 10:18:37 +01:00
Simon Martin
224a41361d
Ticket #9572 : Properly detect designated initializers. ( #2496 )
2020-01-25 10:14:16 +01:00
Paul Fultz II
e07801a891
Fix issue 9563: new daca crash: findLambdaEndToken not finding end token ( #2472 )
2020-01-04 10:45:24 +01:00
Daniel Marjamäki
c84ba10b37
Fixed #8774 (Wrong handling of function with name 'or')
2019-12-19 19:22:39 +01:00
Paul Fultz II
ad352daa08
Fix issue 9535: Syntax Error: AST broken, 'if' doesn't have two operands. ( #2450 )
2019-12-16 12:17:01 +01:00
Daniel Marjamäki
f614d32d6a
Fixed #9519 (Syntax error on valid C++ 'enum {} (a)')
2019-12-15 08:40:04 +01:00
RobkeBaer
370196a14c
Fix extern c typedef syntax error ( #2438 )
...
* Fix extern c typedef syntax error
* Fix extraWhiteSpaceError
* Move test from testgarbage to testtokenize
2019-12-12 13:51:14 +01:00
Paul Fultz II
ad2f71338c
Fix issue 9525: Syntax Error: AST broken, 'if' doesn't have two operands inside lambda ( #2433 )
...
* Fix issue 9525: Syntax Error: AST broken, 'if' doesn't have two operands inside lambda
* Fix incorrect matchers
2019-12-10 21:21:07 +01:00
Paul Fultz II
ea2916a3e4
Fix issue 9514: Syntax Error: AST broken, 'for' doesn't have two operands. ( #2429 )
...
* Fix issue 9514: Syntax Error: AST broken, 'for' doesn't have two operands.
* Fix typo
2019-12-07 21:16:25 +01:00
Paul Fultz II
56e17fb228
Fix issue 9524: Syntax Error: AST broken, 'if' doesn't have two operands. ( #2432 )
2019-12-07 21:06:45 +01:00
IOBYTE
f637d97080
Fix 9509 (Syntax error on empty attribute list) ( #2423 )
2019-12-06 05:17:19 +01:00