[clang] [LifetimeSafety] Add missing origins stats for lifetime analysis (PR #166568)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 11 02:15:16 PST 2025
================
@@ -0,0 +1,36 @@
+//===- LifetimeStats.cpp - Lifetime Safety Statistics -*------------ C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the data structures and utility function for collection of
+// staticstics related to Lifetimesafety analysis.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Analysis/Analyses/LifetimeSafety/LifetimeStats.h"
+#include "clang/AST/TypeBase.h"
+#include "llvm/Support/raw_ostream.h"
+
+namespace clang::lifetimes {
+void printStats(const LifetimeSafetyStats &Stats) {
+ llvm::errs() << "\n*** LifetimeSafety Missing Origin per QualType: "
+ "(QualType : count) :\n\n";
+ unsigned TotalMissingOrigins = 0;
+ for (const auto &[type, count] : Stats.ExprTypeToMissingOriginCount) {
----------------
usx95 wrote:
Use UpperCamelCase for local variables type, count, stmt
https://github.com/llvm/llvm-project/pull/166568
More information about the cfe-commits
mailing list