Commit Graph

195 Commits

Author SHA1 Message Date
Paul Fultz II 243fa66bd3
Fix 12031: False positive: uninitialized variable (#5637) 2023-12-10 19:42:35 +01:00
chrchr-github 4b9f3c68fb
Fix #12188 FN uninitvar with increment of struct member (#5665) 2023-11-16 18:11:12 +01:00
chrchr-github 26ba29c303
Fix #12086 FN passedByValue with index operator and namespaced function call (#5574) 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 (#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
Oliver Stöneberg 5e89eb05a6
iwyu.yml: made `include-what-you-use` output more verbose / cleaned up includes (#5540) 2023-10-16 12:57:49 +02:00
Oliver Stöneberg 06b5ef1e4d
cleaned up includes based on include-what-you-use (#5532) 2023-10-09 10:07:20 +02:00
Paul Fultz II e6632d93e3
Fix 11983: False positive: uninitialized variable (#5443) 2023-09-13 23:27:08 +02:00
Paul Fultz II fd12baaf89
Fix 11898: FP knownEmptyContainer (#5394) 2023-09-02 14:30:35 +02:00
chrchr-github 8cd61941dc
Unified checks for unevaluated context (#5362) 2023-08-23 12:07:47 +02:00
chrchr-github 725c431ecc
Fix #11881 FP returnStdMoveLocal / Fix FP incorrectStringBooleanError / Support std::string::starts/ends_with() (#5347) 2023-08-21 10:43:54 +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
Paul Fultz II 48c91abba6
Fix issue 11867: Assert failure in valueFlowContainerSize() (#5317) 2023-08-13 22:31:38 +02:00
chrchr-github d4d77edeae
Fix FP uninitStructMember / cleanup from #5311 (#5315) 2023-08-12 23:46:31 +02:00
Paul Fultz II 9d21379c7d
Add non-const overloads for next(), previous(), and link() (#5002)
* 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 (#4919)
* 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 (#4905) 2023-03-21 18:16:40 +01:00
Mateusz Michalak 2d5cabed4b
Add std::*begin and std::*end cfg (#4796) 2023-03-09 17:06:53 +01:00
Oliver Stöneberg b70e1d5461
avoid some unchecked pointer dereferences (#4811) 2023-03-02 22:05:41 +01:00
Paul Fultz II 346ecdb53a
Improve valueflow after pushing to container (#4803) 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` (#4652) 2023-01-21 11:55:36 +01:00
chrchr-github a2fea3d9b4
Fix #11083 FP knownConditionTrueFalse with reassigned pointer (#4717) 2023-01-18 16:57:22 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
chrchr-github b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) (#4647) 2022-12-18 16:52:04 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` (#4637)
* 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) ) (#4636)
* 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 (#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 083efe6361
astutils.h: use pre-sized SmallVector in visitAstNodes() (#3919) 2022-09-29 21:52:42 +02:00
Oliver Stöneberg 0481edf9c3
return `SmallVector` from `followAllReferences()` (#3925) 2022-09-29 21:41:32 +02:00
Paul Fultz II 43caa32abf
Fix 9755: false negative: access of moved variable in conditional code (#4459)
* 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 (#4432)
* Refactor knownConditionTrueFalse check and isUsedAsBool function

* Format1

* Format

* Skip assign
2022-09-04 10:24:45 +02:00
chrchr-github b04bf7396f
Fix #7515 New check: Not needed c_str() operation (#4371) 2022-08-20 20:52:10 +02:00
Oliver Stöneberg 4bf5dcd29f
cleaned up includes based on include-what-you-use (#4358)
* 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 #11238 FP knownConditionTrueFalse with constexpr? (#4341) 2022-08-07 19:06:19 +02:00
Paul Fultz II a2f2699088
Refactor alias check in isExpressionChangeAt into isAlias function (#4223) 2022-06-28 22:40:59 +02:00
Paul Fultz II e735376f7d
Refactor to use AST for isContainerSizeChanged (#4222) 2022-06-19 08:17:05 +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
chrchr-github e6f2929fac
Fix #11085 FN constVariable with range-based for (#4118) 2022-06-03 19:24:59 +02:00
Oliver Stöneberg cc08a661e6
astutils.h: reserve `std::vector` space in `visitAstNodes()` to avoid excess allocations (#4158) 2022-06-03 19:21:17 +02:00
Oliver Stöneberg 3d5d2e8fd8
inlined `findAstNode()` calls (#4146) 2022-05-31 13:37:21 +02:00
chrchr-github 7fbb9c7c13
Fix #10980 FN constVariable with range-based for loop (#4144)
* Fix #10980 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 (#4036) 2022-05-15 12:42:29 +02:00
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member (#4103)
* 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 (#4007)
* cleaned up includes based on include-what-you-use

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

* Fix test cases (first one did not compile)
2022-03-27 07:59:29 +02:00
chrchr-github e54ad24d2c
Fix #10870 FN constStatement with arrays (#3904) 2022-03-25 11:32:16 +01:00
chrchr-github 39567ea8c8
Fix #8541 FP variableScope (std::for_each with lambda) (#3924) 2022-03-22 21:50:46 +01:00
Paul Fultz II 0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified (#3857)
* 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 (#3855) 2022-02-24 06:50:34 +01:00