Commit Graph

111 Commits

Author SHA1 Message Date
Daniel Marjamäki df9df70ba7 astyle formatting
[ci skip]
2018-09-08 09:07:59 +02:00
Paul Fultz II cb03b9883f Fix issue 8737: FP with identical inner condition due to followVar (#1371) 2018-09-07 20:16:38 +02:00
Paul Fultz II b46e25c18e Fix issue 8730: False positive: Opposite expression on both sides of && (#1366) 2018-09-05 18:07:01 +02:00
Paul Fultz II 08f301a0de Reenable followVar (#1363)
Reenable followVar
2018-09-05 05:53:33 +02:00
Daniel Marjamäki 5afb755a3c SymbolDatabase: Fix variable matching 2018-09-04 06:39:02 +02:00
Paul Fultz II 93be440f92 Fix issue 8709: crash with switch statement with followVar (#1362)
* Fix crash with switch statement

* Update comment
2018-09-03 19:54:14 +02:00
Paul Fultz II 0e5fabf4dc Dont follow volatile variables (#1365) 2018-09-03 19:51:48 +02:00
Paul Fultz II 8353f94b93 Fix crashes in followVarExpression (#1358)
* Fix crashes in followVarExpression

* Add a regression test for issue 8717

* Skip reference declarations
2018-09-02 08:28:53 +02:00
Daniel Marjamäki 0a9d417266 add comments 2018-09-01 16:45:14 +02:00
Daniel Marjamäki 3cad3c901f Another patch to temporarily disable the followVariableExpression 2018-09-01 11:39:21 +02:00
Daniel Marjamäki a331206b44 Temporarily disable followVariableExpressions(), there are problems that should be fixed. 2018-09-01 08:32:06 +02:00
Armin Müller b9cd7368f5 Typos found by running "codespell" (#1355)
* Update astutils.cpp

* Update checksizeof.cpp
2018-08-30 19:51:39 +02:00
Daniel Marjamäki 4378327c43 astyle formatting
[ci skip]
2018-08-27 13:48:46 +02:00
Paul Fultz II fc135e1087 Check if member function modifies the variable (#1350)
* Check if member function modifies the variable

* Check for const pointer

* Add test for const condition

* Add more null checking

* Add todo assert for FN
2018-08-27 11:09:09 +02:00
Daniel Marjamäki 212af76367 astyle formatting
[ci skip]
2018-08-18 15:45:50 +02:00
Paul Fultz II fd49112196 Avoid duplicates in the error path (#1346) 2018-08-18 07:32:30 +02:00
Paul Fultz II bbf876256c Add error path to more diagnostics that rely on isSameExpression (#1342) 2018-08-17 09:25:07 +02:00
Paul Fultz II c5154286da Fix issue 8687: false positive with same expression (#1336) 2018-08-13 12:55:41 +02:00
Daniel Marjamäki c3a44ce56b astyle formatting
[ci skip]
2018-08-07 18:06:51 +02:00
Paul Fultz II f603b529df Fix issue 8413: Condition is always false 'i=expr; if (i != expr) {}' (#1295)
* Follow variables when comparing same expression

* Remove assert include

* Dont follow function arguments

* Improve the checking to check more cases

* Add more tests

* Check if the variable is used inside a loop

* Follow both variables

* Only skip loops when variable is modified in scope

* Fix FP when followed variable is modified

* Dont follow arrays

* Skip pointer indirection

* Make recursive

* Improve checking more variables

* Fix test with sizeof

* Skip following operators

* Fix test when using sizeof

* Dont check every step

* Use early returns

* Update test to use a loop instead of conditional

* Add static

* Check variables are global

* Check local variables in another scope

* Fix issue with const pointers

* Distinguish between pointer indirection and multiply

* Use simple match

* Prevent crash with uniform initialization

* Use unary op and ast to detect pointer indirection

* Expand error message when expression do not match exactly

* Add errorpath to issameexpression

* Revert "Clarify warning message for 'Same expression on both sides of operator'"

This reverts commit 0e491b41a8.

* Check if the tokens are the same

* Report the operator and not the expressions
2018-08-07 09:32:16 +02:00
Daniel Marjamäki 1b933f4dd1 astyle formatting
[ci skip]
2018-08-05 22:40:21 +02:00
Paul Fultz II b839ad60dd Fix issue 6856: add checks in isOppositeCond when using == and < or > (#1298)
* Fix issue 6856: add checks in isOppositeCond when using == and < or >

* Move tests to testcondition

* Fix some more tests

* Fix test messages

* Remove the float check
2018-08-05 22:39:40 +02:00
Daniel Marjamäki 1c4fb47582 astyle formatting
[ci skip]
2018-07-15 14:45:33 +02:00
Paul Fultz II 5d1fdf7958 Fix issue 7904: Handle double nots in isSameExpression (#1305)
* Fix issue 7904: Handle double nots in isSameExpression

* Skip checking double nots in assignments

* Use ast to check for double not
2018-07-15 11:30:02 +02:00
Daniel Marjamäki 93903d96c4 Refactoring, use Token::isUnaryOp and Token::isBinaryOp 2018-07-13 18:52:03 +02:00
Daniel Marjamäki 03faa25d12 Conditions: Better handling of function calls 2018-07-08 15:58:04 +02:00
Daniel Marjamäki 593f7eee38 Fixed #8624 (Crash below CheckOther::checkDuplicateExpression) 2018-06-14 22:39:26 +02:00
Paul Fultz II 8d53bcfd63 Fix FP when using non-const members and also check return type of function (#1283) 2018-06-09 08:05:19 +02:00
PKEuS 4d549553b0 Small optimization in checkmemoryleak.cpp: Allow passing literals to addtoken()
Ran AStyle
2018-05-14 10:15:50 +02:00
Paul Fultz II 7ef714b0c6 Fix FP with duplicate assignments by checking if the expression is unique (#1223)
* Fix FP with duplicate assignments by checking if the expression is unique

* Use array of pointers

* Reorder scope condition
2018-05-13 20:20:55 +02:00
Daniel Marjamäki ce30a3ca71 astyle formatting
[ci skip]
2018-05-11 14:49:31 +02:00
Paul Fultz II c520735009 Improve checking of size condition against empty to avoid FPs (#1213)
* Improve checking of size condition against empty to avoid FPs

* Add const and todo for reverse conditions
2018-05-11 10:22:06 +02:00
Paul Fultz II f5dbfce8ff Fix false positive with oppositeExpression when using binary op (#1211)
* Fix false positive with oppositeExpression when using binary op

* Simplify conditional
2018-05-08 20:43:57 +02:00
Daniel Marjamäki f2bb7397b3 astyle formatting
[ci skip]
2018-05-04 14:57:45 +02:00
Paul Fultz II cac68c6b81 Fix FP when using - as a binary operator (#1201) 2018-05-04 07:58:30 +02:00
Daniel Marjamäki 920b553ebf astyle formatting
[ci skip]
2018-05-02 12:58:10 +02:00
Paul Fultz II f191a3e753 Improve checking of opposite expressions (#1199)
* Improve checking of opposite expressions

* Fix some formatting
2018-05-02 06:32:33 +02:00
Daniel Marjamäki 121d4ff2ba isLikelyStreamRead: when using & dont allow astParent 2018-04-22 07:30:45 +02:00
Daniel Marjamäki 4b8769a9f5 astyle formatting
[ci skip]
2018-04-18 17:46:31 +02:00
Daniel Marjamäki 7ee636b934 Refactoring: Reuse isLikelyStreamRead in isVariableChanged 2018-04-18 17:46:10 +02:00
Daniel Marjamäki 26e36a1d6b Fix FP uninitvar when stream bool operator is used 2018-04-18 16:13:24 +02:00
Daniel Marjamäki 219176c11c Update isLikelyStreamRead (#8494) 2018-04-17 20:34:31 +02:00
Daniel Marjamäki c84628c28a Fixed #8494 (False positive: serialization class overloads operator) 2018-04-17 14:23:04 +02:00
Dmitry-Me d9cbaa83d6 Extract common condition 2018-04-08 21:11:44 +03:00
Paul Fultz II 95fc84a26b Find duplicate expressions assigned to the same variable (#1129)
* Check for duplicate assignments

* Improve checking of expression

* Add more tests

* Use simple match

* Improve robustness of check

* check for null

* Reduce side effects by checking for side effects

* Improve verbose message

* Reword the error message
2018-04-08 14:43:19 +02:00
Daniel Marjamäki 3ad6c7ebce Refactoring, use early continue 2018-04-05 08:21:43 +02:00
jrp2014 e65c63e2bb Refactor lib/astutils.cpp 2018-04-05 08:07:22 +02:00
Paul Fultz II 0c6f184423 Fix false positive for opposite conditions when using different containers (#1143)
* Fix false positive for opposite conditions when using different containers

* Add additional test
2018-04-05 06:43:13 +02:00
Daniel Marjamäki e65a5529ad astyle formatting
[ci skip]
2018-03-24 12:30:11 +01:00
Paul 43be20a824 Check more opposite conditions 2018-03-24 07:58:37 +01:00