13#ifndef LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H
14#define LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H
20template <
class Derived>
30 Derived &
asImpl() {
return *
static_cast<Derived *
>(
this); }
34 if (isa<FunctionDecl>(D) || isa<VarDecl>(D)) {
41 if (isa<FunctionDecl>(D) || isa<VarDecl>(D)) {
48 asImpl().visitUsedDecl(
Node->getBeginLoc(),
Node->getCapturedDecl());
49 Inherited::VisitCapturedStmt(
Node);
64 Inherited::VisitCXXNewExpr(E);
71 if (!DestroyedOrNull.
isNull()) {
74 CXXRecordDecl *Record = cast<CXXRecordDecl>(DestroyedRec->getDecl());
75 if (Record->getDefinition())
80 Inherited::VisitCXXDeleteExpr(E);
87 if (Init->isInClassMemberInitializer())
88 asImpl().Visit(Init->getInit());
90 Inherited::VisitCXXConstructExpr(E);
95 Inherited::VisitCXXDefaultArgExpr(E);
100 Inherited::VisitCXXDefaultInitExpr(E);
106 Inherited::VisitInitListExpr(ILE);
110 if (
auto *CD = dyn_cast<CapturedDecl>(D)) {
111 if (
auto *
S = CD->getBody()) {
114 }
else if (
auto *CD = dyn_cast<BlockDecl>(D)) {
115 if (
auto *
S = CD->getBody()) {
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Represents binding an expression to a temporary.
CXXTemporary * getTemporary()
const Expr * getSubExpr() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a call to a C++ constructor.
SourceLocation getBeginLoc() const LLVM_READONLY
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
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.
Expr * getExpr()
Get the initialization expression that will be used.
Represents a delete expression for memory deallocation and destructor calls, e.g.
FunctionDecl * getOperatorDelete() const
SourceLocation getBeginLoc() const
QualType getDestroyedType() const
Retrieve the type being destroyed.
Represents a C++ destructor within a class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
SourceLocation getBeginLoc() const
FunctionDecl * getOperatorDelete() const
FunctionDecl * getOperatorNew() const
Represents a C++ struct/union/class.
const CXXDestructorDecl * getDestructor() const
This captures a statement into a function.
A reference to a declared variable, function, enum, etc.
SourceLocation getLocation() const
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.
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
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<specific type>'.
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)