[clang] Fix `-Wlifetime-safety-dangling-global-moved` not being implied by `-Wlifetime-safety-all` (PR #204891)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 20 12:35:01 PDT 2026


sipher-01 wrote:

Thanks for the feedback! I've made the following updates:

   Added a test case to dangling-global.cpp that exercises the moved 
   behavior with a global variable. Since move semantics don't apply to 
   raw int*, I used std::string_view as the global and std::move() to 
   trigger the -moved variant, following the same pattern as the existing 
   moved tests in dangling-field.cpp.

   Added a second RUN line with -Wlifetime-safety-dangling-global-moved 
   and -verify=moved so the moved annotations don't interfere with the 
   existing tests. Also added -Wno-lifetime-safety-dangling-global-moved 
   to the first RUN line to keep the existing tests clean.

Both RUN lines verified locally and passing.

If their is any issue or change require do let me know 

(used a little bit AI for learning and helping purpose so any suggestion is helpful :) ) 

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


More information about the cfe-commits mailing list