Commit Graph

2724 Commits

Author SHA1 Message Date
chrchr-github bb327be8e8
Fix #10591 FP unusedStructMember with value-initialized struct and typedef (#3643) 2021-12-18 22:55:52 +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 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
KenPatrickLehrmann f5f600bafc
Don't simplify template for class names in declarations (#3505)
* Don't simplify template for class names in declarations

Without the patch, the test would give:

```
Expected:
namespace foo { class Bar ; } class Baz ; class C : Baz { } ;

Actual:
namespace foo { class Bar ; } class Baz ; class foo :: Bar : Baz { } ;

```

* Use valid code in test case
2021-11-06 19:07:45 +01:00
Oliver Stöneberg cc1a18806c
use -Weverything for clang in CMake / fixed some warnings (#3519) 2021-10-24 11:06:48 +02:00
Oliver Stöneberg 99db1f3f22
fixed some compiler warnings (#3502) 2021-10-13 12:10:26 +02:00
Paul Fultz II fc6a791a74
Fix 9766: False positive; suspicious operator is written in declaration (#3476) 2021-10-03 09:59:51 +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 15eb53b403 Tokenizer: Add 'enum struct' pattern 2021-08-30 20:18:06 +02:00
Daniel Marjamäki ccfd18b96d Simplify Typedef: Fixed typedef simplification in expanded tokens 2021-08-29 19:14:53 +02:00
Paul Fultz II 92eb59981d
Fix 10435: False positive: containerOutOfBounds (#3426) 2021-08-29 15:40:10 +02:00
Paul Fultz II c0765c451d
Fix 10139: AST broken; std::enable_if_t<> (#3424) 2021-08-28 09:28:56 +02:00
chrchr-github d9b6940070
Cleanup: unnecessary includes, fix include order, fix unreferenced va… (#3418) 2021-08-26 19:36:31 +02:00
Daniel Marjamäki ca50dea97d Fix in Tokenizer::simplifyUsing for non-scopes 2021-08-21 10:10:40 +02:00
Daniel Marjamäki d73ab0ad96 Tokenizer::simplifyUsing; Fixed bug when enum class is used 2021-08-20 16:08:01 +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
Daniel Marjamäki d1fe34e167 misra; implement rule 8.10 2021-07-18 21:18:07 +02:00
Daniel Marjamäki 13d55c7060 misra; implement rule 2.3 2021-07-07 15:16:53 +02:00
Daniel Marjamäki 00a9671f46 misra: implement 8.1 2021-07-07 13:34:55 +02:00
Daniel Marjamäki 9172f2ab3b addons; add CTU infrastructure 2021-07-07 10:58:13 +02:00
Robert Reif 68898e2be0
fix #10335 (Type alias remains unknown with using) (#3323)
Co-authored-by: Robert Reif <reif@FX6840>
2021-07-02 06:19:26 +02:00
Daniel Marjamäki 2a2e071a85 Tokenizer::simplifyAttribute; Set function attribute for function pointer 2021-06-26 14:23:39 +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
Robert Reif 3af3d7fc06
fix #10281 (Tokenizer; Wrong simplification for 'namespace ef = :🅰️🅱️:c::d::ef') (#3263) 2021-05-20 08:27:07 +02:00
Daniel Marjamäki 7ba9e37296 unhandled char literal; changed severity to 'portability'. hopefully there will not be warnings for standard character literals. 2021-05-13 13:51:53 +02:00
Daniel Marjamäki fca7a270bf daca@home; show unhandled chars diagnostics 2021-05-13 13:44:32 +02:00
Daniel Marjamäki 895a96f9dd Tokenizer::findGarbageCode: detect wrong struct declaration 2021-05-08 15:28:21 +02:00
Daniel Marjamäki abb4200316 Fixed #10196 ("Unhandled char constant 'x'" with non-standard escape character) 2021-05-08 12:54:18 +02:00
keinflue 0a84ad874c
Fix case ranges with single quotes and escape sequences (#3248) 2021-05-08 11:24:07 +02:00
dummyunit da27159d7c
Fixed #9728 (Support function level try blocks) 2021-05-02 09:05:12 +02:00
Daniel Marjamäki a32d6257d5 Fix Cppcheck self-check, extra whitespace in match patterns 2021-05-01 12:15:54 +02:00
Daniel Marjamäki 9b717b8835 Refactoring __attribute__ simplification 2021-05-01 11:39:26 +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
Robert Reif e1e822275d
fix daca2 paraview crash from uninstantiated recursive template (#3237) 2021-04-29 11:09:51 +02:00
Daniel Marjamäki 8aa9e448f5 Parser; Set varid for structured binding variables 2021-04-26 18:04:27 +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
dummyunit b18e6f1e10
Fix varId assignment for uses of variables declared in the if condition (#3231)
Variables declared in the if condition (or in C++17 init-statement) are
visible not only in the if body but also in the else body. But logic in
Tokenizer::setVarIdPass1() handled such variables as if they were
declared in the if body.

As the result they were removed from variablesMap by the time the else
block was parsed and their uses in the else block were either given an
incorrect varId from variables in some outer scope or not given a varId
at all.

This then resulted in false positive unreadVariable errors for variables
declared in the if condition (or init-statement) and used only in the
else block.

Simplification from "else if ..." to "else { if ... }" was moved before
setVarId() to simplify detection for ends of blocks in if-else chains.
2021-04-26 07:38:03 +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 c9dc92c266 Parser; C++20 for loop with initialization expression 2021-04-24 11:47:51 +02:00
Daniel Marjamäki 26c0945309 Handle c++20 spaceship operator 2021-04-22 19:15:22 +02:00
Oliver Stöneberg 5de58c4ddd
added clang-tidy to CI (#3218) 2021-04-18 21:51:47 +02:00
Daniel Marjamäki 56773b82c4 Simple handling of coroutines 2021-04-18 19:42:22 +02:00