195 Commits

Author SHA1 Message Date
Paul Fultz II
243fa66bd3
Fix 12031: False positive: uninitialized variable () 2023-12-10 19:42:35 +01:00
chrchr-github
4b9f3c68fb
Fix FN uninitvar with increment of struct member () 2023-11-16 18:11:12 +01:00
chrchr-github
26ba29c303
Fix FN passedByValue with index operator and namespaced function call () 2023-10-21 12:41:39 +02:00
Paul Fultz II
f2c8153231
Set the lower and upper bounds for variable that are only incremented or decremented ()
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
Oliver Stöneberg
5e89eb05a6
iwyu.yml: made include-what-you-use output more verbose / cleaned up includes () 2023-10-16 12:57:49 +02:00
Oliver Stöneberg
06b5ef1e4d
cleaned up includes based on include-what-you-use () 2023-10-09 10:07:20 +02:00
Paul Fultz II
e6632d93e3
Fix 11983: False positive: uninitialized variable () 2023-09-13 23:27:08 +02:00
Paul Fultz II
fd12baaf89
Fix 11898: FP knownEmptyContainer () 2023-09-02 14:30:35 +02:00
chrchr-github
8cd61941dc
Unified checks for unevaluated context () 2023-08-23 12:07:47 +02:00
chrchr-github
725c431ecc
Fix FP returnStdMoveLocal / Fix FP incorrectStringBooleanError / Support std::string::starts/ends_with() () 2023-08-21 10:43:54 +02:00
Paul Fultz II
03b952d5eb
Fix 11579: false negative: knownConditionTrueFalse with non-bool as bool parameter ()
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 FN knownConditionTrueFalse with non-bool as bool parameter / string literal to bool conversion in function call () 2023-08-18 10:32:52 +02:00
Paul Fultz II
48c91abba6
Fix issue 11867: Assert failure in valueFlowContainerSize() () 2023-08-13 22:31:38 +02:00
chrchr-github
d4d77edeae
Fix FP uninitStructMember / cleanup from () 2023-08-12 23:46:31 +02:00
Paul Fultz II
9d21379c7d
Add non-const overloads for next(), previous(), and link() ()
* Add non-const overloads for next(), previous(), and link()

* Format

* Add CPPCHECKLIB
2023-05-02 06:55:31 +02:00
chrchr-github
01a22159b8
Fix autoNoType with std::begin() / function returning smart ptr ()
* Fix autoNoType with std::begin()

* Suppress warning for const lambda

* Fix autoNoType with function returning smart ptr

* Handle more complex expression

* Fix scope with auto and smart ptr

* Handle smart pointers and iterators first
2023-04-01 09:38:40 +02:00
Paul Fultz II
d4b030694b
Move some checks for variable changed from constVariable check to isVariableChanged () 2023-03-21 18:16:40 +01:00
Mateusz Michalak
2d5cabed4b
Add std::*begin and std::*end cfg () 2023-03-09 17:06:53 +01:00
Oliver Stöneberg
b70e1d5461
avoid some unchecked pointer dereferences () 2023-03-02 22:05:41 +01:00
Paul Fultz II
346ecdb53a
Improve valueflow after pushing to container () 2023-02-23 18:05:31 +01:00
Daniel Marjamäki
464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg
41849b1a78
generate *.vcxproj file lists with dmake () 2023-01-21 11:55:36 +01:00
chrchr-github
a2fea3d9b4
Fix FP knownConditionTrueFalse with reassigned pointer () 2023-01-18 16:57:22 +01:00
Oliver Stöneberg
1cfe49e340
use const_iterator where possible () 2022-12-30 15:13:47 +01:00
chrchr-github
b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) () 2022-12-18 16:52:04 +01:00
Oliver Stöneberg
29e0133cb5
extracted FwdAnalysis from astutils.{cpp|h} ()
* added missing filtering offiles in Visual Studio project

* extracted `FwdAnalysis` from `astutils.{cpp|h}`
2022-12-13 22:29:23 +01:00
Paul Fultz II
e2f398f81a
Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) ) ()
* Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) )

* Format
2022-12-13 07:52:58 +01:00
Oliver Stöneberg
cff1cd9cda
applied clang-tidy misc-const-correctness fixes for POD types, iterators and references ()
* 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
083efe6361
astutils.h: use pre-sized SmallVector in visitAstNodes() () 2022-09-29 21:52:42 +02:00
Oliver Stöneberg
0481edf9c3
return SmallVector from followAllReferences() () 2022-09-29 21:41:32 +02:00
Paul Fultz II
43caa32abf
Fix 9755: false negative: access of moved variable in conditional code ()
* Fix 9755: false negative: access of moved variable in conditional code

* Format
2022-09-11 12:32:01 +02:00
Paul Fultz II
6ce5c24f21
Refactor knownConditionTrueFalse check and isUsedAsBool function ()
* Refactor knownConditionTrueFalse check and isUsedAsBool function

* Format1

* Format

* Skip assign
2022-09-04 10:24:45 +02:00
chrchr-github
b04bf7396f
Fix New check: Not needed c_str() operation () 2022-08-20 20:52:10 +02:00
Oliver Stöneberg
4bf5dcd29f
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* testlibrary.cpp: no need for `empyString` optimization
2022-08-14 12:44:19 +02:00
chrchr-github
078a6d7804
Fix FP knownConditionTrueFalse with constexpr? () 2022-08-07 19:06:19 +02:00
Paul Fultz II
a2f2699088
Refactor alias check in isExpressionChangeAt into isAlias function () 2022-06-28 22:40:59 +02:00
Paul Fultz II
e735376f7d
Refactor to use AST for isContainerSizeChanged () 2022-06-19 08:17:05 +02:00
Paul Fultz II
de51ebbcf4
Fix 9135: Access of moved variable not detected in loop ()
* 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
chrchr-github
e6f2929fac
Fix FN constVariable with range-based for () 2022-06-03 19:24:59 +02:00
Oliver Stöneberg
cc08a661e6
astutils.h: reserve std::vector space in visitAstNodes() to avoid excess allocations () 2022-06-03 19:21:17 +02:00
Oliver Stöneberg
3d5d2e8fd8
inlined findAstNode() calls () 2022-05-31 13:37:21 +02:00
chrchr-github
7fbb9c7c13
Fix FN constVariable with range-based for loop ()
* Fix  FN constVariable with range-based for loop

* Format

* nullptr check

* Restrict scopes

* Add const

* Undo

* Add more const
2022-05-29 17:06:33 +02:00
Oliver Stöneberg
14421ae627
fail run-clang-tidy in case of compiler warnings / fixed Clang warnings / cleanups () 2022-05-15 12:42:29 +02:00
Paul Fultz II
fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member ()
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +02:00
Oliver Stöneberg
45158ec064
cleaned up includes based on include-what-you-use ()
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
chrchr-github
63d96e49fc
Fix , FP constStatement ()
* Fix ,  FP constStatement

* Fix test cases (first one did not compile)
2022-03-27 07:59:29 +02:00
chrchr-github
e54ad24d2c
Fix FN constStatement with arrays () 2022-03-25 11:32:16 +01:00
chrchr-github
39567ea8c8
Fix FP variableScope (std::for_each with lambda) () 2022-03-22 21:50:46 +01:00
Paul Fultz II
0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified ()
* Fix 10702: FP knownConditionTrueFalse - Member variable modified

* Format

* Make parameter const

* Fix FP

* Fix FP

* Update

* Format
2022-02-28 18:54:55 +01:00
Paul Fultz II
45de9a7d08
Refactor: Use getEndOfExprScope instead of getEndOfVarScope () 2022-02-24 06:50:34 +01:00