Commit Graph

1327 Commits

Author SHA1 Message Date
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
chrchr-github 838b6b86e3
Fix #11862 FN constParameterPointer with increment (#5291) 2023-08-08 10:38:03 +02:00
Oliver Stöneberg dcdf67a694
some `-Wdouble-promotion` Clang compiler warnings (#4820) 2023-08-07 20:44:25 +02:00
Oliver Stöneberg e38a031ae6
ValueFlow: pass `SymbolDatabase` by reference into `ValueFlow::setValues()` (#5295) 2023-08-07 18:41:50 +02:00
Oliver Stöneberg 77c479a6c4
pass `TokenList` as reference into `ValueFlow::setValues()` (#4868)
This avoid lots of unchecked pointer dereferences.

There was a single case which checked it and that looked like a
leftover. The only way this might have been a `nullptr` pointer was
through several default constructors which were not used at all so I
removed them.
2023-08-04 18:17:27 +02:00
chrchr-github faf8047050
Fix FP truncLongCastReturn on Windows (#5262) 2023-08-02 12:27:29 +02:00
Oliver Stöneberg 45de338f1b
cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
2023-08-02 10:36:17 +02:00
chrchr-github d2546d5252
Fix #11788 False positive: unreadVariable in else (#5248) 2023-07-18 21:11:03 +02:00
chrchr-github e4827cb3df
Fix #11828 False positive when getting a span via an out argument (#5243)
We didn't warn for the TODO even before this change.
2023-07-15 17:53:40 +02:00
chrchr-github dde45455bf
uselessOverride: Detect code duplication in overriding function (#5219) 2023-07-05 22:58:01 +02:00
chrchr-github 7507d400de
Fix regression: wrong array size (#5194) 2023-06-26 06:51:01 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
chrchr-github 78c7e3351f
Fix #11697 FP negativeContainerIndex after index is validated (#5172) 2023-06-20 10:55:14 +02:00
Daniel Marjamäki 38b2c5ee3f
Fix #11777 (False positive: uninitialized variable, handling 'false ||' in valueflow) (#5169) 2023-06-17 21:08:22 +02:00
Daniel Marjamäki b462d070bf Minor tweaking of constness 2023-06-15 19:41:47 +02:00
Daniel Marjamäki 1c28457d2c
ValueFlow: Fix uninitvar false positive after initialization '*((int*)&x) = ..' (#5142) 2023-06-10 15:22:17 +02:00
Daniel Marjamäki 3c8caac772
Fix #11688 (FP uninitvar in for loop iteration expression) (#5140) 2023-06-10 09:58:08 +02:00
chrchr-github d4705ca8ab
Fix #10809 cppcheckError Cyclic reverse analysis (#5137)
* Fix #10809 cppcheckError Cyclic reverse analysis

* Handle fixed AST in ValueFlow, fix FN

* Remove
2023-06-10 07:41:52 +02:00
chrchr-github 4dbbae62a7
Fix #11753 FN: invalidLifetime (#5128)
* Fix #11753 FN: invalidLifetime

* Format

* Format

* Only forward for local variables

* Format

* Format
2023-06-08 07:45:59 +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
chrchr-github a32fb63443
Fix hang on huge array (followup to #11649) (#5094)
* Fix hang on huge array

* Fix another hang
2023-05-31 20:56:12 +02:00
chrchr-github 78182d4773
Fix FN constVariablePointer (#5076)
* Fix FN constVariablePointer

* Fix FP

* Add const

* Fix tests

* Add const
2023-05-22 19:53:51 +02:00
chrchr-github 1999bc68bf
Set values when assigning init list (#5057)
* Assign values to pointers with C++11 init

* Handle assigning empty init list

* Fix #10596 FN uninitdata with value initialization

* Fix test

* Set values when assigning init list
2023-05-14 17:01:07 +02:00
chrchr-github dc7550ed9f
Assign values to pointers with C++11 init (#5055)
* Assign values to pointers with C++11 init

* Handle assigning empty init list
2023-05-13 14:09:47 +02:00
chrchr-github 2a0143c8e1
Fix #10358 Bad ValueFlow depending on initialization (#5052) 2023-05-12 07:19:44 +02:00
chrchr-github d3bdb84650
Fix #11701 performance regression (hang) in 2.11dev (#5032) 2023-05-04 11:59:03 +02:00
chrchr-github 100d17df4f
Fix #11681 FN constParameterPointer with std::vector (#5000) 2023-05-04 11:10:58 +02:00
Paul Fultz II 9770dd7e0b
Fix 11673: FP uninitvar when capturing by reference (#4984)
* Fix 11673: FP uninitvar when capturing by reference

* Format

* Fix tests
2023-05-04 06:03:47 +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
Paul Fultz II 86757de4d5
ValueFlow: Add pass runner to check timeout and report time (#4952) 2023-04-30 20:39:05 +02:00
chrchr-github 4fdcb0c784
Fix #11649 Hang in setTokenValue() on huge array (#5010)
* Fix #11649 Hang in setTokenValue() on huge array

* Fix function call
2023-04-25 21:02:49 +02:00
Paul Fultz II 1b9369b78b
Fix 11666: FP returnDanglingLifetime with specializations and ptr to member (#5003)
* Fix 11666: FP returnDanglingLifetime with specializations and ptr to member

* Format
2023-04-23 14:38:28 +02:00
Paul Fultz II 1f0376b32d
ValueFlow: Limit the combinations of arguments passed to subfunctions in normal analysis (#4950) 2023-04-12 22:09:48 +02:00
Paul Fultz II ac14fd218b
ValueFlow: Infer possible symbolic values (#4947) 2023-04-10 19:27:29 +02:00
Daniel Marjamäki 7726a5b5b3
Add a --check-level option (#4942) 2023-04-09 13:48:13 +02:00
Daniel Marjamäki 89a95ddc8f --performance-valueflow-max-if-count: review comments 2023-04-08 13:07:28 +02:00
Oliver Stöneberg 39f94f32f9
valueflow.cpp: fixed selfcheck suppression (#4940) 2023-04-08 12:15:16 +02:00
chrchr-github ab24e3a3c8
Fix remaining example from #11599, FN #11646, fix crash (#4929)
* Fix remainig example from #11599

* Fix FP, new warnings

* More warnings

* Use getTokenArgumentFunction()

* Fix crash

* Fix #11646 constParameter not reported with "const * const" parameter

* Fix test

* Fix new warnings

* Add suppression

* Add const, fix suppression
2023-04-06 18:46:45 +02:00
Paul Fultz II e22a740f0c
Fix 11647: FN knownConditionTrueFalse with strings of same length (#4936)
* Fix 11647: FN knownConditionTrueFalse with strings of same length

* Format

* Remove extra size

* Use simpleMatch
2023-04-06 18:42:24 +02:00
Paul Fultz II edfdfe658a
Fix 11651: FP negativeIndex with for loop (#4934) 2023-04-05 11:05:29 +02:00
Paul Fultz II 115f17cfe6
ValueFlow: Improve the starting point for uninitialized variables to find more uninitialized usages after many conditionals (#4930) 2023-04-04 21:55:09 +02:00
Paul Fultz II 634f5e254f
Fix 11512: FN containerOutOfBounds when empty vector is returned (#4928) 2023-04-02 11:58:04 +02:00
Daniel Marjamäki 2359b9ff82 valueflow: limit valueflow in functions that have many ifs 2023-04-01 20:58:15 +02:00
Paul Fultz II 7231d1cece
Update the isVariableChanged to correctly check the const bit (#4912) 2023-03-26 15:12:49 +02:00
Paul Fultz II fd8a7b9537
ValueFlow: Evaluate if statement for function returns (#4908) 2023-03-24 13:31:26 +01:00
Paul Fultz II cd21f55cdf
Fix 11630 and 11620 lifetime issues (#4913) 2023-03-24 13:29:43 +01:00
Paul Fultz II e1a4a18528
Fix 11609: False positive: Returning iterator to local container 'k' that will be invalid when returning where 'k' is an iterator. (#4907) 2023-03-21 23:18:01 +01:00
chrchr-github 716fcc5e96
Fix crash in valueFlowForwardLifetime() (#4891) 2023-03-18 14:53:49 +01:00