Skip to content

Commit

Permalink
[analyzer] NFC: RetainCountChecker: Don't dump() symbols into program…
Browse files Browse the repository at this point in the history
… point tags.

We don't need a separate node for every symbol, because whenever the first
symbol leaks, a bug is emitted, the analysis is sinked, and the checker
callback immediately returns due to State variable turning into null,
so we never get to see the second leaking symbol.

Additionally, we are no longer able to break normal analysis while experimenting
with debug dumps.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344538 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
haoNoQ committed Oct 15, 2018
1 parent 5943655 commit 753ce1e
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1314,19 +1314,6 @@ void RetainCountChecker::checkEndFunction(const ReturnStmt *RS,
processLeaks(state, Leaked, Ctx, Pred);
}

const ProgramPointTag *
RetainCountChecker::getDeadSymbolTag(SymbolRef sym) const {
const CheckerProgramPointTag *&tag = DeadSymbolTags[sym];
if (!tag) {
SmallString<64> buf;
llvm::raw_svector_ostream out(buf);
out << "Dead Symbol : ";
sym->dumpToStream(out);
tag = new CheckerProgramPointTag(this, out.str());
}
return tag;
}

void RetainCountChecker::checkDeadSymbols(SymbolReaper &SymReaper,
CheckerContext &C) const {
ExplodedNode *Pred = C.getPredecessor();
Expand All @@ -1342,8 +1329,8 @@ void RetainCountChecker::checkDeadSymbols(SymbolReaper &SymReaper,
if (const RefVal *T = B.lookup(Sym)){
// Use the symbol as the tag.
// FIXME: This might not be as unique as we would like.
const ProgramPointTag *Tag = getDeadSymbolTag(Sym);
state = handleAutoreleaseCounts(state, Pred, Tag, C, Sym, *T);
static CheckerProgramPointTag Tag(this, "DeadSymbolAutorelease");
state = handleAutoreleaseCounts(state, Pred, &Tag, C, Sym, *T);
if (!state)
return;

Expand Down

0 comments on commit 753ce1e

Please sign in to comment.