================
@@ -410,3 +411,35 @@ void no_dangling_by_value_argument() {
   // The returned reference does not dangle.
   takes_by_value(BoundToSelf());
 }
+
+int multi_params_annotated(int *p_one [[clang::lifetimebound]], int *p_two 
[[clang::lifetimebound]]);
+
+int test_multi_param_highlight() {
+  int local_one = 1, local_two = 2;
+  // expected-note@-1 {{'local_one' initialized here}}
+  // expected-note@-2 {{'local_two' initialized here}}
+  return multi_params_annotated(&local_one, &local_two);
+  // expected-warning@-1 {{address of stack memory associated with local 
variable 'local_one' returned}}
+  // expected-warning@-2 {{address of stack memory associated with local 
variable 'local_two' returned}}
+  // expected-warning@-3 {{Returning value bound to 'local_one' that will go 
out of scope}}
+  // expected-note@-4    {{Value's lifetime bound to the lifetime of 
'local_one' here}}
+  // expected-note@-5    {{Lifetime of 'local_one' ended here}}
+  // expected-warning@-6 {{Returning value bound to 'local_two' that will go 
out of scope}}
+  // expected-note@-7    {{Value's lifetime bound to the lifetime of 
'local_two' here}}
+  // expected-note@-8    {{Lifetime of 'local_two' ended here}}
+
+  // CHECK: :[[@LINE-10]]:33: note: Value's lifetime bound to the lifetime of 
'local_one' here
----------------
isuckatcs wrote:

Keeping this check only with the column number is sufficient imo.

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

Reply via email to