[llvm-branch-commits] [clang] [LifetimeSafety] Revamp test suite using unittests (PR #149158)

Utkarsh Saxena via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jul 17 10:36:10 PDT 2025


================
@@ -807,17 +838,27 @@ class LoanPropagationAnalysis
 // - Modify origin liveness analysis to answer `bool isLive(Origin O, Point P)`
 // - Using the above three to perform the final error reporting.
 // ========================================================================= //
-} // anonymous namespace
 
-void runLifetimeSafetyAnalysis(const DeclContext &DC, const CFG &Cfg,
-                               AnalysisDeclContext &AC) {
+// ========================================================================= //
+//                  LifetimeSafetyAnalysis Class Implementation
+// ========================================================================= //
+
+LifetimeSafetyAnalysis::~LifetimeSafetyAnalysis() = default;
----------------
usx95 wrote:

In general yes. But we have some forward decls with members as unique_ptr to them:
```
  std::unique_ptr<LifetimeFactory> Factory;
  std::unique_ptr<FactManager> FactMgr;
  std::unique_ptr<LoanPropagationAnalysis> LoanPropagation;
```
By defining the destructor here, we are delaying the need for the class `LifetimeSafetyAnalysis` to be a complete type (specially while parsing the `LifetimeSafetyTest.cpp` TU).

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


More information about the llvm-branch-commits mailing list