]> granicus.if.org Git - clang/commitdiff
[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker
authorGeorge Karpenkov <ekarpenkov@apple.com>
Tue, 11 Dec 2018 01:14:17 +0000 (01:14 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Tue, 11 Dec 2018 01:14:17 +0000 (01:14 +0000)
Memoization dose not seem to be necessary, as other statement visitors
run just fine without it,
and in fact seems to be causing memory corruptions.
Just removing it instead of investigating the root cause.

rdar://45945002

Differential Revision: https://reviews.llvm.org/D54921

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348822 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp

index 55516a34d1a78e450e14fbf7c10f049d67837f0d..3f3477b9280f2ba40def8af2214f3775475339a2 100644 (file)
@@ -58,13 +58,12 @@ public:
 
 } // 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 @@ seenBeforeRec(const Stmt *Parent, const Stmt *A, const Stmt *B,
     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,