LLVM 20.0.0git
Classes | Public Member Functions | List of all members
llvm::sandboxir::IRSnapshotChecker Class Reference

A class that saves hashes and textual IR snapshots of functions in a SandboxIR Context, and does hash comparison when expectNoDiff is called. More...

#include "llvm/SandboxIR/Tracker.h"

Public Member Functions

 IRSnapshotChecker (Context &Ctx)
 
void save ()
 Saves a snapshot of the current state.
 
void expectNoDiff ()
 Checks current state against saved state, crashes if different.
 

Detailed Description

A class that saves hashes and textual IR snapshots of functions in a SandboxIR Context, and does hash comparison when expectNoDiff is called.

If hashes differ, it prints textual IR for both old and new versions to aid debugging.

This is used as an additional debug check when reverting changes to SandboxIR, to verify the reverted state matches the initial state.

Definition at line 77 of file Tracker.h.

Constructor & Destructor Documentation

◆ IRSnapshotChecker()

llvm::sandboxir::IRSnapshotChecker::IRSnapshotChecker ( Context Ctx)
inline

Definition at line 104 of file Tracker.h.

Member Function Documentation

◆ expectNoDiff()

void IRSnapshotChecker::expectNoDiff ( )

Checks current state against saved state, crashes if different.

Definition at line 74 of file Tracker.cpp.

References llvm_unreachable.

Referenced by llvm::sandboxir::Tracker::revert().

◆ save()

void IRSnapshotChecker::save ( )

Saves a snapshot of the current state.

If there was any previous snapshot, it will be replaced with the new one.

Definition at line 72 of file Tracker.cpp.

Referenced by llvm::sandboxir::Tracker::save().


The documentation for this class was generated from the following files: