Oliver Stöneberg
bfb50ca9d8
removed unnecessary `Settings` parameter from `Check::runChecks()` and made `Tokenizer` a reference ( #5308 )
...
There was no need for the `Tokenizer` parameter to be a pointer as it
could never be `nullptr` and was also dereferenced without checking
first.
As a reference to the `Settings` was already available via the
`Tokenizer` there was no need to pass it separately. In the production
code there will only be one instance of it but in the tests we could
have accidentally passed a different one.
2023-08-18 12:03:50 +02:00
chrchr-github
0ecf101fe3
Fix #11547 FN stlcstrConstructor, stlcstrAssignment with std::stringview ( #5097 )
...
* Fix #11547 FN stlcstrParam with std::string_view
* Add suppression
* Use emplace()
* Fix #11547 FN stlcstrConstructor, stlcstrAssignment with std::string_view
2023-05-31 16:51:37 +02:00
chrchr-github
17789778c9
Fix #11547 FN stlcstrParam with std::string_view ( #5093 )
...
* Fix #11547 FN stlcstrParam with std::string_view
* Add suppression
* Use emplace()
2023-05-28 01:11:11 +02:00
Daniel Marjamäki
464fbe8d53
Update copyright year
2023-01-28 10:16:34 +01:00
Oliver Stöneberg
bea6aec2b2
extracted `ValueFlow::Value` to `vfvalue.{cpp|h}` ( #4642 )
2023-01-26 22:23:22 +01:00
Oliver Stöneberg
a09667a6d9
removed unused error messages ( #4689 )
2023-01-07 10:35:39 +01:00
chrchr-github
b04bf7396f
Fix #7515 New check: Not needed c_str() operation ( #4371 )
2022-08-20 20:52:10 +02:00
chrchr-github
381c38b2f5
Improve check: uselessCallsConstructor ( #4270 )
2022-07-12 17:40:14 +02:00
chrchr-github
47c2a01392
Fix #11166 inefficient way to remove last character from std::string ( #4267 )
...
* Fix #11166 inefficient way to remove last character from std::string
* Format
* Modify message, add test
* Format
* Fix another warning
2022-07-11 23:07:37 +02:00
chrchr-github
c218859418
Fix some FNs related to c_str() ( #4258 )
2022-07-10 11:38:01 +02:00
Oliver Stöneberg
c9c1f83a69
use `emptyString` more consistently ( #4034 )
2022-07-10 10:57:29 +02:00
Oliver Stöneberg
6e57cc4323
small utils.h cleanup ( #3821 )
2022-02-11 19:44:08 +01:00
Oliver Stöneberg
f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly ( #3767 )
2022-02-10 23:02:24 +01:00
Daniel Marjamäki
3989408738
Update copyright year
2022-02-05 11:45:17 +01:00
Oliver Stöneberg
0ba9cb4e64
fixed some unusedFunction warnings ( #3618 )
2022-01-04 15:48:08 +01:00
Oliver Stöneberg
38de9214a8
small CheckStl optimization ( #3645 )
2021-12-20 07:29:45 +01:00
Daniel Marjamäki
f701a9361d
chmod; Use 644 for source files
2021-11-17 08:25:25 +01:00
Paul Fultz II
112363c9d1
Fix 10590: container access out of bounds not found ( #3560 )
...
* Refactor container bounds check
* Use symbolic values
* Add test case
* Format
2021-11-13 07:45:29 +01:00
Paul Fultz II
84f102283b
Warn when modifying container from another function in a loop ( #3510 )
2021-10-15 11:54:29 +02:00
Daniel Marjamäki
08f9de95e2
Update copyright year
2021-09-26 11:34:56 +02:00
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