Commit Graph

334 Commits

Author SHA1 Message Date
Daniel Marjamäki 3dc34f1515 Disable all simplified checks 2019-03-16 09:17:50 +01:00
Daniel Marjamäki f9fe6cc96a STL: Removed auto_ptr checking. 2019-03-09 07:48:01 +01:00
Daniel Marjamäki 725abbfac3 Move CheckStl::missingComparison to normal checks 2019-03-08 20:19:40 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 8dd641b8be Use OVERRIDE in test 2019-01-12 15:45:25 +01:00
Paul Fultz II be6782d386 Fix FP 8891: Incorrect return scope when using uniform initialization
This fixes the FP in:

```cpp

std::string f(const std::string& data)
{
  if (data.empty())
    return {};

  data[0];
}
```
2018-12-14 18:31:10 +01:00
Daniel Marjamäki dd94bfede9 CheckStl: Improving checking of container access out of bounds 2018-11-28 19:27:28 +01:00
Daniel Marjamäki 6493db6ca2 Try to clarify message for container access out of bounds a little more. 2018-11-28 13:58:01 +01:00
Daniel Marjamäki 0f2f807798 Improve the container out of bounds messages. They are still not perfect. 2018-11-28 07:03:56 +01:00
Paul Fultz II a3921ea861 Refactor valueFlowAfterCondition
So this unifies the `valueFlowAfterCondition` so it re-uses more code between checking for integers and container sizes. This should make valueFlowContainer more robust.

It also extends valueflow to support container comparisons such as `if (v.size() < 3)` or `if (v.size() > 3)` using the same mechanism that is used for integers.
2018-11-24 10:07:12 +01:00
Daniel Marjamäki 4983a6a5dc astyle formatting 2018-10-18 20:08:32 +02:00
Igor 0a9be3e734 Improve STL iterators checking (#1380)
* Improve STL interators checking

* Improve error messages for container iterators from different scopes

* Mini refactoring

* Replace hardcoded pattern to ValueType::Type::ITERATOR

* Error messages improvements, more tests and refactoring

* Refactoring after code review

* Put getting operand data into separate function

* Update getErrorMessages and iterator errors ids

* Refactoring

* Fix error

* Refactoring, early return implementation

* Delete redundant code

* Tiny changes in comments
2018-10-17 06:36:51 +02:00
Daniel Marjamäki 053b0d1654 STL: enable inconclusive warnings with --inconclusive 2018-10-09 20:10:43 +02:00
Paul Fultz II 4ed22f1ff8 Fix some FPs in mismatchingContainerExpression (#1402) 2018-09-30 14:49:58 +02:00
Paul Fultz II d43cd56afd Show line number when suggesting std::transform (#1385) 2018-09-21 10:38:30 +02:00
orbitcowboy a26ac4d266 Running astyle. There is no functional change intended. 2018-09-21 08:53:09 +02:00
Paul Fultz II 1e347f6cde Initial check for recommending algorithms (#1352)
Add initial check for loop algorithms
2018-09-19 18:58:59 +02:00
Paul Fultz II eb07280075 Fix issue 8743: FP when derefencing iterators (#1376) 2018-09-12 17:33:53 +02:00
Daniel Marjamäki 772939476d Remove inconclusive warnings about reading empty stl container. We have better ValueFlow-based checking. 2018-09-09 11:25:04 +02:00
Paul Fultz II f7e7e9bd3c Fix issue 8736: Iterators to containers from different expressions (a.begin().x == b.begin().x) (#1370) 2018-09-07 07:08:02 +02:00
Daniel Marjamäki 756c1d8de7 Fixed #8341 (error:iterators not correct) 2018-09-02 21:04:45 +02:00
Paul Fultz II f79849f6ba Diagnose mismatching iterators used together in operators (#1343)
* Diagnose mismatching iterators used together in operators

* Fix fp getting iterator expression in function call
2018-08-21 06:34:30 +02:00
Daniel Marjamäki 0e30bdef9d containerAccessOutOfBounds: Fix FPs for maps etc 2018-08-11 18:57:21 +02:00
Daniel Marjamäki 1f427eda8f CheckStl: rewrite and refactor out of bounds checker 2018-08-11 11:40:48 +02:00
Daniel Marjamäki 81f54f7094 Fixed #8681 (ValueFlow: Container size) 2018-08-10 11:29:16 +02:00
Paul Fultz II ed197f235a Fix issue 4693: Diagnostic when using the same iterators to an algorithm (#1326)
* Fix issue 4693: Diagnostic when using the same iterators to an algorithm

* Update classinfo
2018-08-05 09:10:54 +02:00
Paul Fultz II 0d35a96594 Improve checking of mismatch iterators (#1293) 2018-07-26 22:00:48 +02:00
Daniel Marjamäki b398398dec Fixed #8360 (false positive "Ineffective call of function 'empty()'") 2018-07-10 22:58:02 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 8304290f06 astyle formatting
[ci skip]
2018-04-27 10:29:27 +02:00
amai2012 55983e2a0b #8509 Uniform initialization ignored for iterator 2018-04-26 08:57:25 +02:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 323e9ab509 astyle formatting
[ci skip]
2018-01-11 09:31:16 +01:00
amai2012 b17807c568 #6572 False positive eraseDereference - in iterator class - flag error inconclusive if iterator is not STL type 2018-01-10 09:37:21 +01:00
Daniel Marjamäki 83b87b54b4 Fixed #8191 (False positive iterators regression) 2018-01-06 22:25:13 +01:00
Daniel Marjamäki 61767d4932 Fixed #8125 (incorrect error iterators) 2018-01-06 16:08:12 +01:00
Daniel Marjamäki b73f5fec7d Fix invalid code in TestStl test case 2017-09-19 23:22:17 +02:00
Daniel Marjamäki 1a057bc23a Revert "Remove redundant safety logic (CID 1368511)"
This reverts commit d892031f28.
2017-09-19 23:13:31 +02:00
Daniel Marjamäki d892031f28 Remove redundant safety logic (CID 1368511) 2017-09-19 23:07:02 +02:00
Daniel Marjamäki d79762cfc3 Fixed #7449 (reademptycontainer (inconclusive) when variable changed in function ) 2017-09-15 10:49:58 +02:00
Daniel Marjamäki 97125acabd Fixed #7365 (False positive: Use of erased iterator) 2017-09-08 09:45:30 +02:00
Daniel Marjamäki 1ecefa045a Fixed #8194 (False positive reademptycontainer - range based loop) 2017-09-02 22:22:32 +02:00
Daniel Marjamäki 2679b576c2 Fixed #1693 (false negative: std::vector, negative index) 2017-08-22 11:04:02 +02:00
Daniel Marjamäki eb288ec2a1 CheckStl: Use AST to handle iterator comparisons better 2017-07-26 23:13:01 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
PKEuS b345c430fe CheckStl::readingEmptyStlContainer(): Skip over lambdas (#8055) 2017-05-07 08:15:58 +02:00
Matthias Krüger 494f64cb88 tests: fix some self-check findings about functions that can be static.
Was:
[test/testtype.cpp:223]: (performance, inconclusive) Technically the member function 'TestType::removeFloat' can be static.
[test/testsymboldatabase.cpp:61]: (performance, inconclusive) Technically the member function 'TestSymbolDatabase::getSymbolDB_inner' can be static.
[test/teststl.cpp:1437]: (performance, inconclusive) Technically the member function 'TestStl::getArraylength' can be static.
2017-04-09 17:28:00 +02:00
Daniel Marjamäki 279425499e Fixed #7930 (Improve check: Missing stlcstr warning for reference variable) 2017-03-01 02:03:08 +01:00
Daniel Marjamäki d840005f06 Fixed #7656 (stlcstr - false positive) 2017-02-26 17:25:32 +01:00
Robert Reif 4123b457d7 Fixed #7441 (SymbolDatabase: No scope when function return type not specified) 2017-01-06 11:53:17 +01:00