Commit Graph

315 Commits

Author SHA1 Message Date
orbitcowboy 2bdeaf858e Added regression test for ticket #11091 - FP: Using object that is a temporary 2022-09-24 22:11:04 +02:00
Paul Fultz II 09944c0b7e
Fix 11298: FP danglingTemporaryLifetime when constructing from const char* (#4479)
* Fix 11298: FP danglingTemporaryLifetime when constructing from const char*

* Format
2022-09-18 08:30:58 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

* cleaned up includes based on include-what-you-use

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
chrchr-github 266174ddc4
Fix #10993 danglingTemporaryLifetime reported in two different locati… (#4462)
* Fix #10993 danglingTemporaryLifetime reported in two different locations for std::string_view usage

* Missing include

* Add test
2022-09-14 07:28:04 +02:00
Oliver Stöneberg 1b4141cbe5
added more missing `sstream` includes (#4384) 2022-08-19 18:23:15 +02:00
chrchr-github 457a0cff87
Fix #11016 FP unusedStructMember when used through iterator (regression) (#4289)
* Format

* Fix #11016 FP unusedStructMember when used through iterator (regression)

* Format

* Fix test

* Format

* Nullptr check
2022-07-19 20:42:54 +02:00
chrchr-github 6dc606fd6a
Add tests for #8446, #10750, #10894 (#4287) 2022-07-18 18:03:08 +02:00
Paul Fultz II 3e09503561
Fix 11087: false negative: usage of reference to member of temporary object not detected (#4217)
* Fix 11087: false negative: usage of reference to member of temporary object not detected

* Format

* Add another test case

* Fix FP with pointer

* Format
2022-06-16 19:26:36 +02:00
Paul Fultz II de51ebbcf4
Fix 9135: Access of moved variable not detected in loop (#4215)
* Fix 9135: Access of moved variable not detected in loop

* Format

* Fix issue with pushing back on container

* Format

* Fix null pointer

* Remove yeild for now
2022-06-16 17:40:09 +02:00
chrchr-github de9b65c737
Add tests for #9194, #10415, #4759, #9876, #10006 (#4213)
* Add test for #10152

* Add test for #9773

* Fix test

* Add test for #7529

* Add test for #6371

* Add test for #6475

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild

* Add tests for #9194, #10415, #4759, #9876, #10006
2022-06-14 13:05:07 +02:00
chrchr-github 6f5a5fd947
Add some tests (#4211)
* Add test for #10152

* Add test for #9773

* Fix test

* Add test for #7529

* Add test for #6371

* Add test for #6475

* Format

* Format

* Fix test

* Remove duplicate test

* Add valueflow test

* Rebuild
2022-06-14 09:54:45 +02:00
Paul Fultz II fbba72ab5a
Fix 11057: FP danglingTemporaryLifetime with reference member (#4103)
* Fix 11057: FP danglingTemporaryLifetime with reference member

* Add test

* Format

* Use ast for number of arguments

* Get number of arguments using ast

* Skip aggregate constructor when there are too many arguments

* Format
2022-05-13 06:51:07 +02:00
chrchr-github 54f832a2fe
Fix #10569 FN: duplicateExpression with multiple strings compared (#4087) 2022-05-09 21:05:35 +02:00
Paul Fultz II 3edb10a006
Fix 11024: FP returnDanglingLifetime with c_str() passed to constructor (#4072) 2022-05-03 11:42:32 +02:00
Paul Fultz II 9fa5c4e201
Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive] (#4066)
* Fix 11011: FP returnDanglingLifetime with non-const reference argument [inconclusive]

* Format
2022-04-30 08:23:58 +02:00
chrchr-github 7cedf3e0e5
Partial fix for #10983 False positive: returnTempReference with trailing return type (#4055) 2022-04-27 20:11:32 +02:00
Paul Fultz II 28cf14f110
Fix 10975: false negative: dangling reference in class (#4024)
* Fix 10975: false negative: dangling reference in class

* Format
2022-04-14 18:59:12 +02:00
Paul Fultz II 6c82fb05a4
Fix 10954: False positive: returnDanglingLifetime when using c_str() (#4006) 2022-04-12 08:09:13 +02:00
Paul Fultz II 8986cf018f
Fix todo test that was using wrong function (#3982)
* Fix todo test that was using wrong function

* Format
2022-04-07 06:48:51 +02:00
Paul Fultz II 39265f8ce0
Fix 10931: Assert failure in setSymbolic() (#3967)
* Fix 10931: Assert failure in setSymbolic()

* Format
2022-04-03 20:04:18 +02:00
Paul Fultz II 54fbfd7c0f
Fix 10895: FP danglingTempReference with emplace() (#3948)
* Fix 10895: FP danglingTempReference with emplace()

* Format
2022-03-27 10:02:30 +02:00
Paul Fultz II 40ff9edad6
Fix 10843: FP: danglingTemporaryLifetime (#3908)
* Fix 10843: FP: danglingTemporaryLifetime

* Format
2022-03-16 17:11:49 +01:00
Paul Fultz II 0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified (#3857)
* Fix 10702: FP knownConditionTrueFalse - Member variable modified

* Format

* Make parameter const

* Fix FP

* Fix FP

* Update

* Format
2022-02-28 18:54:55 +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
Paul Fultz II 20a5224d7e
Fix 10784: False positive: returnDanglingLifetime using std::tie with variadic template parameters (#3805) 2022-02-08 09:03:51 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
chrchr-github 1b89c998f5
Fix #10469 FP returnTempReference with overloaded operator+= (#3678) 2022-01-12 22:05:30 +01:00
Paul Fultz II 4ef20f8f1e
Fix 10683: FP danglingTemporaryLifetime with pointer to vector (#3685) 2022-01-10 07:34:26 +01:00
Rikard Falkeborn 8537331ad6
AutovarDeallocation: Fix grammar in error message (#3654) 2021-12-23 20:09:55 +01:00
Rikard Falkeborn e7b6920cf4
Fix #10600: FP invalid dealloc of function array argument (#3613)
Do not warn for array arguments that are free'd, since they decay to
pointers.
2021-12-09 07:16:40 +01:00
Paul Fultz II 3874c546cc
Fix 10641: FP invalidLifetime with compiler-generated constructor (#3609) 2021-12-07 07:43:25 +01:00
Rikard Falkeborn 1a50146745
autovarInvalidDeallocation: Fix fp with impossible value (#3604)
daca reports new false positives after db4f94fdfe on the form:

	void f() {
	    char *ptr = malloc(10);
	    char *empty_str = "";
	    if (ptr == NULL)
	        ptr = empty_str;
	    if (ptr != empty_str)
	        free(ptr);
	}

Add a check that the value is not impossible to avoid this.
2021-12-05 15:47:21 +01:00
Paul Fultz II a03e731930
Track lifetimes of lambdas that capture the 'this' variable (#3594) 2021-12-04 17:00:55 +01:00
Rikard Falkeborn db4f94fdfe
Fix #7341: Dealloc string literal (#3586) 2021-11-30 07:31:28 +01:00
chrchr-github ca311ebcdf
ASSERT() on calls to Tokenizer::tokenize() in test code (#3501) 2021-11-29 07:34:39 +01:00
Paul Fultz II 57f5b19b34
Fix 7812: False negative: return pointer of local variable (#3583)
* Fix 7812: False negative: return pointer of local variable

* Format

* Add test case for 3029

* Format
2021-11-28 15:25:21 +01:00
chrchr-github 9c31e0ce54
Fix #10393 FP returnDanglingLifetime (#3562) 2021-11-15 20:36:38 +01:00
Paul Fultz II c057dcce0f
Fix 10592: False positive: returnDanglingLifetime (#3557) 2021-11-11 08:00:05 +01:00
chrchr-github 629f883408
Fix #10097: autovarInvalidDeallocation with pointer to std::array (#3529) 2021-11-08 20:31:16 +01:00
Paul Fultz II 6338c2396c
Fix 10589: False positive: danglingLifetime for moved unique ptr (#3547) 2021-11-06 19:08:19 +01:00
Paul Fultz II b835744a81
Fix 10585: FP danglingTemporaryLifetime recent regression (#3544)
Fix 10585: FP danglingTemporaryLifetime recent regression
2021-11-04 09:24:24 +01:00
Paul Fultz II d3f0aa5b34
Fix 10033: false negative: danglingTemporaryLifetime with usage of reference from nested object not detected (#3542) 2021-11-01 19:23:15 +01:00
Paul Fultz II 7d7584b456
Fix 10575: Improve check; lifetime, struct member points to local data (#3541) 2021-11-01 19:22:21 +01:00
Paul Fultz II e998cd13ca
Partial fix for 10393: FP returnDanglingLifetime when constructing string from iterators [inconclusive] (#3536) 2021-10-30 09:06:36 +02:00
Paul Fultz II 876702c4f2
Fix 10098: false negative: 'Reference to temporary returned.' not detected with class (#3509) 2021-10-15 10:59:40 +02:00
Paul Fultz II 25eb0ab5bc
Find dangling pointers to unique_ptr (#3486) 2021-10-06 08:46:25 +02:00
Paul Fultz II 8668d445c7
Add support for string_view (#3480) 2021-10-05 08:28:19 +02:00
KenPatrickLehrmann 61cddabe74
Fix FP due to namespace scope (#3475) 2021-10-04 23:16:16 +02:00
chrchr-github 2d3b8d7003
Add regression test for #10473 (#3457) 2021-09-13 20:46:39 +02:00