[PATCH] D54921: [analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 10 17:17:28 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC348822: [analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54921?vs=175351&id=177635#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54921/new/

https://reviews.llvm.org/D54921

Files:
  lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp


Index: lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp
+++ lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp
@@ -58,13 +58,12 @@
 
 } // end anonymous namespace
 
-
-using TriBoolTy = Optional<bool>;
-using MemoizationMapTy = llvm::DenseMap<const Stmt *, Optional<TriBoolTy>>;
-
-static TriBoolTy
-seenBeforeRec(const Stmt *Parent, const Stmt *A, const Stmt *B,
-              MemoizationMapTy &Memoization) {
+/// \return Whether {@code A} occurs before {@code B} in traversal of
+/// {@code Parent}.
+/// Conceptually a very incomplete/unsound approximation of happens-before
+/// relationship (A is likely to be evaluated before B),
+/// but useful enough in this case.
+static bool seenBefore(const Stmt *Parent, const Stmt *A, const Stmt *B) {
   for (const Stmt *C : Parent->children()) {
     if (!C) continue;
 
@@ -74,26 +73,9 @@
     if (C == B)
       return false;
 
-    Optional<TriBoolTy> &Cached = Memoization[C];
-    if (!Cached)
-      Cached = seenBeforeRec(C, A, B, Memoization);
-
-    if (Cached->hasValue())
-      return Cached->getValue();
+    return seenBefore(C, A, B);
   }
-
-  return None;
-}
-
-/// \return Whether {@code A} occurs before {@code B} in traversal of
-/// {@code Parent}.
-/// Conceptually a very incomplete/unsound approximation of happens-before
-/// relationship (A is likely to be evaluated before B),
-/// but useful enough in this case.
-static bool seenBefore(const Stmt *Parent, const Stmt *A, const Stmt *B) {
-  MemoizationMapTy Memoization;
-  TriBoolTy Val = seenBeforeRec(Parent, A, B, Memoization);
-  return Val.getValue();
+  return false;
 }
 
 static void emitDiagnostics(BoundNodes &Match,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54921.177635.patch
Type: text/x-patch
Size: 1816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181211/502c2f0b/attachment.bin>


More information about the cfe-commits mailing list