================
@@ -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}}
----------------
isuckatcs wrote:

Hmm, in this case the function takes 2 reference arguments, but only returns 
one. How can both be lifetime-bounded?

I guess the function body might be something like this:
```c++
int& f(int& a [[clang::lifetimebound]], int& b [[clang::lifetimebound]]) {
  if(cond())
    return a;

  return b;
}
```

https://github.com/llvm/llvm-project/pull/200145
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to