Go to the documentation of this file.
13 #ifndef LLVM_CLANG_ANALYSIS_ANYCALL_H
14 #define LLVM_CLANG_ANALYSIS_ANYCALL_H
61 const Expr *E =
nullptr;
65 const Decl *D =
nullptr;
73 if (D && ((K ==
Function && !isa<FunctionDecl>(D)) ||
74 (K ==
Block && !isa<BlockDecl>(D))))
79 : E(ME), D(ME->getMethodDecl()), K(
ObjCMethod) {}
100 if (isa<CXXConstructorDecl>(D)) {
102 }
else if (isa <CXXDestructorDecl>(D)) {
113 if (
const auto *ME = dyn_cast<ObjCMessageExpr>(E)) {
115 }
else if (
const auto *CE = dyn_cast<CallExpr>(E)) {
117 }
else if (
const auto *CXNE = dyn_cast<CXXNewExpr>(E)) {
119 }
else if (
const auto *CXDE = dyn_cast<CXXDeleteExpr>(E)) {
121 }
else if (
const auto *CXCE = dyn_cast<CXXConstructExpr>(E)) {
123 }
else if (
const auto *CXCIE = dyn_cast<CXXInheritedCtorInitExpr>(E)) {
134 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
136 }
else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D)) {
147 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
148 return FD->parameters();
149 }
else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D)) {
150 return MD->parameters();
151 }
else if (
const auto *BD = dyn_cast<BlockDecl>(D)) {
152 return BD->parameters();
168 return cast<CallExpr>(E)->getCallReturnType(Ctx);
169 return cast<FunctionDecl>(D)->getReturnType();
172 return cast<ObjCMessageExpr>(E)->getCallReturnType(Ctx);
173 return cast<ObjCMethodDecl>(D)->getReturnType();
177 return cast<CallExpr>(E)->getCallReturnType(Ctx);
183 return cast<FunctionDecl>(D)->getReturnType();
185 llvm_unreachable(
"Unknown AnyCall::Kind");
191 if (
const auto *ND = dyn_cast_or_null<NamedDecl>(D))
192 return ND->getIdentifier();
218 #endif // LLVM_CLANG_ANALYSIS_ANYCALL_H
Represents a C++ constructor within a class.
AnyCall(const ObjCMessageExpr *ME)
A (possibly-)qualified type.
static Optional< AnyCall > forDecl(const Decl *D)
If D is a callable (Objective-C method or a function), return a constructed AnyCall object.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
AnyCall(const FunctionDecl *D)
@ Allocator
A C++ allocation function call (operator new), via C++ new-expression.
AnyCall(const CallExpr *CE)
@ Function
A function, function pointer, or a C++ method call.
QualType getReturnType(ASTContext &Ctx) const
An instance of this class corresponds to a call.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
@ Deallocator
A C++ deallocation function call (operator delete), via C++ delete-expression.
const T * getAs() const
Member-template getAs<specific type>'.
AnyCall(const ObjCMethodDecl *D)
Represents a C++ destructor within a class.
AnyCall(const CXXConstructorDecl *D)
@ Block
A call to an Objective-C block.
Represents a call to an inherited base class constructor from an inheriting constructor.
AnyCall(const CXXDeleteExpr *NE)
static Optional< AnyCall > forExpr(const Expr *E)
If E is a generic call (to ObjC method /function/block/etc), return a constructed AnyCall object.
AnyCall(const CXXDestructorDecl *D)
const IdentifierInfo * getIdentifier() const
An expression that sends a message to the given Objective-C object or class.
AnyCall(const CXXNewExpr *NE)
const Decl * getDecl() const
Represents a delete expression for memory deallocation and destructor calls, e.g.
Decl - This represents one declaration (or definition), e.g.
AnyCall(const CXXInheritedCtorInitExpr *CIE)
AnyCall(const CXXConstructExpr *NE)
ArrayRef< ParmVarDecl * > parameters() const
@ InheritedConstructor
A C++ inherited constructor produced by a "using T::T" directive.
One of these records is kept for each identifier that is lexed.
param_const_iterator param_end() const
@ Destructor
An implicit C++ destructor call (called implicitly or by operator 'delete')
ObjCMethodDecl - Represents an instance or class method declaration.
bool NE(InterpState &S, CodePtr OpPC)
size_t param_size() const
ArrayRef< ParmVarDecl * >::const_iterator param_const_iterator
Description of a constructor that was inherited from a base class.
@ ObjCMethod
A call to an Objective-C method.
@ Constructor
An implicit or explicit C++ constructor call.
This represents one expression.
param_const_iterator param_begin() const
Represents a function declaration or definition.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
const Expr * getExpr() const
Represents a call to a C++ constructor.