[PATCH] D103631: [analyzer] Turn TrackControlDependencyCond into a tracking visitor
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 3 09:52:50 PDT 2021
vsavchenko created this revision.
vsavchenko added reviewers: NoQ, xazax.hun, martong, steakhal, Szelethus, manas, RedDocMD.
Herald added subscribers: ASDenysPetrov, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
vsavchenko requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103631
Files:
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -1855,14 +1855,17 @@
/// An error is emitted at line 3. This visitor realizes that the branch
/// on line 2 is a control dependency of line 3, and tracks it's condition via
/// trackExpressionValue().
-class TrackControlDependencyCondBRVisitor final : public BugReporterVisitor {
+class TrackControlDependencyCondBRVisitor final
+ : public TrackingBugReporterVisitor {
const ExplodedNode *Origin;
ControlDependencyCalculator ControlDeps;
llvm::SmallSet<const CFGBlock *, 32> VisitedBlocks;
public:
- TrackControlDependencyCondBRVisitor(const ExplodedNode *O)
- : Origin(O), ControlDeps(&O->getCFG()) {}
+ TrackControlDependencyCondBRVisitor(TrackerRef ParentTracker,
+ const ExplodedNode *O)
+ : TrackingBugReporterVisitor(ParentTracker), Origin(O),
+ ControlDeps(&O->getCFG()) {}
void Profile(llvm::FoldingSetNodeID &ID) const override {
static int x = 0;
@@ -1960,9 +1963,9 @@
// isn't sufficient, because a new visitor is created for each tracked
// expression, hence the BugReport level set.
if (BR.addTrackedCondition(N)) {
- bugreporter::trackExpressionValue(
- N, Condition, BR, bugreporter::TrackingKind::Condition,
- /*EnableNullFPSuppression=*/false);
+ getParentTracker().track(Condition, N,
+ {bugreporter::TrackingKind::Condition,
+ /*EnableNullFPSuppression=*/false});
return constructDebugPieceForTrackedCondition(Condition, N, BRC);
}
}
@@ -2078,7 +2081,8 @@
if (LVState->getAnalysisManager()
.getAnalyzerOptions()
.ShouldTrackConditions) {
- Report.addVisitor<TrackControlDependencyCondBRVisitor>(InputNode);
+ Report.addVisitor<TrackControlDependencyCondBRVisitor>(
+ &getParentTracker(), InputNode);
Result.FoundSomethingToTrack = true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103631.349593.patch
Type: text/x-patch
Size: 2193 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210603/ea7b2525/attachment.bin>
More information about the cfe-commits
mailing list