Commit Graph

465 Commits

Author SHA1 Message Date
Daniel Marjamäki db155a59c1 Tokenizer: remove simplifyTokenList2 2022-07-18 16:20:36 +02:00
chrchr-github 47c2a01392
Fix #11166 inefficient way to remove last character from std::string (#4267)
* Fix #11166 inefficient way to remove last character from std::string

* Format

* Modify message, add test

* Format

* Fix another warning
2022-07-11 23:07:37 +02:00
Paul Fultz II 2a0b2f538e
Check tokType in match compiler (#4219)
* Check tokType in match compiler

* Set keyword when tokenlist is missing
2022-06-18 21:30:42 +02:00
Daniel Marjamäki 343d04feb4 Tokenizer: Remove simplifyCharAt from simplifyTokenList2 2022-06-12 15:14:48 +02:00
chrchr-github 90392faa2b
Fix crash on nullptr deref (#4189) 2022-06-09 18:25:17 +02:00
PKEuS 1275b5275e
LCppC backport: Various optimizations (#4182)
* Optimization: Use Token::eIncDecOp instead of expensive Token::Match calls

Merged from LCppC.

* Small Optimizations: - Moved a std::set that is only need during initialization of SymbolDatabase to function scope - Use std::vector instead of std::list

Merged from LCppC.

* Optimization: Refactorized various Token::Match calls and surrounding conditions

Merged from LCppC.

* Refactorization: Cleanup usage of std::multimap

Merged from LCppC.
2022-06-08 16:58:57 +02:00
Paul Fultz II e430a11b49
Add debug_valueflow instrinsic to show valueflow values and its error path (#4159)
* Add debug_valueflow instrinsic to show valueflow values and its error path

* Format
2022-06-01 06:53:21 +02:00
Oliver Stöneberg 40bcbd47d6
small `Token::Match()` optimizations (#4154)
* token.cpp: fixed `readability-else-after-return` warnings in `Match()`

* token.cpp: removed some duplicated code from `Match()`

* token.cpp: use `strchr()` instead of loop in `Match()`

* token.cpp: added early exit and removed unnecessary loop condition in `Match()`
2022-05-31 13:52:34 +02:00
chrchr-github 3d3885d151
Add test for #9838 / Remove noisy assert (#4059)
* Add test for #9838

* Remove noisy assert
2022-04-28 15:24:54 +02:00
Daniel Marjamäki 8f386e15fd Remove bug hunting. This feature will be provided in Cppcheck premium. 2022-04-11 07:31:33 +02:00
Armin Müller 7cc45fb393
Typos found by running "codespell" (#3907)
Co-authored-by: Armin Müller <mueller.armin@foestergroup.de>
2022-03-16 15:28:44 +01:00
Oliver Stöneberg 0d336b868c
avoid some Clang compiler warnings (#3896) 2022-03-13 20:07:58 +01:00
chrchr-github 18e00bb4fd
Fix #10817 Crash in checkPassByReference() / #10810 Stack overflow with decltype / #10763 Crash on invalid code (#3840)
* Fix #10817 Crash in checkPassByReference()

* Format

* Fix #10810 Stack overflow with decltype

* Fix #10763 Crash on invalid code in TemplateSimplifier::templateParameters
2022-02-18 12:59:21 +01:00
Paul Fultz II 78228599da
Fix 10800: Hang / memory exhaustion on numerical code (#3822)
* Fix 10800: Hang / memory exhaustion on numerical code

* Format

* Add another test

* Format
2022-02-11 06:52:28 +01:00
chrchr-github cd7532df21
Fix #7709 FN C-style pointer casting with built-in or typedef types /… (#3814) 2022-02-10 20:48:51 +01:00
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 01e14a12f1
Fix 10755: Assertion "!maxValue->isKnown()" from valueFlowInferCondition (#3739)
* Fix 10755: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-22 12:25:20 +01:00
Paul Fultz II 0737cc4d8c
Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition (#3736)
* Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-21 09:56:24 +01:00
Oliver Stöneberg 55ff684f34
added unusedFunction self check to CI / cleanups (#3526) 2022-01-18 22:02:25 +01:00
Paul Fultz II 7b793af451
Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2 (#3721)
* Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-18 14:48:02 +01:00
Paul Fultz II 89bc226738
Fix 10718: Crash in CheckOther::checkDuplicateExpression (#3713) 2022-01-16 12:34:20 +01:00
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings (#3618) 2022-01-04 15:48:08 +01:00
Paul Fultz II c0af66bb52
Fix 10552: Internal error with unusedFunction (#3600) 2021-12-05 15:46:17 +01:00
Oliver Stöneberg ce029f3ea7
token.cpp: optimized Token::multiCompare() a bit - reduces average Ir from 71 to 63 when scanning test folder (#3525) 2021-10-26 08:57:54 +02:00
Paul Fultz II 92eb59981d
Fix 10435: False positive: containerOutOfBounds (#3426) 2021-08-29 15:40:10 +02:00
Daniel Marjamäki f31fbba54a Token::typeDecl: Fix endless recursion for code:
void f()
{
  auto val = val;
}

I did not manage to pinpoint a good location to put a unit test. However this will be tested when daca@home runs the package gcc-avr.
2021-08-26 19:03:35 +02:00
Paul Fultz II 1cd9d0479d
Fix 10433: assertion failure in ValueFlow (Interval::fromValues) (#3419) 2021-08-26 07:46:40 +02:00
Daniel Marjamäki 165d48c846 fix gcc compiler warnings 2021-08-22 18:06:54 +02:00
Paul Fultz II e62cdbb664
Deduce symbolic values from conditions (#3406) 2021-08-19 22:01:55 +02:00
Paul Fultz II e0de48bb1d
Fix 7524: ValueFlow: false path for 'x<3' (#3393) 2021-08-16 09:19:07 +02:00
Paul Fultz II be978b35cf
Add more ValueFlow info in the xml dumps (#3402) 2021-08-15 08:02:31 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Paul Fultz II 3a7ba3cd29
Add symbolic values to ValueFlow (#3367) 2021-07-30 21:29:35 +02:00
orbitcowboy c14bb9cd2e Running astyle [ci skip] 2021-07-26 16:32:00 +02:00
Paul Fultz II f9516cf1c6
Fix issue 10378: FP derefInvalidIteratorRedundantCheck (#3353) 2021-07-24 22:44:18 +02:00
Paul Fultz II 7e70a91613
Improve AST cyclic detection performance (#3330) 2021-07-08 21:13:51 +02:00
Paul Fultz II 5825a35566
Check for cycles in AST when adding nodes to prevent hangs from cyclic ASTs (#3329) 2021-07-07 08:21:35 +02:00
shane a5664c3e49 allow token iteration in range for 2021-06-14 07:39:01 +02:00
Paul Fultz II f90b05ea7c
Show lifetime kind in output (#3285) 2021-06-04 21:41:30 +02:00
Paul Fultz II 486e440c4a
Fix 10298: ValueFlow: Wrong known value, 'x == -1' implicit unsigned cast for rhs (#3277) 2021-06-04 17:17:41 +02:00
orbitcowboy a585834445 Running astyle [ci skip] 2021-06-03 07:35:50 +02:00
Paul Fultz II 3e78e76fe8
Fix issue 10076: ValueFlow: False positive after address of var is taken 'T t = {{{&var}}};' (#3283) 2021-06-03 07:31:46 +02:00
Daniel Marjamäki e73057eb44 Fixed #10275 (ValueFlow: condition 'x>=0 && x < 10') 2021-05-16 10:34:22 +02:00
Daniel Marjamäki 26c0945309 Handle c++20 spaceship operator 2021-04-22 19:15:22 +02:00
Paul Fultz II f605f71e49
Fix issue 10225: false positive: knownConditionTrueFalse (#3196) 2021-04-05 10:20:14 +02:00
Daniel Marjamäki 44f914eaee astyle formatting
ci skip
2021-04-04 18:20:32 +02:00
Paul Fultz II 5077663684
Fix issue 9979: false positive: containerOutOfBounds with conditional resize (#3136) 2021-03-30 14:02:28 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00