clang: include/clang/AST/ParentMapContext.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_CLANG_AST_PARENTMAPCONTEXT_H

15#define LLVM_CLANG_AST_PARENTMAPCONTEXT_H

16

19

21class DynTypedNodeList;

22

24public:

26

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

54

56

57

59

62

66

68

69private:

72 std::unique_ptr Parents;

73};

74

78

79public:

81 : Ctx(ASTCtx.getParentMapContext()) {

82 TK = Ctx.getTraversalKind();

83 if (ScopeTK)

84 Ctx.setTraversalKind(*ScopeTK);

85 }

86

88};

89

90

91

93 union {

96 };

97 bool IsSingleNode;

98

99public:

102 }

103

106 }

107

110 }

111

114 }

115

118

120 assert(N < size() && "Out of bounds!");

121 return *(begin() + N);

122 }

123};

124

125template

128}

129

130template

133}

134

135template <>

138}

139

140}

141

142#endif

Defines the clang::ASTContext interface.

Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...

ParentMapContext & getParentMapContext()

Returns the dynamic AST node parent map context.

DynTypedNodeList getParents(const NodeT &Node)

Forwards to get node parents from the ParentMapContext.

Container for either a single DynTypedNode or for an ArrayRef to DynTypedNode.

DynTypedNodeList(const DynTypedNode &N)

DynTypedNodeList(ArrayRef< DynTypedNode > A)

const DynTypedNode * end() const

ArrayRef< DynTypedNode > Nodes

const DynTypedNode & operator[](size_t N) const

const DynTypedNode * begin() const

A dynamically typed AST node container.

static DynTypedNode create(const T &Node)

Creates a DynTypedNode from Node.

This represents one expression.

const Expr * traverseIgnored(const Expr *E) const

void clear()

Clear parent maps.

void setTraversalKind(TraversalKind TK)

TraversalKind getTraversalKind() const

DynTypedNodeList getParents(const NodeT &Node)

Returns the parents of the given node (within the traversal scope).

TraversalKindScope(ASTContext &ASTCtx, std::optional< TraversalKind > ScopeTK)

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

TraversalKind

Defines how we descend a level in the AST when we pass through expressions.

@ TK_AsIs

Will traverse all child nodes.