Go to the documentation of this file.
13 #ifndef LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H
14 #define LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H
20 template <
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());
80 Inherited::VisitCXXDeleteExpr(E);
85 Inherited::VisitCXXConstructExpr(E);
93 if (
auto *CD = dyn_cast<CapturedDecl>(D)) {
94 if (
auto *
S = CD->getBody()) {
97 }
else if (
auto *CD = dyn_cast<BlockDecl>(D)) {
98 if (
auto *
S = CD->getBody()) {
106 #endif // LLVM_CLANG_LIB_SEMA_USEDDECLVISITOR_H
SourceLocation getLocation() const
const Expr * getExpr() const
Encodes a location in the source.
FunctionDecl * getOperatorNew() const
const Expr * getSubExpr() const
CXXRecordDecl * getDefinition() const
A (possibly-)qualified type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E)
void VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E)
void visitUsedDecl(SourceLocation Loc, Decl *D)
CXXTemporary * getTemporary()
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Represents binding an expression to a temporary.
void VisitCXXDeleteExpr(CXXDeleteExpr *E)
const T * getAs() const
Member-template getAs<specific type>'.
Represents a C++ destructor within a class.
FunctionDecl * getOperatorDelete() const
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
This captures a statement into a function.
A default argument (C++ [dcl.fct.default]).
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void VisitCapturedStmt(CapturedStmt *Node)
Represents a C++ struct/union/class.
const CXXDestructorDecl * getDestructor() const
void VisitMemberExpr(MemberExpr *E)
SourceLocation getBeginLoc() const
Represents a delete expression for memory deallocation and destructor calls, e.g.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Decl - This represents one declaration (or definition), e.g.
Sema - This implements semantic analysis and AST building for C.
void VisitCXXNewExpr(CXXNewExpr *E)
QualType getDestroyedType() const
Retrieve the type being destroyed.
SourceLocation getBeginLoc() const LLVM_READONLY
void VisitDeclRefExpr(DeclRefExpr *E)
FunctionDecl * getOperatorDelete() const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
void VisitCXXConstructExpr(CXXConstructExpr *E)
EvaluatedExprVisitor - This class visits 'Expr *'s.
EvaluatedExprVisitor< Derived > Inherited
SourceLocation getBeginLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
A reference to a declared variable, function, enum, etc.
Represents a call to a C++ constructor.
const ASTContext & Context