Commit Graph

1278 Commits

Author SHA1 Message Date
Daniel Marjamäki ad0ebd8f1a astyle formatting
[ci skip]
2018-08-25 21:32:52 +02:00
Paul Fultz II a5f4c5d0eb Improve message for same expressions (#1349)
* Improve message for same expressions

* Update message
2018-08-25 14:25:31 +02:00
Daniel Marjamäki e442bc47b1 astyle formatting
[ci skip]
2018-08-17 19:55:21 +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 80290a15e0 Fix FP with duplicate assign (#1330) 2018-08-08 08:31:31 +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 0e491b41a8 Clarify warning message for 'Same expression on both sides of operator' 2018-08-05 10:48:02 +02:00
Daniel Marjamäki f9a5a114bb astyle formatting
[ci skip]
2018-07-25 07:44:06 +02:00
lordylike 12e58c8521 fix ticket 8570: passedByValue with member initializer list and std::move (#1316)
* fix ticket 8570

allow member initializer list variables that are moved to be non-const

* review feedback

* replace tabs with spaces in test code
2018-07-22 15:01:18 +02:00
Daniel Marjamäki 417670d947 Clarify code with continue 2018-07-20 21:44:23 +02:00
Daniel Marjamäki d00e522856 Clarify the code with Token::isUnaryOp and Token::isBinaryOp 2018-07-14 13:01:24 +02:00
Daniel Marjamäki c9a2071420 Refactoring: Use range for loop 2018-07-14 12:28:57 +02:00
Daniel Marjamäki 24dd4c9c26 Restore code in checkVariableScope. Fixes false negative 2018-07-01 22:31:45 +02:00
Daniel Marjamäki 2beeca3ca2 Refactoring; use early continue 2018-06-23 23:26:37 +02:00
Daniel Marjamäki 655a8b21b6 Fix false positive 'passedByValue' when address of argument is used 2018-06-23 23:25:06 +02:00
Daniel Marjamäki 697aee143f CheckOther: Use Variable::valueType() instead of Variable::typeStartToken 2018-06-23 16:52:40 +02:00
Daniel Marjamäki fc78530b3f CheckOther: Use Variable::valueType() instead of Variable::typeStartToken 2018-06-23 16:49:26 +02:00
Daniel Marjamäki 2a8296879c CheckOther: Use Variable::valueType() instead of Variable::typeStartToken 2018-06-23 16:42:36 +02:00
Daniel Marjamäki ee335e5151 Fix compiler error 2018-06-23 16:07:02 +02:00
Daniel Marjamäki 911020f601 Refactoring, use range for loop 2018-06-23 15:58:44 +02:00
Daniel Marjamäki d811a07aa3 CheckOther: Use Variable::valueType() instead of typeStartToken etc 2018-06-22 23:04:36 +02:00
Daniel Marjamäki d0614b9b36 varScope: Fix false negatives for references 2018-06-22 22:51:03 +02:00
Daniel Marjamäki 439d4a4900 Use Variable::valueType() instead of Variable::typeStartToken() 2018-06-20 19:08:09 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
Daniel Marjamäki b9d03d0e23 astyle formatting
[ci skip]
2018-06-10 21:59:24 +02:00
Paul Fultz II daacf27c2e Fix false positive from issue 8612 (#1285) 2018-06-10 00:05:23 +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
Daniel Marjamäki 84f0a18053 passedByReference: avoid false positives for std::pair 2018-06-08 10:19:02 +02:00
Daniel Marjamäki 44c78d1770 passedByReference: avoid false positives for std::function 2018-06-08 08:40:14 +02:00
Daniel Marjamäki de09c117bf Fixed #8618 (False positive: shared_ptr is passed by reference by intention) 2018-06-07 22:39:21 +02:00
Sebastian 7c9b6d9bb0
checkother.cpp: Fix typo in symbol placeholder in error message. (#1276) 2018-06-05 10:24:19 +02:00
orbitcowboy 33777c5b72 Improved const correcntess of local variables. 2018-05-29 13:24:48 +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
IOBYTE 184537884f Don't remove the volatile keyword so we can properly overload functions. (#1218)
* Don't remove the volatile keyword so we can properly overload functions.

I fixed all the checks that had tests that use volatile.  There will
probably be more changes needed due to lack of test coverage for
volatile in some checks.

* Fix unused private function warning.
2018-05-10 07:40:01 +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 ca8e19c96d SymbolDatabase: Refactor SymbolDatabase: variable list 2018-04-28 09:38:33 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
Daniel Marjamäki b6e89f85d0 CheckOther: Use isLikelyStreamRead 2018-04-22 17:14:28 +02:00
Daniel Marjamäki e1db4c0e2c astyle formatting
[ci skip]
2018-04-21 13:28:31 +02:00
Paul Fultz II d939c6015a Report opposite expressions (#1182)
* Report opposite expressions

* Skip assignment operator
2018-04-21 11:28:21 +02:00
Daniel Marjamäki 46bb63ceaf Refactoring: Use range for loop 2018-04-20 22:08:22 +02:00
Daniel Marjamäki d5fb529d4f Fixed #8492 (Improve message: parameter should be passed by reference) 2018-04-20 17:33:42 +02:00
Daniel Marjamäki 313b2a1755 Refactoring: Use ranged for loops 2018-04-19 22:31:36 +02:00
Daniel Marjamäki e95ff8c7b6 Avoiding emplace 2018-04-14 19:24:35 +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
PKEuS b15cc3f236 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:54:39 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
Daniel Marjamäki ae3e649cc4 astyle formatting
[ci skip]
2018-04-08 20:29:52 +02:00