9#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_LOGGER_H
10#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_LOGGER_H
13#include "llvm/Support/raw_ostream.h"
19class TypeErasedDataflowAnalysis;
20struct TypeErasedDataflowAnalysisState;
33 static std::unique_ptr<Logger>
textual(llvm::raw_ostream &);
36 static std::unique_ptr<Logger>
37 html(std::function<std::unique_ptr<llvm::raw_ostream>()>);
70 void log(llvm::function_ref<
void(llvm::raw_ostream &)> Emit) {
74 llvm::raw_string_ostream OS(S);
82 Logger(
bool ShouldLogText =
true) : ShouldLogText(ShouldLogText) {}
86 virtual void logText(llvm::StringRef) {}
Represents a single basic block in a source-level CFG.
Represents a top-level expression in a basic block.
Holds CFG with additional information derived from it that is needed to perform dataflow analysis.
A logger is notified as the analysis progresses.
virtual void enterBlock(const CFGBlock &, bool PostVisit)
Called when we start (re-)processing a block in the CFG.
virtual void endAnalysis()
static std::unique_ptr< Logger > textual(llvm::raw_ostream &)
A logger that simply writes messages to the specified ostream in real time.
virtual void enterElement(const CFGElement &)
Called when we start processing an element in the current CFG block.
virtual ~Logger()=default
virtual void recordState(TypeErasedDataflowAnalysisState &)
Records the analysis state computed for the current program point.
void log(llvm::function_ref< void(llvm::raw_ostream &)> Emit)
Called by the framework or user code to report some event.
Logger(bool ShouldLogText=true)
ShouldLogText should be false for trivial loggers that ignore logText().
static std::unique_ptr< Logger > html(std::function< std::unique_ptr< llvm::raw_ostream >()>)
A logger that builds an HTML UI to inspect the analysis results.
virtual void beginAnalysis(const AdornedCFG &, TypeErasedDataflowAnalysis &)
Called by the framework as we start analyzing a new function or statement.
static Logger & null()
Returns a dummy logger that does nothing.
virtual void blockConverged()
Records that the analysis state for the current block is now final.
Type-erased base class for dataflow analyses built on a single lattice type.
Dataflow Directional Tag Classes.
Type-erased model of the program at a given program point.