[clang] [LifetimeSafety] Add missing origins stats for lifetime analysis (PR #166568)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 26 00:34:18 PST 2025


================
@@ -39,6 +46,17 @@ OriginID OriginManager::get(const Expr &E) {
   auto It = ExprToOriginID.find(&E);
   if (It != ExprToOriginID.end())
     return It->second;
+
+  // if the expression has no specific origin, increment the missing origin
+  // counter.
+  std::string ExprStr(E.getStmtClassName());
+  ExprStr = ExprStr + "<" + E.getType().getAsString() + ">";
+  auto CountIt = ExprTypeToMissingOriginCount.find(ExprStr);
+  if (CountIt == ExprTypeToMissingOriginCount.end()) {
+    ExprTypeToMissingOriginCount[ExprStr] = 1;
+  } else {
+    CountIt->second++;
+  }
----------------
usx95 wrote:

Thanks.

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


More information about the cfe-commits mailing list