class Tracker

Declaration

class Tracker : public RefCountedBase { /* full declaration omitted */ };

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:166

Inherits from: RefCountedBase

Member Variables

private clang::ento::PathSensitiveBugReport& Report
private std::list<ExpressionHandlerPtr> ExpressionHandlers
private std::list<StoreHandlerPtr> StoreHandlers

Method Overview

  • protected Tracker(clang::ento::PathSensitiveBugReport & Report)
  • public void addHighPriorityHandler(clang::ento::bugreporter::Tracker::ExpressionHandlerPtr SH)
  • public void addHighPriorityHandler(clang::ento::bugreporter::Tracker::StoreHandlerPtr SH)
  • public template <class HandlerType, class... Args>void addHighPriorityHandler(Args &&... ConstructorArgs)
  • public void addLowPriorityHandler(clang::ento::bugreporter::Tracker::ExpressionHandlerPtr SH)
  • public void addLowPriorityHandler(clang::ento::bugreporter::Tracker::StoreHandlerPtr SH)
  • public template <class HandlerType, class... Args>void addLowPriorityHandler(Args &&... ConstructorArgs)
  • public static clang::ento::bugreporter::TrackerRef create(clang::ento::PathSensitiveBugReport & Report)
  • public clang::ento::PathSensitiveBugReport & getReport()
  • public virtual clang::ento::PathDiagnosticPieceRef handle(clang::ento::bugreporter::StoreInfo SI, clang::ento::BugReporterContext & BRC, clang::ento::bugreporter::TrackingOptions Opts)
  • public virtual clang::ento::bugreporter::Tracker::Result track(const clang::Expr * E, const clang::ento::ExplodedNode * N, clang::ento::bugreporter::TrackingOptions Opts = {})
  • public virtual clang::ento::bugreporter::Tracker::Result track(clang::ento::SVal V, const clang::ento::MemRegion * R, clang::ento::bugreporter::TrackingOptions Opts = {}, const clang::StackFrameContext * Origin = nullptr)
  • public virtual ~Tracker()

Methods

Tracker(
    clang::ento::PathSensitiveBugReport& Report)

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:177

Parameters

clang::ento::PathSensitiveBugReport& Report
The bug report to which visitors should be attached.

void addHighPriorityHandler(
    clang::ento::bugreporter::Tracker::
        ExpressionHandlerPtr SH)

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:244

Parameters

clang::ento::bugreporter::Tracker:: ExpressionHandlerPtr SH

void addHighPriorityHandler(
    clang::ento::bugreporter::Tracker::
        StoreHandlerPtr SH)

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:260

Parameters

clang::ento::bugreporter::Tracker::StoreHandlerPtr SH

template <class HandlerType, class... Args>
void addHighPriorityHandler(
    Args&&... ConstructorArgs)

Description

Add custom expression/store handler with the highest priority See other overloads for explanation.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:276

Templates

HandlerType
Args

Parameters

Args&&... ConstructorArgs

void addLowPriorityHandler(
    clang::ento::bugreporter::Tracker::
        ExpressionHandlerPtr SH)

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:252

Parameters

clang::ento::bugreporter::Tracker:: ExpressionHandlerPtr SH

void addLowPriorityHandler(
    clang::ento::bugreporter::Tracker::
        StoreHandlerPtr SH)

Description

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.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:268

Parameters

clang::ento::bugreporter::Tracker::StoreHandlerPtr SH

template <class HandlerType, class... Args>
void addLowPriorityHandler(
    Args&&... ConstructorArgs)

Description

Add custom expression/store handler with the lowest priority See other overloads for explanation.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:285

Templates

HandlerType
Args

Parameters

Args&&... ConstructorArgs

static clang::ento::bugreporter::TrackerRef
create(
    clang::ento::PathSensitiveBugReport& Report)

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:182

Parameters

clang::ento::PathSensitiveBugReport& Report

clang::ento::PathSensitiveBugReport& getReport()

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:186

virtual clang::ento::PathDiagnosticPieceRef
handle(clang::ento::bugreporter::StoreInfo SI,
       clang::ento::BugReporterContext& BRC,
       clang::ento::bugreporter::TrackingOptions
           Opts)

Description

Handle the store operation and produce the note. NOTE: this method is designed for sub-trackers and visitors.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:237

Parameters

clang::ento::bugreporter::StoreInfo SI
The information fully describing the store.
clang::ento::BugReporterContext& BRC
clang::ento::bugreporter::TrackingOptions Opts
Tracking options specifying how we got to it.

virtual clang::ento::bugreporter::Tracker::Result
track(const clang::Expr* E,
      const clang::ento::ExplodedNode* N,
      clang::ento::bugreporter::TrackingOptions
          Opts = {})

Description

Track expression value back to its point of origin.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:212

Parameters

const clang::Expr* E
The expression value which we are tracking
const clang::ento::ExplodedNode* N
A node "downstream" from the evaluation of the statement.
clang::ento::bugreporter::TrackingOptions Opts = {}
Tracking options specifying how we want to track the value.

virtual clang::ento::bugreporter::Tracker::Result
track(clang::ento::SVal V,
      const clang::ento::MemRegion* R,
      clang::ento::bugreporter::TrackingOptions
          Opts = {},
      const clang::StackFrameContext* Origin =
          nullptr)

Description

Track how the value got stored into the given region and where it came from.

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:228

Parameters

clang::ento::SVal V
We're searching for the store where \c R received this value.
const clang::ento::MemRegion* R
The region we're tracking.
clang::ento::bugreporter::TrackingOptions Opts = {}
Tracking options specifying how we want to track the value.
const clang::StackFrameContext* Origin = nullptr
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.

virtual ~Tracker()

Declared at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h:180