Commit Graph

136 Commits

Author SHA1 Message Date
chrchr-github 8205b4a4b3
Fix #10572 FP nullPointerRedundantCheck with try/catch / #10701 FP knownConditionTrueFalse with nested try/catch (#5761) 2023-12-13 19:22:54 +01:00
Paul Fultz II 243fa66bd3
Fix 12031: False positive: uninitialized variable (#5637) 2023-12-10 19:42:35 +01:00
Oliver Stöneberg e47300016b
moved some classes/structs into anonymous namespace (#5669) 2023-11-16 15:49:41 +01:00
Paul Fultz II f2c8153231
Set the lower and upper bounds for variable that are only incremented or decremented (#5523)
Also, changed `isExpressionChanged` and `isThisChanged` to return the
token that is being modified and renamed the functions to
`findExpressionChanged` and `findThisChanged`.
2023-10-19 18:42:52 +02:00
chrchr-github 8cd61941dc
Unified checks for unevaluated context (#5362) 2023-08-23 12:07:47 +02:00
Paul Fultz II 03b952d5eb
Fix 11579: false negative: knownConditionTrueFalse with non-bool as bool parameter (#5349)
This adds a new checker to check for pointer to bool conversions that
are always known. I removed the previous knownConditionTrueFalse checks
since this was too noisy.
2023-08-20 22:32:41 +02:00
chrchr-github 827e87afe7
Fix #11579 FN knownConditionTrueFalse with non-bool as bool parameter / #9450 string literal to bool conversion in function call (#5338) 2023-08-18 10:32:52 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
Paul Fultz II 92caa835b6
Fix 11806: FP uninitvar for reference to unitvar in ternary ?: operator (#5247) 2023-07-17 10:34:54 +02:00
Paul Fultz II a2ee32695f
Fix 11530: FP arrayIndexOutOfBounds with array of functions (#5191) 2023-06-25 20:38:44 +02:00
Paul Fultz II 60321edd0d
Fix 11784: FP arrayIndexOutOfBounds when increment is counted twice (#5186) 2023-06-24 20:08:55 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
chrchr-github ac86eda6b3
Revert "Revert "Skip forwarding values for unique expressions (#5103)"" (#5124) 2023-06-07 11:11:48 +02:00
Daniel Marjamäki 7d4472616b Revert "Skip forwarding values for unique expressions (#5103)"
This reverts commit 26ed052e8d.
2023-06-06 17:31:24 +02:00
Paul Fultz II 26ed052e8d
Skip forwarding values for unique expressions (#5103) 2023-06-05 20:49:19 +02:00
Oliver Stöneberg b3016f01a1
fixed some CLion inspection warnings (#4688)
* fixed some CLion "Unused global declaration" warnings

* fixed some CLion "Not implemented function" warnings

* fixed some CLion "Unused struct" warnings

* added TODO

* removed unused parameter reported by CLion

* fixed some CLion "Unused macro" warnings

* fixed some CLion "Condition is always true" warnings and a CLion "The value is never used" warning
2023-04-28 16:02:41 +02:00
Oliver Stöneberg 5be8eee943
iwyu.yml: use a distro which has the latest `include-what-you-use` / enabled Qt mappings / cleaned up includes (#4885) 2023-04-08 16:08:47 +02:00
Paul Fultz II d5e2ee411e
Fix 11578: FP accessMoved with range-based for loop (#4931)
* Fix 11578: FP accessMoved with range-based for loop

* Format
2023-04-03 19:44:47 +02:00
chrchr-github 3ccd0505cd
Enable and mitigate readability-simplify-boolean-expr (#4897) 2023-03-17 13:51:55 +01:00
Oliver Stöneberg 00fd3d92c6
made `ForwardTraversal::mSettings` and `ReverseTraversal::mSettings` references / adjusted some calling code to use references as well (#4858) 2023-03-07 12:26:17 +01:00
Oliver Stöneberg f9c67ef907
fixed `functionConst` selfcheck warnings (#4846) 2023-03-03 11:02:51 +01:00
chrchr-github 215124461e
Fix #11499 FN functionConst with operator usage (#4722) 2023-03-02 21:51:58 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
chrchr-github a102ff3c2f
Fix #11485 FN unusedFunction / Fix #7739 FP unusedFunction (#4707) 2023-01-14 20:16:55 +01:00
chrchr-github a79dff15ab
Fix #11492 FP uninitvar with try/catch (#4711) 2023-01-14 20:14:38 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator (#4653)
* Evaluate args before function call

* Fix tests

* Format

* Add test for 11227

* Format

* Fix known condition
2022-12-18 22:07:43 +01:00
Paul Fultz II 7acbb656f3
Fix 11412: False positive: uninitvar (#4624)
* Dont remove modified variables from dead code

* Add test for 11412

* Format
2022-12-09 07:15:47 +01:00
Daniel Marjamäki 15d3e510e1 ValueFlow: throw TerminateException in valueFlowGenericForward in case analysis is terminated 2022-11-12 12:47:54 +01:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
Oliver Stöneberg eeb6db05f1
avoid some unnecessary object creations and copies (#4493) 2022-09-29 21:47:17 +02:00
Oliver Stöneberg dbc05da356
fixed some clang-tidy warnings (#4435) 2022-09-08 20:01:41 +02:00
Paul Fultz II 3612ddb3f5
Fix unit test failure (#4218) 2022-06-17 07:49:45 +02:00
Paul Fultz II 9cecc8468e
Fix 10570: Improve check; condition then pointer dereference, different pointers (#4216)
* Try to use after assign in loop

* Update valueflow forward to handle init tokens

* Fix tests

* Make test TODO

* Format

* Add tests

* Format

* Fix ubsan error

* Use simpleMatch
2022-06-16 19:26:23 +02:00
Paul Fultz II de51ebbcf4
Fix 9135: Access of moved variable not detected in loop (#4215)
* Fix 9135: Access of moved variable not detected in loop

* Format

* Fix issue with pushing back on container

* Format

* Fix null pointer

* Remove yeild for now
2022-06-16 17:40:09 +02:00
Paul Fultz II bd63534a1c
Fix 10740: valueflow; conditional value. incremented value is oob. (#4208) 2022-06-12 07:16:28 +02:00
chrchr-github 1d677c57a8
Fix #11126 FN: noExplicitConstructor with single default parameter (#4174) 2022-06-07 21:15:13 +02:00
Paul Fultz II d7c914bd3e
Handle subfunction values in valueflow conditions (#4128) 2022-05-29 19:57:10 +02:00
Paul Fultz II 4eed29502c
ValueFlow: Set values to parameters to longjmp and setjmp (#4040)
* ValueFlow: Set values to parameters to longjmp and setjmp

* Format
2022-04-23 06:18:55 +02:00
Paul Fultz II 99757c6d06
ValueFlow: Set values to parameters to escape functions (#3994)
* ValueFlow: Set values to parameters to escape functions

* Format
2022-04-11 07:23:58 +02:00
Oliver Stöneberg 4a63af02ed
enabled functionConst and functionStatic in selfcheck (#3862)
* fixed functionConst findings and enabled it in selfcheck

* fixed functionStatic findings and enabled it in selfcheck

* .travis_suppressions: adjusted comment

* testimportproject.cpp: added missing asserts
2022-03-02 07:46:47 +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
Oliver Stöneberg a2a9c90142
added some missing copyright headers (#3758) 2022-01-26 19:02:20 +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 332f4c205a
Fix 9772: FP uninitvar: in cppcheck 2.1 (#3638) 2021-12-17 21:51:47 +01:00
Paul Fultz II 5f73af0d0e
Fix 10625: False positive: known value below do while (#3623) 2021-12-15 19:32:14 +01:00
Paul Fultz II f64bcac004
Fix 10429: Regression: invalidIterator (#3603) 2021-12-05 15:46:52 +01:00
Paul Fultz II a0d3c2c719
Handle for loop conditions in afterCondition (#3561) 2021-11-14 18:30:36 +01:00
Paul Fultz II 662ada6930
Refactor: Use a template instead of std::function in forward analyzer to help improve debugging (#3551) 2021-11-08 07:46:52 +01:00