clang: lib/Sema/UsedDeclVisitor.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H

14#define LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H

15

18

20template

22protected:

24

25public:

27

29

30 Derived &asImpl() { return *static_cast<Derived *>(this); }

31

33 auto *D = E->getDecl();

34 if (isa(D) || isa(D)) {

35 asImpl().visitUsedDecl(E->getLocation(), D);

36 }

37 }

38

40 auto *D = E->getMemberDecl();

41 if (isa(D) || isa(D)) {

42 asImpl().visitUsedDecl(E->getMemberLoc(), D);

43 }

44 asImpl().Visit(E->getBase());

45 }

46

48 asImpl().visitUsedDecl(Node->getBeginLoc(), Node->getCapturedDecl());

49 Inherited::VisitCapturedStmt(Node);

50 }

51

53 asImpl().visitUsedDecl(

54 E->getBeginLoc(),

56 asImpl().Visit(E->getSubExpr());

57 }

58

60 if (E->getOperatorNew())

61 asImpl().visitUsedDecl(E->getBeginLoc(), E->getOperatorNew());

62 if (E->getOperatorDelete())

63 asImpl().visitUsedDecl(E->getBeginLoc(), E->getOperatorDelete());

64 Inherited::VisitCXXNewExpr(E);

65 }

66

68 if (E->getOperatorDelete())

69 asImpl().visitUsedDecl(E->getBeginLoc(), E->getOperatorDelete());

70 QualType DestroyedOrNull = E->getDestroyedType();

71 if (!DestroyedOrNull.isNull()) {

75 if (Record->getDefinition())

77 }

78 }

79

80 Inherited::VisitCXXDeleteExpr(E);

81 }

82

84 asImpl().visitUsedDecl(E->getBeginLoc(), E->getConstructor());

87 if (Init->isInClassMemberInitializer())

89 }

90 Inherited::VisitCXXConstructExpr(E);

91 }

92

94 asImpl().Visit(E->getExpr());

95 Inherited::VisitCXXDefaultArgExpr(E);

96 }

97

99 asImpl().Visit(E->getExpr());

100 Inherited::VisitCXXDefaultInitExpr(E);

101 }

102

106 Inherited::VisitInitListExpr(ILE);

107 }

108

110 if (auto *CD = dyn_cast(D)) {

111 if (auto *S = CD->getBody()) {

113 }

114 } else if (auto *CD = dyn_cast(D)) {

115 if (auto *S = CD->getBody()) {

117 }

118 }

119 }

120};

121}

122

123#endif

llvm::MachO::Record Record

QualType getBaseElementType(const ArrayType *VAT) const

Return the innermost element type of an array type.

Represents binding an expression to a temporary.

Represents a call to a C++ constructor.

Represents a C++ constructor within a class.

Represents a C++ base or member initializer.

A default argument (C++ [dcl.fct.default]).

A use of a default initializer in a constructor or in aggregate initialization.

Represents a delete expression for memory deallocation and destructor calls, e.g.

Represents a C++ destructor within a class.

Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".

Represents a C++ struct/union/class.

This captures a statement into a function.

A reference to a declared variable, function, enum, etc.

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

const ASTContext & Context

EvaluatedExprVisitor - This class visits 'Expr *'s.

Describes an C or C++ initializer list.

bool hasArrayFiller() const

Return true if this is an array initializer and its array "filler" has been set.

Expr * getArrayFiller()

If this initializer list initializes an array with more elements than there are initializers in the l...

MemberExpr - [C99 6.5.2.3] Structure and Union Members.

A (possibly-)qualified type.

bool isNull() const

Return true if this QualType doesn't point to a type yet.

A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...

Sema - This implements semantic analysis and AST building for C.

CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)

Look for the destructor of the given class.

Encodes a location in the source.

const T * getAs() const

Member-template getAs'.

void VisitCXXConstructExpr(CXXConstructExpr *E)

void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E)

void VisitMemberExpr(MemberExpr *E)

void VisitDeclRefExpr(DeclRefExpr *E)

void VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E)

void VisitCXXDeleteExpr(CXXDeleteExpr *E)

void VisitInitListExpr(InitListExpr *ILE)

void VisitCXXNewExpr(CXXNewExpr *E)

void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E)

void visitUsedDecl(SourceLocation Loc, Decl *D)

EvaluatedExprVisitor< Derived > Inherited

void VisitCapturedStmt(CapturedStmt *Node)

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