17namespace ast_matchers {
20 return D.getConstructor();
23 return D.getDirectCallee();
26template <
class ExprNode>
31 static_assert(std::is_same_v<CallExpr, ExprNode> ||
32 std::is_same_v<CXXConstructExpr, ExprNode>);
36 unsigned ArgIndex = 0;
37 if (
const auto *CE = dyn_cast<CXXOperatorCallExpr>(&
Node)) {
38 const auto *MD = dyn_cast_or_null<CXXMethodDecl>(CE->getDirectCallee());
39 if (MD && !MD->isExplicitObjectMemberFunction()) {
50 if (
const auto *
Call = dyn_cast<CallExpr>(&
Node)) {
51 if (
const auto *
Value =
52 dyn_cast_or_null<ValueDecl>(
Call->getCalleeDecl())) {
62 assert(MP &&
"Must be member-pointer if its a memberfunctionpointer");
65 "The call must have happened through a member function "
71 unsigned ParamIndex = 0;
72 unsigned NumArgs =
Node.getNumArgs();
76 for (; ArgIndex < NumArgs; ++ArgIndex, ++ParamIndex) {
82 ParamType = FD->getParamDecl(ParamIndex)->getType();
86 OnParamAndArg(ParamType,
Node.getArg(ArgIndex)->IgnoreParenCasts());
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
Represents a call to a C++ constructor.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
This represents one expression.
Represents a function declaration or definition.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Represents a prototype with parameter type info, e.g.
unsigned getNumParams() const
QualType getParamType(unsigned i) const
bool isVariadic() const
Whether this function prototype is variadic.
A pointer to member type per C++ 8.3.3 - Pointers to members.
A (possibly-)qualified type.
QualType getCanonicalType() const
bool isFunctionPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isMemberFunctionPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
static const FunctionDecl * getCallee(const CXXConstructExpr &D)
static void matchEachArgumentWithParamTypeImpl(const ExprNode &Node, llvm::function_ref< void(QualType, const Expr *)> OnParamAndArg)
void matchEachArgumentWithParamType(const CallExpr &Node, llvm::function_ref< void(QualType, const Expr *)> OnParamAndArg)
The JSON file list parser is used to communicate input to InstallAPI.