Commit Graph

490 Commits

Author SHA1 Message Date
Daniel Marjamäki 6008bbdfb4 valueFlowContainerSize: Fix wrong value after condition if conditional code escapes 2018-08-11 13:49:42 +02:00
Daniel Marjamäki 10461e5429 valueFlowContainerSize: forward analysis inside conditional code 2018-08-10 22:18:38 +02:00
Daniel Marjamäki 4a502a7f6b valueFlowContainerSize: add simple forward analysis 2018-08-10 22:06:23 +02:00
Daniel Marjamäki 2b10e38eec valueFlowContainerSize: handling of 'v.size() == 10' 2018-08-10 21:43:47 +02:00
Paul Fultz II 3947c23290 Fix issue 8369: False negative: Condition 'condition' is always true (#1325)
* Fix issue 8369: False negative: Condition 'condition' is always true

* Use simpleMatch

* Add iterator header

* Cleanup

* Remove unused variable
2018-08-10 18:05:23 +02:00
Daniel Marjamäki 3805af18a2 valueFlowContainerSize: Fix crash when container pointer is null 2018-08-10 12:53:16 +02:00
Daniel Marjamäki f37434cd1d valueFlowContainerReverse: Fix FPs when there is assignment 2018-08-10 12:26:53 +02:00
Daniel Marjamäki 907f81d059 ValueFlow: Improved analysis of container size 2018-08-10 11:53:56 +02:00
Daniel Marjamäki 81f54f7094 Fixed #8681 (ValueFlow: Container size) 2018-08-10 11:29:16 +02:00
Daniel Marjamäki c666f74755 astyle formatting
[ci skip]
2018-07-25 23:02:16 +02:00
Paul Fultz II f093692551 ValueFlow: Set values in else branch even when the first branch modifies the value (#1309)
* Set values in else branch even when the first branch modifies the value

* Move tests

* Add check for goto

* Remvoe todo

* Also check scope is noreturn

* Use isEscapeScope when variables are changed
2018-07-25 22:59:54 +02:00
Paul Fultz II 9895ea5ff2 Fix issue 470: Condition is always true or false on logical operators (#1294)
* Fix issue 470: Condition is always true or false on logical operators

* Dont warn on literals

* Compute logical operators using valueflow

* Fix FP when using literals

* Always warn on subconditions that are always true

* Use percent matches first

* Add test for logical operators

* Check if parent is null
2018-07-23 08:51:59 +02:00
Daniel Marjamäki 991300ac54 Clarify code with Token::isUnaryOp() 2018-07-14 22:36:08 +02:00
Daniel Marjamäki 1e824330c0 Refactoring: Use range for loops 2018-07-14 22:26:22 +02:00
Daniel Marjamäki 0f3cc56c59 Refactoring: Use range for loops 2018-07-14 13:19:41 +02:00
Daniel Marjamäki d603a811bb Clarify code with Token::hasKnownValue() 2018-07-14 13:09:53 +02:00
orbitcowboy de66eedd54 Improved const correctness of local variables. 2018-05-29 17:33:43 +02:00
Daniel Marjamäki 8e8919e906 Fix comment 2018-05-07 22:06:23 +02:00
Daniel Marjamäki 8c2a5c9813 astyle formatting
[ci skip]
2018-05-06 09:50:53 +02:00
Paul Fultz II 0561877182 Fix false positive with negative array index in issue 8536 (#1202)
* Fix FP with negative array index in valueflow

* Remove values when valueflow fails

* Add valueflow test
2018-05-06 08:35:29 +02:00
Daniel Marjamäki 858e055c0e ValueFlow: Wrote a few basic comments 2018-05-05 23:03:04 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
Daniel Marjamäki dbcdb19b73 Refactoring; Use range for 2018-04-24 18:02:36 +02:00
Daniel Marjamäki 7ee636b934 Refactoring: Reuse isLikelyStreamRead in isVariableChanged 2018-04-18 17:46:10 +02:00
Daniel Marjamäki 7825eb8670 Refactoring; reuse isLikelyStreamRead 2018-04-17 19:51:27 +02:00
Daniel Marjamäki c84628c28a Fixed #8494 (False positive: serialization class overloads operator) 2018-04-17 14:23:04 +02:00
PKEuS d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki c5923fbdd3 astyle formatting 2018-04-09 22:21:17 +02:00
Paul Fultz II d8b3fa5c70 Fix #8482: Regression with valueflow (#1159)
* Fix regression with valueflow

* Simplify test case
2018-04-09 16:13:17 +02:00
PKEuS b15cc3f236 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:54:39 +02:00
Daniel Marjamäki ee5c60e8f6 Refactoring, use early continue 2018-04-08 09:30:13 +02:00
Daniel Marjamäki 795b9f5e0f astyle formatting 2018-04-08 09:25:59 +02:00
Paul Fultz II aed84abfd5 Extend valueflow comparison ops (#1153)
* Handle else clause when doing a compare

* Break early

* Fix bug in checking no return else

* Escape quotes

* Add equal sign

* Simplify the logic
2018-04-08 09:24:01 +02:00
Matthias Krüger 5a104cab6e remove weird "#line 2" from valueflow.cpp 2018-04-06 23:26:08 +02:00
Daniel Marjamäki 3ad6c7ebce Refactoring, use early continue 2018-04-05 08:21:43 +02:00
Paul Fultz II b871c85b67 Improve valeflow analysis with comparison operators (#1131)
* Improve valeflow analysis with comparison operators

* Use simple match

* Dont add 0 on comparisons

* Check reverse comparisons

* Use nullptr

* Remove duplicate code tests
2018-04-05 06:51:31 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
IOBYTE 5bc039b7da Fix #6367 and #8439 (improve sizeof value flow support) (#1132) 2018-03-23 08:28:12 +01:00
Daniel Marjamäki 7699f6432b Fixed #8288 (valueFlowGlobalVar: compound assignments) 2018-03-18 19:53:33 +01:00
Daniel Marjamäki ec6133aea2 Fixed #8182 (False positive uninitvar - variable initialized in function in ternary expression) 2018-03-16 19:13:48 +01:00
Daniel Marjamäki 1628405869 Fix internal warning 2018-02-24 22:35:37 +01:00
Daniel Marjamäki 7701e4594a ValueFlowBeforeCondition: Fix wrong value in do-while condition when there is a break in the loop body 2018-02-24 22:07:34 +01:00
Daniel Marjamäki 69b50b274c Try to make Travis happy 2018-02-11 22:54:14 +01:00
Daniel Marjamäki e62b9bdc77 Fixed #8348 (ValueFlow: wrong Uninit value with abort() in else-branch) 2018-02-11 22:14:44 +01:00
Matthias Krüger f009cfc845 fix some typos found by codespell. 2018-02-04 20:53:43 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 6fd157e93b ValueFlow: Template arguments have 'possible' values 2018-01-11 14:22:27 +01:00
PKEuS c8010fdf42 Fixed crash on garbage code (#8307) 2018-01-07 13:11:56 +01:00
Daniel Marjamäki 8fe4852b98 Refactoring, reuse and improve isVariableChangedByFunction() 2017-11-18 11:02:52 +01:00
Daniel Marjamäki 9191e6f112 Fixed #8246 (ValueFlow: known value, function pointer argument) 2017-11-17 23:04:54 +01:00