[analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker

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

llvm-svn: 348822
This commit is contained in:
George Karpenkov 2018-12-11 01:14:17 +00:00
parent d1081ec508
commit e8240f4df0
1 changed files with 8 additions and 26 deletions

View File

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