================
@@ -122,36 +102,30 @@ void caller_seven() {
// This does not apply to the test cases above this test case.
}
-
// Function returns a reference and has an annotated parameter
int& func(int& some_number [[clang::lifetimebound]]);
-void clang_analyzer_lifetime_bound(int&);
-
void caller_eight() {
int f = 15;
auto& bind = func(f);
- clang_analyzer_lifetime_bound(bind);
- // expected-warning@-1 {{Origin bound
to some_number}}
- // expected-warning@-1 {{Origin
contains loan some_number}}
- clang_analyzer_dump(bind);
-
+ clang_analyzer_lifetime_bound(bind); // expected-warning {{bound to f}}
+ // expected-warning@-1 {{contains loan
f}}
// The FIXME about the full warning applies to this text case as well.
}
// Function returns a reference and has two annotated parameters.
int& f(int& a [[clang::lifetimebound]], int& b [[clang::lifetimebound]]);
-void clang_analyzer_lifetime_bound(int&);
-
void caller_nine() {
int first_num = 1;
int second_num = 2;
- auto numbers = f(first_num, second_num);
+ int& numbers = f(first_num, second_num);
+
+ clang_analyzer_lifetime_bound(numbers); // expected-warning {{bound to
first_num}}
----------------
benedekaibas wrote:
This test is to show where the current checker fails. Because of the iterator
logic the second parameter will never get analyzed since the callback function
stops at the first annotated parameter. With this test I wanted to highlight
the current limitation of the checker.
https://github.com/llvm/llvm-project/pull/200145
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits