Paul Fultz II
11c99d7387
Fix issue 9880: False positive: danglingLifetime ( #2810 )
2020-09-17 07:23:38 +02:00
Paul Fultz II
ebbff08932
Fix issue 9899: False positive: Non-local variable will use object that points to local variable ( #2808 )
2020-09-15 07:11:52 +02:00
Daniel Marjamäki
d46b9cec5f
Merge pull request #2795 from pfultz2/fp-lifetime-temp-function-obj
...
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-11 09:05:43 +02:00
Paul
71bc79ac28
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-10 22:58:17 -05:00
Paul
b26c581556
Fix issue 9888: False positive: Using reference to dangling temporary with std::move
2020-09-10 22:38:31 -05:00
Paul Fultz II
34d65e25d6
Merge branch 'main' into lifetime-subfunction
2020-09-09 12:02:02 -05:00
Daniel Marjamäki
b1401c6536
Merge pull request #2789 from pfultz2/smart-ptr-constructor
...
Fix issue 9496: False negative: Dereferencing returned smart null-pointer
2020-09-09 08:16:30 +02:00
Paul
382408f59e
Fix issue 9496: False negative: Dereferencing returned smart null-pointer
2020-09-08 21:54:38 -05:00
Paul
8d7088aa24
Fix issue 9835: False negative: Return reference to temporary with const reference
2020-09-08 18:30:45 -05:00
Paul
1be67ea008
Merge
2020-09-08 11:00:57 -05:00
Paul Fultz II
362ab44c40
Fix issue 9646: False negative: Return reference to temporary with const reference ( #2782 )
2020-09-07 10:52:54 +02:00
Paul
786672e19d
Format
2020-09-06 21:59:21 -05:00
Paul
c7a5d3c5f1
Fix FPs
2020-09-06 21:58:36 -05:00
Paul Fultz II
cc2bc74084
Track lifetime for lambdas with explicit capture ( #2776 )
2020-09-05 07:56:01 +02:00
Paul
264c0cae8b
Formatting
2020-09-04 11:59:30 -05:00
Paul
bb37b07def
Extend lifetimes to subfunctions
2020-09-04 11:56:34 -05:00
Paul Fultz II
03cefd5d70
Fix issue 9853: False positive: returnReference when using a pointer to container ( #2765 )
2020-09-02 20:01:08 +02:00
Paul Fultz II
32df807b22
Fix issue 9783: wrong lifetime analysis temporary assigned to object ( #2711 )
2020-09-02 07:13:15 +02:00
Paul Fultz II
0a718694af
Fix issue 9852: False positive: danglingTemporaryLifetime when returning a vector of vectors ( #2766 )
2020-09-01 11:21:29 +02:00
Paul
0cc1f69862
Fix issue 9770: FP returnDanglingLifetime for class method taking const char* and returning std::string
2020-08-05 23:17:35 -05:00
Paul
f7029e62ac
Check for mor FPs
2020-06-17 17:06:06 -05:00
Paul Fultz II
bbe6157e16
Fix issue 9712: False positive: Returning pointer to local variable when return line implicitly cast to return type ( #2662 )
2020-05-23 23:12:00 +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
Paul Fultz II
453a69dd8c
Fix issue 9677: False positive: returning pointer to oject that will not be invalid ( #2607 )
...
* Fix issue 9677: False positive: returning pointer to oject that will not be invalid
* Formatting
2020-04-18 09:23:10 +02:00
Paul Fultz II
8fd0839fea
Add regression test for 9534: False positive: Returning pointer to local variable 'x' that will be invalid when returning. ( #2596 )
2020-04-06 16:02:10 +02:00
Paul Fultz II
71deaaeb18
Fix issue 9608: False Positive: returnDanglingLifetime with braced-init-list ( #2583 )
2020-04-02 10:17:58 +02:00
Paul Fultz II
02ae71917a
Fix issue 9536: False positive: Reference to temporary returned when using operator() ( #2582 )
...
* Fix issue 9536: False positive: Reference to temporary returned when using operator()
* Add more test cases
2020-04-01 22:35:41 +02:00
Paul Fultz II
5462e43161
Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning ( #2576 )
...
* Follow reference when tracking local variables
* Fix issue 9639: False positive: Returning object that points to local variable that will be invalid when returning
2020-03-23 22:54:53 +01:00
Paul Fultz II
e55ddacd18
Fix issue 9597: False positive: Reference to temporary returned if explicitly casted to base class ( #2531 )
2020-02-11 11:41:41 +01:00
Paul Fultz II
8fa7dd0fe0
Fix issue 9595: False positive: Using pointer to temporary doesn't account for const ref extended temporary lifetimes ( #2525 )
2020-02-10 18:01:11 +01:00
Paul Fultz II
9cb39b1d7e
Fix issue 9482: False positive: Reference to temporary returned using trailing return type ( #2413 )
2019-12-01 15:10:02 +01:00
Daniel Marjamäki
937c82efbe
AST: initializer list with lambda
2019-11-27 06:44:58 +01:00
Daniel Marjamäki
ab2274b8ad
AST: lambdas and scopes in expressions
2019-11-23 21:36:36 +01:00
Paul Fultz II
4ebf54d090
Fix issue 9437: Dont assume init list constructor for strings ( #2366 )
...
* Fix issue 9437: Dont assume init list constuctor for strings
* Update the schema
* Add documentation
2019-11-17 03:22:04 +01:00
Rikard Falkeborn
af170c8e3f
Add regression test for #8923 ( #2348 )
...
This was fixed in 5a32d2d017
. Add a regression test
with array arguments.
2019-11-11 07:15:24 +01:00
Paul Fultz II
c1da6c7dd2
Fix issue 9461: False positive: Reference to temporary returned using trailing return type ( #2345 )
2019-11-10 09:44:04 +01:00
Paul Fultz II
650408a210
Improve librarys config of substr to improve checking cases in issue 8021 ( #2338 )
2019-11-08 08:02:33 +01:00
Paul Fultz II
2e955d0f22
Fix issue 9453: False positive: danglingLifetime, address of array argument ( #2335 )
2019-11-07 09:33:17 +01:00
Paul Fultz II
d1f225b8ee
Fix issue 9201: FP: returnDanglingLifetime on pointer to variable of static struct ( #2303 )
...
* Fix issue 9201: FP: returnDanglingLifetime on pointer to variable of static struct
* Fix capture of non-local variables in lambdas
2019-11-05 07:10:32 +01:00
Paul Fultz II
c38bbb75e4
Fix issue 9448: Check for temporaries from library function calls ( #2312 )
2019-11-03 22:02:10 +01:00
Paul Fultz II
1ef85f9229
Fix issue 9432 and 9433: False positive: Reference to temporary returned ( #2302 )
2019-10-29 19:12:58 +01:00
Daniel Marjamäki
62d972061b
astyle formatting
...
[ci skip]
2019-10-14 19:41:51 +02:00
Paul Fultz II
bf5c90a2be
Fix issue 9409: FP returnTempReference ( #2266 )
...
* Fix issue 9409: FP returnTempReference
* Format
2019-10-13 19:12:46 +02:00
Paul Fultz II
a5c6ae1e08
Fix issue 9400: FP returnTempReference - triggered by cast ( #2259 )
2019-10-10 06:52:11 +02:00
Daniel Marjamäki
9f40341ba8
SymbolDatabase: Hardcoded handling for std::make_shared and std::make_unique , todo: library configuration would be better than hard coding
2019-10-08 17:19:24 +02:00
Paul Fultz II
4eb4762d95
Extend lifetime checking to temporaries ( #2242 )
...
* Use lifetimes to check for returning reference to temporaries
* Check for dangling temporaries
* Check for unknown types for returining by reference
* Remove old returnTemporary check
* Format
* Check for deref op
* Ternary operator return an lvalue reference
* Warn when returning temporaries from member functions
* Improve handling of pointer to function
* Extend lifetimes of const references
2019-10-08 09:28:39 +02:00
Paul Fultz II
cf1c766292
Fix issue 9317: False positive returnDanglingLifetime when using reference to constant inside if statement ( #2241 )
2019-10-05 16:32:20 +02:00
Paul Fultz II
ba037837c9
Track lifetime across multiple returns
...
This will now warn when doing something like this:
```cpp
template <class T, class K, class V>
const V& get_default(const T& t, const K& k, const V& v) {
auto it = t.find(k);
if (it == t.end()) return v;
return it->second;
}
const int& bar(const std::unordered_map<int, int>& m, int k) {
auto x = 0;
return get_default(m, k, x);
}
```
The lifetime warning is considered inconclusive in this case.
I also updated valueflow to no tinject inconclusive values unless `--inconclusive` flag is passed. This creates some false negatives because library functions are not configured to not modify their input parameters, and there are some checks that do not check if the value is inconclusive or not.
2019-09-11 19:25:09 +02:00