================
@@ -88,4 +113,33 @@ OriginID OriginManager::getOrCreate(const ValueDecl &D) {
   return NewID;
 }
 
+const llvm::DenseMap<const clang::Expr *, OriginID> &
+OriginManager::getExprToOriginId() const {
+  return ExprToOriginID;
+}
+
+void OriginManager::collectMissingOrigins(Stmt *FunctionBody,
+                                          LifetimeSafetyStats &LSStats) {
+  if (!FunctionBody)
+    return;
+
+  MissingOriginCollector Collector(*this, LSStats.MissingOriginCount);
+  Collector.TraverseStmt(const_cast<Stmt *>(FunctionBody));
+}
+
+bool MissingOriginCollector::VisitExpr(Expr *E) {
+  if (!hasOrigin(E))
+    return true;
+  // Check if we have an origin for this expression
+  const auto &ExprToOriginId = OM.getExprToOriginId();
+  auto It = ExprToOriginId.find(E);
+  if (It == ExprToOriginId.end()) {
+    // No origin found - count this as missing
----------------
usx95 wrote:

nit: end with full stop

https://github.com/llvm/llvm-project/pull/166568
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to