This is an archive of the discontinued LLVM Phabricator instance.

[NFC][analyzer] Transitive interestingness in BugReporter
Needs ReviewPublic

Authored by gamesh411 on May 11 2022, 2:24 AM.

Details

Summary

When making a region interesting, also mark the subregions interesting.

Original author: steakhal

Diff Detail

Event Timeline

gamesh411 created this revision.May 11 2022, 2:24 AM
Herald added a project: Restricted Project. · View Herald Transcript
gamesh411 requested review of this revision.May 11 2022, 2:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 11 2022, 2:24 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

I think since it changes how taint spreads, this patch deserves a test.
Could you please demonstrate the correctness of this patch?

clang/lib/StaticAnalyzer/Core/BugReporter.cpp
2267
2361–2366

The comment of symbol_iterator suggests that for SymbolData this will be always the symbol data itself; thus it would iterate only once.
Is this the case? If so, can we replace the loop with just the isa<SymbolData>(sym) check?

/// Iterator over symbols that the current symbol depends on.
///
/// For SymbolData, it's the symbol itself; for expressions, it's the
/// expression symbol and all the operands in it. Note, SymbolDerived is
/// treated as SymbolData - the iterator will NOT visit the parent region.
class symbol_iterator {...
2363

Is it problem if markNotInteresting is used on a symbol that was marked interesting and has subregions?

Is it problem if markNotInteresting is used on a symbol that was marked interesting and has subregions?

In that case, the sub-symbols will remain still interesting.
We might need to think about this and also make markNotInteresting() transitive. I'm not immediately sure about the implications, but a test demonstrating the transitivity should demonstrate this as well in a slightly modified example.
The test file for this should be clang/unittests/StaticAnalyzer/BugReportInterestingnessTest.cpp though.

There are only two checkers using this API: stream checker and the smart ptr checker.
We should craft a real-worl-looking example pointing out the difference between the *transitive* and *direct* markNotInteresting() implementation.