[clang] [analyzer] Implement binary operations on LazyCompoundVals (PR #106982)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 2 08:18:06 PDT 2024


================
@@ -718,6 +718,91 @@ class NoStateChangeFuncVisitor : public BugReporterVisitor {
                                    PathSensitiveBugReport &R) final;
 };
 
+/// Put a diagnostic on return statement of all inlined functions
+/// for which  the region of interest \p RegionOfInterest was passed into,
+/// but not written inside, and it has caused an undefined read or a null
+/// pointer dereference outside.
+class NoStoreFuncVisitor final : public NoStateChangeFuncVisitor {
+  const SubRegion *RegionOfInterest;
+  MemRegionManager &MmrMgr;
+  const SourceManager &SM;
+  const PrintingPolicy &PP;
+
+  /// Recursion limit for dereferencing fields when looking for the
+  /// region of interest.
+  /// The limit of two indicates that we will dereference fields only once.
+  static const unsigned DEREFERENCE_LIMIT = 2;
----------------
NagyDonat wrote:

Consider replacing this with `MAX_DEREFERENCE_COUNT = 1` which would be mostly self-documenting. (However, the current name is also OK if you prefer it.)

EDIT: Now I see that this is not new code, just moved from elsewhere. Feel free to ignore this if you're not interested.

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


More information about the cfe-commits mailing list