================
@@ -86,3 +86,48 @@ View annotated_decl_but_not_def_not_returned(const MyObj 
&obj [[clang::lifetimeb
 View annotated_decl_but_not_def_not_returned(const MyObj &obj) {
   return not_lb(obj);
 }
+
+struct BadThisReturn {
+  MyObj data;
+
+  View get() const [[clang::lifetimebound]] { // expected-warning {{could not 
verify that the return value can be lifetime bound to the implicit this 
parameter}}
+    return not_lb(data);
+  }
+};
+
+struct GoodThisReturn {
+  MyObj data;
+
+  View get() const [[clang::lifetimebound]] {
+    return data;
+  }
+};
+
+struct RedeclaredThis {
+  MyObj data;
+  View get() const [[clang::lifetimebound]]; // expected-warning {{could not 
verify that the return value can be lifetime bound to the implicit this 
parameter}}
----------------
usx95 wrote:

For a separate PR. To make this diagnositc helpful in cases we have diagnostics 
at decl and not def, we should also attach a note to the function definition we 
analysed to come to this conclusion (something like "while analysing this 
function defintion").

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

Reply via email to