clang 20.0.0git
|
A generalized component for tracking expressions, values, and stores. More...
#include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
Classes | |
struct | Result |
Describes a tracking result with the most basic information of what was actually done (or not done). More... | |
Public Member Functions | |
virtual | ~Tracker ()=default |
PathSensitiveBugReport & | getReport () |
virtual Result | track (const Expr *E, const ExplodedNode *N, TrackingOptions Opts={}) |
Track expression value back to its point of origin. | |
virtual Result | track (SVal V, const MemRegion *R, TrackingOptions Opts={}, const StackFrameContext *Origin=nullptr) |
Track how the value got stored into the given region and where it came from. | |
virtual PathDiagnosticPieceRef | handle (StoreInfo SI, BugReporterContext &BRC, TrackingOptions Opts) |
Handle the store operation and produce the note. | |
void | addHighPriorityHandler (ExpressionHandlerPtr SH) |
Add custom expression handler with the highest priority. | |
void | addLowPriorityHandler (ExpressionHandlerPtr SH) |
Add custom expression handler with the lowest priority. | |
void | addHighPriorityHandler (StoreHandlerPtr SH) |
Add custom store handler with the highest priority. | |
void | addLowPriorityHandler (StoreHandlerPtr SH) |
Add custom store handler with the lowest priority. | |
template<class HandlerType , class... Args> | |
void | addHighPriorityHandler (Args &&... ConstructorArgs) |
Add custom expression/store handler with the highest priority. | |
template<class HandlerType , class... Args> | |
void | addLowPriorityHandler (Args &&... ConstructorArgs) |
Add custom expression/store handler with the lowest priority. | |
Static Public Member Functions | |
static TrackerRef | create (PathSensitiveBugReport &Report) |
Protected Member Functions | |
Tracker (PathSensitiveBugReport &Report) | |
A generalized component for tracking expressions, values, and stores.
Tracker aimes at providing a sensible set of default behaviors that can be used by any checker, while providing mechanisms to hook into any part of the tracking process and insert checker-specific logic.
Definition at line 173 of file BugReporterVisitors.h.
|
protected |
Report | The bug report to which visitors should be attached. |
Definition at line 2630 of file BugReporterVisitors.cpp.
|
virtualdefault |
|
inline |
Add custom expression/store handler with the highest priority.
See other overloads for explanation.
Definition at line 283 of file BugReporterVisitors.h.
References addHighPriorityHandler().
|
inline |
Add custom expression handler with the highest priority.
It means that it will be asked for handling first, and can prevent other handlers from running if decides to interrupt.
Definition at line 251 of file BugReporterVisitors.h.
Referenced by addHighPriorityHandler().
|
inline |
Add custom store handler with the highest priority.
It means that it will be asked for handling first, and will prevent other handlers from running if it produces non-null note.
Definition at line 267 of file BugReporterVisitors.h.
|
inline |
Add custom expression/store handler with the lowest priority.
See other overloads for explanation.
Definition at line 292 of file BugReporterVisitors.h.
References addLowPriorityHandler().
|
inline |
Add custom expression handler with the lowest priority.
It means that it will be asked for handling last, and other handlers can prevent it from running if any of them decides to interrupt.
Definition at line 259 of file BugReporterVisitors.h.
Referenced by addLowPriorityHandler().
|
inline |
Add custom store handler with the lowest priority.
It means that it will be asked for handling last, only if all other handlers failed to produce the note.
Definition at line 275 of file BugReporterVisitors.h.
|
inlinestatic |
Definition at line 189 of file BugReporterVisitors.h.
Referenced by clang::ento::bugreporter::trackExpressionValue(), and clang::ento::bugreporter::trackStoredValue().
|
inline |
Definition at line 193 of file BugReporterVisitors.h.
|
virtual |
Handle the store operation and produce the note.
SI | The information fully describing the store. |
Opts | Tracking options specifying how we got to it. |
NOTE: this method is designed for sub-trackers and visitors.
Definition at line 2677 of file BugReporterVisitors.cpp.
|
virtual |
Track expression value back to its point of origin.
E | The expression value which we are tracking |
N | A node "downstream" from the evaluation of the statement. |
Opts | Tracking options specifying how we want to track the value. |
Definition at line 2643 of file BugReporterVisitors.cpp.
References clang::ento::bugreporter::Tracker::Result::combineWith(), E, findNodeForExpression(), peelOffOuterExpr(), and clang::ento::bugreporter::Tracker::Result::WasInterrupted.
|
virtual |
Track how the value got stored into the given region and where it came from.
V | We're searching for the store where R received this value. |
R | The region we're tracking. |
Opts | Tracking options specifying how we want to track the value. |
Origin | Only adds notes when the last store happened in a different stackframe to this one. Disregarded if the tracking kind is thorough. This is useful, because for non-tracked regions, notes about changes to its value in a nested stackframe could be pruned, and this visitor can prevent that without polluting the bugpath too much. |
Definition at line 2668 of file BugReporterVisitors.cpp.
References clang::ento::PathSensitiveBugReport::addVisitor(), and V.