[all-commits] [llvm/llvm-project] 641910: [LifetimeSafety] Add language option for experimen...

Utkarsh Saxena via All-commits all-commits at lists.llvm.org
Tue Aug 5 01:59:30 PDT 2025


  Branch: refs/heads/release/21.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 6419104d187807eafc61ae7dfda55b4101e8fd6f
      https://github.com/llvm/llvm-project/commit/6419104d187807eafc61ae7dfda55b4101e8fd6f
  Author: Utkarsh Saxena <usx at google.com>
  Date:   2025-08-05 (Tue, 05 Aug 2025)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    M clang/test/Sema/warn-lifetime-safety-dataflow.cpp

  Log Message:
  -----------
  [LifetimeSafety] Add language option for experimental lifetime safety (#149592)

Add a language option flag for experimental lifetime safety analysis in C++.

This change provides a language option to control the experimental lifetime safety analysis feature, making it more explicit and easier to enable/disable. Previously, the feature was controlled indirectly through a diagnostic warning flag, which we do not want to accidentally enable with `-Weverything` (atm)!

- Added a new language option `EnableLifetimeSafety` in `LangOptions.def` for experimental lifetime safety analysis in C++
- Added corresponding driver options `-fexperimental-lifetime-safety` and `-fno-experimental-lifetime-safety` in `Options.td`
- Modified `AnalysisBasedWarnings.cpp` to use the new language option flag instead of checking if a specific diagnostic is ignored
- Updated a test case to use the new flag instead of relying on the warning flag alone

(cherry picked from commit 0d0478903474b2e53c874427e3d6eb2ed7567e50)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list