diff --git a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h --- a/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -432,6 +432,8 @@ void markInteresting(SymbolRef sym, bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough); + void markNotInteresting(SymbolRef sym); + /// Marks a region as interesting. Different kinds of interestingness will /// be processed differently by visitors (e.g. if the tracking kind is /// condition, will append "will be used as a condition" to the message). @@ -439,6 +441,8 @@ const MemRegion *R, bugreporter::TrackingKind TKind = bugreporter::TrackingKind::Thorough); + void markNotInteresting(const MemRegion *R); + /// Marks a symbolic value as interesting. Different kinds of interestingness /// will be processed differently by visitors (e.g. if the tracking kind is /// condition, will append "will be used as a condition" to the message). diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -2253,6 +2253,14 @@ markInteresting(meta->getRegion(), TKind); } +void PathSensitiveBugReport::markNotInteresting(SymbolRef sym) { + if (!sym) + return; + InterestingSymbols.erase(sym); + if (const auto *meta = dyn_cast(sym)) + markNotInteresting(meta->getRegion()); +} + void PathSensitiveBugReport::markInteresting(const MemRegion *R, bugreporter::TrackingKind TKind) { if (!R) @@ -2265,6 +2273,17 @@ markInteresting(SR->getSymbol(), TKind); } +void PathSensitiveBugReport::markNotInteresting(const MemRegion *R) { + if (!R) + return; + + R = R->getBaseRegion(); + InterestingRegions.erase(R); + + if (const auto *SR = dyn_cast(R)) + markNotInteresting(SR->getSymbol()); +} + void PathSensitiveBugReport::markInteresting(SVal V, bugreporter::TrackingKind TKind) { markInteresting(V.getAsRegion(), TKind);