================
@@ -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
+ std::string ExprStr = std::string(E->getStmtClassName()) + "<" +
+ E->getType().getAsString() + ">";
----------------
usx95 wrote:
nit: Let's not include <> which have a different semantics (template arguments).
Maybe: Something like `CXXOperatorCallExpr (Type: basic_string<char>, Count:
3)`
https://github.com/llvm/llvm-project/pull/166568
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits