clang: include/clang/Analysis/FlowSensitive/Logger.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_LOGGER_H

10#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_LOGGER_H

11

13#include "llvm/Support/raw_ostream.h"

14#include

15

17

21

22

23

24

25

26

28public:

29

31

32

33 static std::unique_ptr textual(llvm::raw_ostream &);

34

35

36 static std::unique_ptr

38

40

41

42

46

47

48

49

50

51

52

53

54

56

57

58

60

61

63

65

66

67

68

69

70 void log(llvm::function_ref<void(llvm::raw_ostream &)> Emit) {

71 if (!ShouldLogText)

72 return;

73 std::string S;

74 llvm::raw_string_ostream OS(S);

75 Emit(OS);

76 logText(S);

77 }

78

79protected:

80

81

82 Logger(bool ShouldLogText = true) : ShouldLogText(ShouldLogText) {}

83

84private:

85 bool ShouldLogText;

86 virtual void logText(llvm::StringRef) {}

87};

88

89}

90

91#endif

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.

virtual void enterBlock(const CFGBlock &, bool PostVisit)

Called when we start (re-)processing a block in the CFG.

Definition Logger.h:55

virtual void endAnalysis()

Definition Logger.h:45

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.

Definition Logger.h:59

virtual ~Logger()=default

virtual void recordState(TypeErasedDataflowAnalysisState &)

Records the analysis state computed for the current program point.

Definition Logger.h:62

void log(llvm::function_ref< void(llvm::raw_ostream &)> Emit)

Called by the framework or user code to report some event.

Definition Logger.h:70

Logger(bool ShouldLogText=true)

ShouldLogText should be false for trivial loggers that ignore logText().

Definition Logger.h:82

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.

Definition Logger.h:43

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.

Definition Logger.h:64

Type-erased base class for dataflow analyses built on a single lattice type.

Dataflow Directional Tag Classes.

int const char * function

Type-erased model of the program at a given program point.