[clang] [LifetimeSafety] Detect use-after-return (PR #165370)

Kashika Akhouri via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 7 00:49:53 PST 2025


================
@@ -53,6 +53,16 @@ struct Lattice {
   }
 };
 
+static SourceLocation GetFactLoc(const Fact &F) {
+  if (const auto *UF = F.getAs<UseFact>()) {
+    return UF->getUseExpr()->getExprLoc();
+  }
+  if (const auto *OEF = F.getAs<OriginEscapesFact>()) {
+    return OEF->getEscapeExpr()->getExprLoc();
+  }
+  return SourceLocation(); // Invalid SourceLocation
----------------
kashika0112 wrote:

Done

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


More information about the cfe-commits mailing list