[clang] [clang] Extend lifetime analysis to support assignments for pointer-like objects. (PR #99032)

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 06:49:44 PDT 2024


================
@@ -34,6 +34,6 @@ struct basic_string {
 };
 }  // namespace std
 void test(const char* a) {
-  // verify we're emitting the `-Wdangling-assignment` warning.
+  // verify we're emitting the `-Wdangling-assignment-gsl` warning.
   a = std::basic_string().c_str(); // expected-warning {{object backing the pointer a will be destroyed at the end of the full-expression}}
----------------
ilya-biryukov wrote:

I'm a little confused here, since `a` is of type `const char*`, why do we mention the `-gsl` version of the warning here?

https://github.com/llvm/llvm-project/pull/99032


More information about the cfe-commits mailing list