================
@@ -112,8 +114,17 @@ class LifetimeChecker {
for (const auto &[LID, Warning] : FinalWarningsMap) {
const Loan &L = FactMgr.getLoanMgr().getLoan(LID);
const Expr *IssueExpr = L.IssueExpr;
- Reporter->reportUseAfterFree(IssueExpr, Warning.UseExpr,
- Warning.ExpiryLoc, Warning.ConfidenceLevel);
+ const Fact *CausingFact = Warning.CausingFact;
+ Confidence Confidence = Warning.ConfidenceLevel;
+ SourceLocation ExpiryLoc = Warning.ExpiryLoc;
+
+ if (const auto *UF = CausingFact->getAs<UseFact>()) {
+ Reporter->reportUseAfterFree(IssueExpr, UF->getUseExpr(), ExpiryLoc,
+ Confidence);
+ } else if (const auto *OEF = CausingFact->getAs<OriginEscapesFact>()) {
+ Reporter->reportUseAfterReturn(IssueExpr, OEF->getEscapeExpr(),
+ ExpiryLoc, Confidence);
+ }
----------------
usx95 wrote:
add a final `else` with `llvm_unreachable("unhandled causing fact");`
https://github.com/llvm/llvm-project/pull/165370
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits