13#ifndef LLVM_CLANG_ANALYSIS_ANYCALL_H
14#define LLVM_CLANG_ANALYSIS_ANYCALL_H
62 const Expr *E =
nullptr;
66 const Decl *D =
nullptr;
74 if (
D && ((K ==
Function && !isa<FunctionDecl>(
D)) ||
75 (K ==
Block && !isa<BlockDecl>(
D))))
101 if (isa<CXXConstructorDecl>(
D)) {
103 }
else if (isa <CXXDestructorDecl>(
D)) {
114 if (
const auto *ME = dyn_cast<ObjCMessageExpr>(
E)) {
116 }
else if (
const auto *CE = dyn_cast<CallExpr>(
E)) {
118 }
else if (
const auto *CXNE = dyn_cast<CXXNewExpr>(
E)) {
120 }
else if (
const auto *CXDE = dyn_cast<CXXDeleteExpr>(
E)) {
122 }
else if (
const auto *CXCE = dyn_cast<CXXConstructExpr>(
E)) {
124 }
else if (
const auto *CXCIE = dyn_cast<CXXInheritedCtorInitExpr>(
E)) {
135 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
137 }
else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(
D)) {
148 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
149 return FD->parameters();
150 }
else if (
const auto *MD = dyn_cast<ObjCMethodDecl>(
D)) {
151 return MD->parameters();
152 }
else if (
const auto *BD = dyn_cast<BlockDecl>(
D)) {
153 return BD->parameters();
169 return cast<CallExpr>(
E)->getCallReturnType(Ctx);
170 return cast<FunctionDecl>(
D)->getReturnType();
173 return cast<ObjCMessageExpr>(
E)->getCallReturnType(Ctx);
174 return cast<ObjCMethodDecl>(
D)->getReturnType();
178 return cast<CallExpr>(
E)->getCallReturnType(Ctx);
184 return cast<FunctionDecl>(
D)->getReturnType();
186 llvm_unreachable(
"Unknown AnyCall::Kind");
192 if (
const auto *ND = dyn_cast_or_null<NamedDecl>(
D))
193 return ND->getIdentifier();
Defines the clang::Expr interface and subclasses for C++ expressions.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
An instance of this class corresponds to a call.
size_t param_size() const
AnyCall(const CXXConstructExpr *NE)
ArrayRef< ParmVarDecl * >::const_iterator param_const_iterator
param_const_iterator param_end() const
AnyCall(const CallExpr *CE)
const Decl * getDecl() const
AnyCall(const CXXDestructorDecl *D)
const IdentifierInfo * getIdentifier() const
param_const_iterator param_begin() const
AnyCall(const CXXNewExpr *NE)
static std::optional< AnyCall > forDecl(const Decl *D)
If D is a callable (Objective-C method or a function), return a constructed AnyCall object.
AnyCall(const ObjCMessageExpr *ME)
static std::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 CXXConstructorDecl *D)
AnyCall(const CXXInheritedCtorInitExpr *CIE)
ArrayRef< ParmVarDecl * > parameters() const
@ Destructor
An implicit C++ destructor call (called implicitly or by operator 'delete')
@ ObjCMethod
A call to an Objective-C method.
@ Deallocator
A C++ deallocation function call (operator delete), via C++ delete-expression.
@ Function
A function, function pointer, or a C++ method call.
@ Allocator
A C++ allocation function call (operator new), via C++ new-expression.
@ Constructor
An implicit or explicit C++ constructor call.
@ InheritedConstructor
A C++ inherited constructor produced by a "using T::T" directive.
@ Block
A call to an Objective-C block.
AnyCall(const ObjCMethodDecl *D)
QualType getReturnType(ASTContext &Ctx) const
const Expr * getExpr() const
AnyCall(const CXXDeleteExpr *NE)
AnyCall(const FunctionDecl *D)
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ destructor within a class.
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Represents a function declaration or definition.
One of these records is kept for each identifier that is lexed.
Description of a constructor that was inherited from a base class.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
A (possibly-)qualified type.
const T * getAs() const
Member-template getAs<specific type>'.
The JSON file list parser is used to communicate input to InstallAPI.