[clang] [SSAF][UnsafeBufferAnalysis] Filter out type-constrained pointers from reachable unsafe pointers (PR #209354)

Ziqing Luo via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 19 13:34:41 PDT 2026


================
@@ -233,6 +237,65 @@ class UnsafeBufferReachableAnalysis
 
       updateReachablesWithOutgoings(Node, Worklist);
     }
+  }
+
+  /// \return a lazy range over the pointers in \p UnsafePtrs whose entity is
+  /// NOT type-constrained (per \p TypeConstraints).
+  auto filterNonConstrainedPointers(
+      const EntityPointerLevelSet &UnsafePtrs,
+      const TypeConstrainedPointersAnalysisResult &TypeConstraints) {
+    return llvm::make_filter_range(
+        UnsafePtrs, [&TypeConstraints](const EntityPointerLevel &EPL) {
+          return !TypeConstraints.contains(EPL.getEntity());
+        });
----------------
ziqingluo-90 wrote:

good point. I decided to inline these functions.

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


More information about the cfe-commits mailing list