clang: lib/Analysis/CFGStmtMap.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#include "llvm/ADT/DenseMap.h"

18#include

19

20using namespace clang;

21

22typedef llvm::DenseMap<const Stmt*, CFGBlock*> SMap;

24

26

29 const Stmt *X = S;

30

31

32

33 while (X) {

34 SMap::iterator I = SM->find(X);

35 if (I != SM->end()) {

37

38 if (X != S)

39 (*SM)[X] = B;

40 return B;

41 }

42

43 X = PM->getParentIgnoreParens(X);

44 }

45

46 return nullptr;

47}

48

50

53 std::optional CS = CE.getAs<CFGStmt>();

54 if (!CS)

55 continue;

56

58

59

60 if (Entry)

61 continue;

62

63 Entry = B;

64

65 }

66

67

69 SM[Label] = B;

70

71

72

73

75 SM[Term] = B;

76}

77

79 if (C || !PM)

80 return nullptr;

81

83

84

85

88

89 return new CFGStmtMap(PM, SM);

90}

91

static SMap * AsMap(void *m)

Definition CFGStmtMap.cpp:23

static void Accumulate(SMap &SM, CFGBlock *B)

Definition CFGStmtMap.cpp:49

llvm::DenseMap< const Stmt *, CFGBlock * > SMap

Definition CFGStmtMap.cpp:22

Represents a single basic block in a source-level CFG.

ElementList::iterator iterator

Stmt * getTerminatorStmt()

Represents a top-level expression in a basic block.

std::optional< T > getAs() const

Convert to the specified CFGElement type, returning std::nullopt if this CFGElement is not of the des...

const CFGBlock * getBlock(const Stmt *S) const

Returns the CFGBlock the specified Stmt* appears in.

Definition CFGStmtMap.cpp:27

~CFGStmtMap()

Definition CFGStmtMap.cpp:25

static CFGStmtMap * Build(CFG *C, ParentMap *PM)

Returns a new CFGMap for the given CFG.

Definition CFGStmtMap.cpp:78

Represents a source-level, intra-procedural CFG that represents the control-flow of a Stmt.

Stmt - This represents one statement.

The JSON file list parser is used to communicate input to InstallAPI.