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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16#ifndef LLVM_CLANG_AST_DYNAMIC_RECURSIVE_AST_VISITOR_H

17#define LLVM_CLANG_AST_DYNAMIC_RECURSIVE_AST_VISITOR_H

18

22

24class ASTContext;

25

26

27

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

53

54

56public:

57

59

60

62

63

64

66

67

69

70protected:

78

79public:

80 virtual void anchor();

82

83

84

86

87

88

89

90

91

93

94

95

96

97

98

99

101

102

103

104

105

107

108

109

110

111

112

114

115

116

117

119

120

121

122

123

126

127

128

129

131

132

133

134

135

137

138

139

140

141

142

144

145

146

147

148

149

151

152

153

154

155

157

158

159

160

161

162

164

165

166

167

168

170

171

172

173

174

175

177

178

179

180

181

182

184

185

186

187

188

190

191

199

200

206

207

212

213

214

215

217

218

219

220

221

222

225

226#define DEF_TRAVERSE_TMPL_INST(kind) \

227 virtual bool TraverseTemplateInstantiations(kind##TemplateDecl *D);

231#undef DEF_TRAVERSE_TMPL_INST

232

233

234#define ABSTRACT_DECL(DECL)

235#define DECL(CLASS, BASE) virtual bool Traverse##CLASS##Decl(CLASS##Decl *D);

236#include "clang/AST/DeclNodes.inc"

237

238#define DECL(CLASS, BASE) \

239 bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D); \

240 virtual bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }

241#include "clang/AST/DeclNodes.inc"

242

243

244#define ABSTRACT_STMT(STMT)

245#define STMT(CLASS, PARENT) virtual bool Traverse##CLASS(CLASS *S);

246#include "clang/AST/StmtNodes.inc"

247

248#define STMT(CLASS, PARENT) \

249 bool WalkUpFrom##CLASS(CLASS *S); \

250 virtual bool Visit##CLASS(CLASS *S) { return true; }

251#include "clang/AST/StmtNodes.inc"

252

253

254#define ABSTRACT_TYPE(CLASS, BASE)

255#define TYPE(CLASS, BASE) virtual bool Traverse##CLASS##Type(CLASS##Type *T);

256#include "clang/AST/TypeNodes.inc"

257

258#define TYPE(CLASS, BASE) \

259 bool WalkUpFrom##CLASS##Type(CLASS##Type *T); \

260 virtual bool Visit##CLASS##Type(CLASS##Type *T) { return true; }

261#include "clang/AST/TypeNodes.inc"

262

263

264#define ABSTRACT_TYPELOC(CLASS, BASE)

265#define TYPELOC(CLASS, BASE) \

266 virtual bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);

267#include "clang/AST/TypeLocNodes.def"

268

269#define TYPELOC(CLASS, BASE) \

270 bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL); \

271 virtual bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }

272#include "clang/AST/TypeLocNodes.def"

273};

274}

275

276#endif

#define DEF_TRAVERSE_TMPL_INST(kind)

Defines Expressions and AST nodes for C++2a concepts.

Defines the clang::TypeLoc interface and its subclasses.

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

Attr - This represents one attribute.

Represents a base class of a C++ class.

Represents a C++ base or member initializer.

A reference to a concept and its template args, as it appears in the code.

Decl - This represents one declaration (or definition), e.g.

Recursive AST visitor that supports extension via dynamic dispatch.

virtual ~DynamicRecursiveASTVisitor()=default

virtual bool TraverseDeclarationNameInfo(DeclarationNameInfo NameInfo)

Recursively visit a name with its location information.

virtual bool dataTraverseStmtPost(Stmt *S)

Invoked after visiting a statement or expression via data recursion.

virtual bool TraverseDecl(Decl *D)

Recursively visit a declaration, by dispatching to Traverse*Decl() based on the argument's dynamic ty...

DynamicRecursiveASTVisitor()=default

virtual bool TraverseConceptTypeRequirement(concepts::TypeRequirement *R)

virtual bool TraverseNestedNameSpecifier(NestedNameSpecifier *NNS)

Recursively visit a C++ nested-name-specifier.

virtual bool VisitAttr(Attr *A)

Visit a node.

bool ShouldVisitLambdaBody

Whether this visitor should recurse into lambda body.

virtual bool TraverseTypeLoc(TypeLoc TL)

Recursively visit a type with location, by dispatching to Traverse*TypeLoc() based on the argument ty...

virtual bool dataTraverseStmtPre(Stmt *S)

Invoked before visiting a statement or expression via data recursion.

virtual bool TraverseConceptRequirement(concepts::Requirement *R)

virtual bool TraverseObjCProtocolLoc(ObjCProtocolLoc ProtocolLoc)

Recursively visit an Objective-C protocol reference with location information.

virtual bool VisitConceptReference(ConceptReference *CR)

virtual bool TraverseNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)

Recursively visit a C++ nested-name-specifier with location information.

DynamicRecursiveASTVisitor & operator=(DynamicRecursiveASTVisitor &&)=default

virtual bool VisitStmt(Stmt *S)

virtual bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C, Expr *Init)

Recursively visit a lambda capture.

virtual bool VisitType(Type *T)

bool WalkUpFromStmt(Stmt *S)

virtual bool TraverseAttr(Attr *At)

Recursively visit an attribute, by dispatching to Traverse*Attr() based on the argument's dynamic typ...

virtual bool TraverseStmt(Stmt *S)

Recursively visit a statement or expression, by dispatching to Traverse*() based on the argument's dy...

virtual bool TraverseConceptReference(ConceptReference *CR)

virtual bool VisitDecl(Decl *D)

bool WalkUpFromType(Type *T)

virtual bool TraverseTemplateArgument(const TemplateArgument &Arg)

Recursively visit a template argument and dispatch to the appropriate method for the argument type.

bool WalkUpFromDecl(Decl *D)

Walk up from a node.

DynamicRecursiveASTVisitor(const DynamicRecursiveASTVisitor &)=default

virtual bool TraverseConstructorInitializer(CXXCtorInitializer *Init)

Recursively visit a constructor initializer.

bool TraverseTemplateArguments(ArrayRef< TemplateArgument > Args)

Recursively visit a set of template arguments.

DynamicRecursiveASTVisitor & operator=(const DynamicRecursiveASTVisitor &)=default

virtual bool TraverseConceptExprRequirement(concepts::ExprRequirement *R)

virtual bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc)

Recursively visit a template argument location and dispatch to the appropriate method for the argumen...

virtual bool dataTraverseNode(Stmt *S)

virtual bool TraverseAST(ASTContext &AST)

Recursively visits an entire AST, starting from the TranslationUnitDecl.

virtual bool TraverseType(QualType T)

Recursively visit a type, by dispatching to Traverse*Type() based on the argument's getTypeClass() pr...

virtual bool TraverseCXXBaseSpecifier(const CXXBaseSpecifier &Base)

Recursively visit a base specifier.

virtual bool TraverseTypeConstraint(const TypeConstraint *C)

Traverse a concept (requirement).

bool ShouldWalkTypesOfTypeLocs

Whether this visitor should recurse into the types of TypeLocs.

bool ShouldVisitImplicitCode

Whether this visitor should recurse into implicit code, e.g.

virtual bool TraverseConceptNestedRequirement(concepts::NestedRequirement *R)

virtual bool VisitTypeLoc(TypeLoc TL)

DynamicRecursiveASTVisitor(DynamicRecursiveASTVisitor &&)=default

bool ShouldVisitTemplateInstantiations

Whether this visitor should recurse into template instantiations.

virtual bool TraverseTemplateName(TemplateName Template)

Recursively visit a template name and dispatch to the appropriate method.

bool WalkUpFromTypeLoc(TypeLoc TL)

This represents one expression.

Describes the capture of a variable or of this, or of a C++1y init-capture.

A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...

A C++ nested-name-specifier augmented with source location information.

Represents a C++ nested name specifier, such as "\::std::vector::".

A (possibly-)qualified type.

Stmt - This represents one statement.

Location wrapper for a TemplateArgument.

Represents a template argument.

Represents a C++ template name within the type system.

Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...

Base wrapper for a particular "section" of type source info.

The base class of the type hierarchy.

A requires-expression requirement which queries the validity and properties of an expression ('simple...

A requires-expression requirement which is satisfied when a general constraint expression is satisfie...

A static requirement that can be used in a requires-expression to check properties of types and expre...

A requires-expression requirement which queries the existence of a type name or type template special...

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

const FunctionProtoType * T

@ Class

The "class" keyword introduces the elaborated-type-specifier.

DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...