Paul Fultz II
7f358b2bed
Format with uncrustify ( #3388 )
2021-08-07 20:51:18 +02:00
Paul Fultz II
dea5a23c34
Improve check: check for known empty containers passed to algorithms ( #2768 )
2020-09-02 07:11:23 +02:00
Daniel Marjamäki
18c29544eb
astyle formatting
2020-08-28 19:29:33 +02:00
Paul Fultz II
6ab3c93fb1
Fix issue 9756: false negative: invalid iterator from std::find_if ( #2760 )
2020-08-28 19:29:09 +02:00
Daniel Marjamäki
2bb73840fc
astyle formatting
2020-08-23 17:17:33 +02:00
Paul Fultz II
ac846b96d1
New check: Iterating a known empty container ( #2740 )
2020-08-22 09:16:26 +02:00
Paul
7776fb82a2
Fix issue 737: new check: Dereference end iterator
2020-08-17 16:36:45 -05:00
Daniel Marjamäki
af6e76d623
Fixed #9787 (Better handling of user defined literals)
2020-06-25 22:06:34 +02:00
Paul
7c9144ea47
Add to classInfo
2020-06-15 19:43:33 -05:00
Paul
172537807b
Add check for incorrect usage of mutexes and lock guards
2020-06-15 19:40:54 -05:00
Daniel Marjamäki
43b30d974f
astyle formatting
...
[ci skip]
2020-06-08 00:50:45 +02:00
Paul Fultz II
86ed860d26
Fix issue 9548: False negative: Mismatching iterators when inserting into a vector ( #2595 )
2020-06-06 17:54:56 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy ( #2633 )
2020-05-23 07:16:49 +02:00
Daniel Marjamäki
08ddd84780
Update copyright year
2020-05-10 11:16:32 +02:00
Daniel Marjamäki
3e0218299b
Revert "Update copyright year"
...
This reverts commit 6eec6c4bd5
.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki
6eec6c4bd5
Update copyright year
2020-05-10 11:11:34 +02:00
Oliver Stöneberg
2c1e36e63e
cleaned up includes based on include-what-you-use ( #2600 )
...
* cleaned up includes based on include-what-you-use
* check.h: trying to work around Visual Studio 2012 bug
* fixed Visual Studio compilation
2020-04-13 13:44:48 +02:00
orbitcowboy
048b08f5be
Running astyle. There are no functional changes [ci skip]
2020-04-04 14:49:08 +02:00
Paul Fultz II
efdc5f5c4e
Fix issue 9435: False negative: invalidContainer when using range for loop ( #2587 )
...
* Fix issue 9435: False negative: invalidContainer when using range for loop
* Use ast
* Make string const
2020-04-04 11:47:02 +02:00
Paul Fultz II
42d44f02a2
Use lifetime analysis for checking mismatching containers ( #2456 )
...
* Use lifetimes to check for mismatching containers
* Fix error messages
* Format
* Remove unused variables
* Fix configuration and track iterators through algorithms
* Fix iterator value types in qt config
* Fix library issue with QStringList
* Remove unused functions
* Fix cppcheck errors
2019-12-25 09:32:50 +01:00
Oliver Stöneberg
b5c598cca4
added missing OVERRIDE usage and removed redundant virtual ( #2190 )
2019-09-20 21:57:16 +02:00
Paul Fultz II
cb509f1a8b
Fix issue 4845: alias to vector element invalid after vector is changed ( #2113 )
...
* Try harder to track ref lifetimes
* Dont add lifetimes for references
* Use correct token
* Check for front and back as well
* Improve handling of addresses
* Formatting
* Fix FP
2019-09-02 06:58:09 +02:00
Paul Fultz II
a08a9c1349
Switch to use lifetime analysis for iterators and pointers to invalid containers
...
This will diagnose more issues such as:
```cpp
void f(std::vector<int> &v) {
auto v0 = v.begin();
v.push_back(123);
std::cout << *v0 << std::endl;
}
```
2019-07-18 10:56:44 +02:00
Daniel Marjamäki
5eff1b0f4a
Replace 'unsigned' with 'nonneg' in checkstl
2019-07-15 14:05:23 +02:00
Daniel Marjamäki
46cad95238
Fix Cppcheck warnings
2019-06-15 13:05:17 +02:00
Paul Fultz II
091f4bcf8d
Add check for unnecessary search before insertion
...
This will warn for cases where searching in an associative container happens before insertion, like this:
```cpp
void f1(std::set<unsigned>& s, unsigned x) {
if (s.find(x) == s.end()) {
s.insert(x);
}
}
void f2(std::map<unsigned, unsigned>& m, unsigned x) {
if (m.find(x) == m.end()) {
m.emplace(x, 1);
} else {
m[x] = 1;
}
}
```
In the case of the map it could be written as `m[x] = 1` as it will create the key if it doesnt exist, so the extra search is not necessary.
I have this marked as `performance` as it is mostly concerning performance, but there could be a copy-paste error possibly, although I dont think thats common.
2019-05-02 11:04:23 +02:00
Daniel Marjamäki
3c30d274a0
Clarify STL out of bounds warning message
2019-03-29 11:13:25 +01:00
Daniel Marjamäki
3dc34f1515
Disable all simplified checks
2019-03-16 09:17:50 +01:00
Paul Fultz II
3615eac347
Move useStlAlgorithm to normal checking ( #1741 )
2019-03-15 06:15:56 +01:00
Daniel Marjamäki
f36ca56e7d
Moved CheckStl::redundantCondition to normal checking
2019-03-09 07:53:49 +01:00
Daniel Marjamäki
f9fe6cc96a
STL: Removed auto_ptr checking.
2019-03-09 07:48:01 +01:00
Daniel Marjamäki
d7a645dcc3
Moved CheckStl::uselessCalls to normal checking
2019-03-09 07:37:08 +01:00
Daniel Marjamäki
45a0c2ebf5
Revert "Moved CheckStl::checkAutoPointer to normal checking"
...
This reverts commit 6dc9727ffd
.
2019-03-08 20:53:37 +01:00
Daniel Marjamäki
6dc9727ffd
Moved CheckStl::checkAutoPointer to normal checking
2019-03-08 20:41:28 +01:00
Daniel Marjamäki
95a20c0233
Moved CheckStl::string_c_str to normal checking
2019-03-08 20:39:43 +01:00
Daniel Marjamäki
fdf1d6fdee
Moved CheckStl::erase to normal checking
2019-03-08 20:36:40 +01:00
Daniel Marjamäki
fdfe39299c
Moved CheckStl::pushback to normal checking
2019-03-08 20:33:16 +01:00
Daniel Marjamäki
5fe48f3cd2
Moved CheckStl::mismatchingContainers to normal checking
2019-03-08 20:31:00 +01:00
Daniel Marjamäki
b91bb2e523
Moved CheckStl::iterators to normal checking
2019-03-08 20:28:28 +01:00
Daniel Marjamäki
8f2d70e61d
Move CheckStl::if_find to normal checking
2019-03-08 20:23:37 +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
8b5f36670a
Introduce macro OVERRIDE for gcc-4.6 compatibility.
2019-01-12 07:37:42 +01:00
ivangalkin
5ddc6c64d7
CheckStl: add missing error ID iterators2 ( #1576 )
...
due to equal arguments...
* iterators1 (`CheckStl::iteratorsError(const Token*, const std::string&, const std::string&)`) and
* iterators2 (`CheckStl::iteratorsError(const Token*, const Token*, const std::string&, const std::string&)`)
... produced equal messages. Equal messages were filtered-out `CppCheck::reportErr(const ErrorLogger::ErrorMessage&)`.
So the error iterators2 disapeared from the error list.
2019-01-09 06:45:38 +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
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
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
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