[clang] [clang] Infer lifetime_capture_by for STL containers (PR #117122)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 05:58:57 PST 2024
================
@@ -366,3 +366,82 @@ void use() {
capture3(std::string(), x3); // expected-warning {{object whose reference is captured by 'x3' will be destroyed at the end of the full-expression}}
}
} // namespace temporary_views
+
+// ****************************************************************************
+// Inferring annotation for STL containers
+// ****************************************************************************
----------------
hokein wrote:
Instead of thoroughly testing diagnostics triggered by the implicitly-added `lifetime_capture_by` attribute, I think we can verify the attribute directly by inspecting the AST node( see `attr-gsl-owner-pointer.cpp`), and include a few small smoke tests here.
https://github.com/llvm/llvm-project/pull/117122
More information about the cfe-commits
mailing list