class CallExpr

Declaration

class CallExpr : public Expr { /* full declaration omitted */ };

Description

CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]). CallExpr itself represents a normal function call, e.g., "f(x, 2)", while its subclasses may represent alternative syntax that (semantically) results in a function call. For example, CXXOperatorCallExpr is a subclass for overloaded operator calls that use operator syntax, e.g., "str1 + str2" to resolve to a function call.

Declared at: clang/include/clang/AST/Expr.h:2801

Inherits from: Expr

Member Variables

private unsigned int NumArgs
The number of arguments in the call expression.
private clang::SourceLocation RParenLoc
The location of the right parenthese. This has a different meaning for the derived classes of CallExpr.
public static const clang::CallExpr::ADLCallKind NotADL = ADLCallKind::NotADL
public static const clang::CallExpr::ADLCallKind UsesADL = ADLCallKind::UsesADL

Inherited from Stmt:

protected

Method Overview

Inherited from Expr:

Inherited from ValueStmt:

Inherited from Stmt:

Methods

CallExpr(clang::Stmt::StmtClass SC,
         clang::Expr* Fn,
         ArrayRef<clang::Expr*> PreArgs,
         ArrayRef<clang::Expr*> Args,
         clang::QualType Ty,
         clang::ExprValueKind VK,
         clang::SourceLocation RParenLoc,
         clang::FPOptionsOverride FPFeatures,
         unsigned int MinNumArgs,
         clang::CallExpr::ADLCallKind UsesADL)

Description

Build a call expression, assuming that appropriate storage has been allocated for the trailing objects.

Declared at: clang/include/clang/AST/Expr.h:2864

Parameters

clang::Stmt::StmtClass SC
clang::Expr* Fn
ArrayRef<clang::Expr*> PreArgs
ArrayRef<clang::Expr*> Args
clang::QualType Ty
clang::ExprValueKind VK
clang::SourceLocation RParenLoc
clang::FPOptionsOverride FPFeatures
unsigned int MinNumArgs
clang::CallExpr::ADLCallKind UsesADL

CallExpr(clang::Stmt::StmtClass SC,
         unsigned int NumPreArgs,
         unsigned int NumArgs,
         bool hasFPFeatures,
         clang::Stmt::EmptyShell Empty)

Description

Build an empty call expression, for deserialization.

Declared at: clang/include/clang/AST/Expr.h:2870

Parameters

clang::Stmt::StmtClass SC
unsigned int NumPreArgs
unsigned int NumArgs
bool hasFPFeatures
clang::Stmt::EmptyShell Empty

static clang::CallExpr* Create(
    const clang::ASTContext& Ctx,
    clang::Expr* Fn,
    ArrayRef<clang::Expr*> Args,
    clang::QualType Ty,
    clang::ExprValueKind VK,
    clang::SourceLocation RParenLoc,
    clang::FPOptionsOverride FPFeatures,
    unsigned int MinNumArgs = 0,
    clang::CallExpr::ADLCallKind UsesADL = NotADL)

Description

Create a call expression. Note that you can use CreateTemporary if you need a temporary call expression on the stack.

Declared at: clang/include/clang/AST/Expr.h:2929

Parameters

const clang::ASTContext& Ctx
clang::Expr* Fn
The callee expression,
ArrayRef<clang::Expr*> Args
The argument array,
clang::QualType Ty
The type of the call expression (which is *not* the return type in general),
clang::ExprValueKind VK
The value kind of the call expression (lvalue, rvalue, ...),
clang::SourceLocation RParenLoc
The location of the right parenthesis in the call expression.
clang::FPOptionsOverride FPFeatures
Floating-point features associated with the call,
unsigned int MinNumArgs = 0
Specifies the minimum number of arguments. The actual number of arguments will be the greater of Args.size() and MinNumArgs. This is used in a few places to allocate enough storage for the default arguments.
clang::CallExpr::ADLCallKind UsesADL = NotADL
Specifies whether the callee was found through argument-dependent lookup.

static clang::CallExpr* CreateEmpty(
    const clang::ASTContext& Ctx,
    unsigned int NumArgs,
    bool HasFPFeatures,
    clang::Stmt::EmptyShell Empty)

Description

Create an empty call expression, for deserialization.

Declared at: clang/include/clang/AST/Expr.h:2948

Parameters

const clang::ASTContext& Ctx
unsigned int NumArgs
bool HasFPFeatures
clang::Stmt::EmptyShell Empty

static clang::CallExpr* CreateTemporary(
    void* Mem,
    clang::Expr* Fn,
    clang::QualType Ty,
    clang::ExprValueKind VK,
    clang::SourceLocation RParenLoc,
    clang::CallExpr::ADLCallKind UsesADL = NotADL)

Description

Create a temporary call expression with no arguments in the memory pointed to by Mem. Mem must points to at least sizeof(CallExpr) + sizeof(Stmt *) bytes of storage, aligned to alignof(CallExpr):

Declared at: clang/include/clang/AST/Expr.h:2943

Parameters

void* Mem
clang::Expr* Fn
clang::QualType Ty
clang::ExprValueKind VK
clang::SourceLocation RParenLoc
clang::CallExpr::ADLCallKind UsesADL = NotADL

clang::CallExpr::const_arg_iterator arg_begin()
    const

Declared at: clang/include/clang/AST/Expr.h:3050

clang::CallExpr::arg_iterator arg_begin()

Declared at: clang/include/clang/AST/Expr.h:3045

clang::CallExpr::const_arg_iterator arg_end()
    const

Declared at: clang/include/clang/AST/Expr.h:3053

clang::CallExpr::arg_iterator arg_end()

Declared at: clang/include/clang/AST/Expr.h:3048

clang::CallExpr::const_arg_range arguments() const

Declared at: clang/include/clang/AST/Expr.h:3041

clang::CallExpr::arg_range arguments()

Declared at: clang/include/clang/AST/Expr.h:3040

clang::Stmt::const_child_range children() const

Declared at: clang/include/clang/AST/Expr.h:3144

clang::Stmt::child_range children()

Declared at: clang/include/clang/AST/Expr.h:3139

static bool classof(const clang::Stmt* T)

Declared at: clang/include/clang/AST/Expr.h:3133

Parameters

const clang::Stmt* T

void computeDependence()

Description

Compute and set dependence bits.

Declared at: clang/include/clang/AST/Expr.h:3011

clang::CallExpr::ADLCallKind getADLCallKind()
    const

Declared at: clang/include/clang/AST/Expr.h:2955

clang::Expr* getArg(unsigned int Arg)

Description

getArg - Return the specified argument.

Declared at: clang/include/clang/AST/Expr.h:2992

Parameters

unsigned int Arg

const clang::Expr* getArg(unsigned int Arg) const

Declared at: clang/include/clang/AST/Expr.h:2996

Parameters

unsigned int Arg

const clang::Expr* const* getArgs() const

Declared at: clang/include/clang/AST/Expr.h:2986

clang::Expr** getArgs()

Description

Retrieve the call arguments.

Declared at: clang/include/clang/AST/Expr.h:2982

clang::SourceLocation getBeginLoc() const

Declared at: clang/include/clang/AST/Expr.h:3118

unsigned int getBuiltinCallee() const

Description

getBuiltinCallee - If this is a call to a builtin, return the builtin ID of the callee. If not, return 0.

Declared at: clang/include/clang/AST/Expr.h:3095

clang::QualType getCallReturnType(
    const clang::ASTContext& Ctx) const

Description

getCallReturnType - Get the return type of the call expr. This is not always the type of the expr itself, if the return type is a reference type.

Declared at: clang/include/clang/AST/Expr.h:3104

Parameters

const clang::ASTContext& Ctx

const clang::Expr* getCallee() const

Declared at: clang/include/clang/AST/Expr.h:2952

clang::Expr* getCallee()

Declared at: clang/include/clang/AST/Expr.h:2951

const clang::Decl* getCalleeDecl() const

Declared at: clang/include/clang/AST/Expr.h:2966

clang::Decl* getCalleeDecl()

Declared at: clang/include/clang/AST/Expr.h:2965

clang::FunctionDecl* getDirectCallee()

Description

If the callee is a FunctionDecl, return it. Otherwise return null.

Declared at: clang/include/clang/AST/Expr.h:2971

const clang::FunctionDecl* getDirectCallee() const

Declared at: clang/include/clang/AST/Expr.h:2974

clang::SourceLocation getEndLoc() const

Declared at: clang/include/clang/AST/Expr.h:3119

clang::FPOptionsOverride getFPFeatures() const

Declared at: clang/include/clang/AST/Expr.h:3087

clang::FPOptions getFPFeaturesInEffect(
    const clang::LangOptions& LO) const

Declared at: clang/include/clang/AST/Expr.h:3081

Parameters

const clang::LangOptions& LO

unsigned int getNumArgs() const

Description

getNumArgs - Return the number of actual arguments to this call.

Declared at: clang/include/clang/AST/Expr.h:2979

unsigned int getNumCommas() const

Description

getNumCommas - Return the number of commas that must have been present in this function call.

Declared at: clang/include/clang/AST/Expr.h:3066

unsigned int getNumPreArgs() const

Declared at: clang/include/clang/AST/Expr.h:2894

size_t getOffsetOfTrailingFPFeatures() const

Declared at: clang/include/clang/AST/Expr.h:2851

clang::Stmt* getPreArg(unsigned int I)

Declared at: clang/include/clang/AST/Expr.h:2881

Parameters

unsigned int I

const clang::Stmt* getPreArg(unsigned int I) const

Declared at: clang/include/clang/AST/Expr.h:2885

Parameters

unsigned int I

clang::SourceLocation getRParenLoc() const

Declared at: clang/include/clang/AST/Expr.h:3115

ArrayRef<clang::Stmt*> getRawSubExprs()

Description

This method provides fast access to all the subexpressions of a CallExpr without going through the slower virtual child_iterator interface. This provides efficient reverse iteration of the subexpressions. This is currently used for CFG construction.

Declared at: clang/include/clang/AST/Expr.h:3059

unsigned int getSizeOfTrailingStmts() const

Declared at: clang/include/clang/AST/Expr.h:2847

clang::FPOptionsOverride getStoredFPFeatures()
    const

Description

Get FPOptionsOverride from trailing storage.

Declared at: clang/include/clang/AST/Expr.h:3069

clang::FPOptionsOverride* getTrailingFPFeatures()

Description

Return a pointer to the trailing FPOptions

Declared at: clang/include/clang/AST/Expr.h:2897

const clang::FPOptionsOverride*
getTrailingFPFeatures() const

Declared at: clang/include/clang/AST/Expr.h:2903

clang::Stmt** getTrailingStmts()

Description

Return a pointer to the start of the trailing array of "Stmt *".

Declared at: clang/include/clang/AST/Expr.h:2835

clang::Stmt* const* getTrailingStmts() const

Declared at: clang/include/clang/AST/Expr.h:2839

const clang::Attr* getUnusedResultAttr(
    const clang::ASTContext& Ctx) const

Description

Returns the WarnUnusedResultAttr that is either declared on the called function, or its return type declaration.

Declared at: clang/include/clang/AST/Expr.h:3108

Parameters

const clang::ASTContext& Ctx

bool hasStoredFPFeatures() const

Declared at: clang/include/clang/AST/Expr.h:2963

bool hasUnusedResultAttr(
    const clang::ASTContext& Ctx) const

Description

Returns true if this call expression should warn on unused results.

Declared at: clang/include/clang/AST/Expr.h:3111

Parameters

const clang::ASTContext& Ctx

bool isBuiltinAssumeFalse(
    const clang::ASTContext& Ctx) const

Description

Return true if this is a call to __assume() or __builtin_assume() with a non-value-dependent constant parameter evaluating as false.

Declared at: clang/include/clang/AST/Expr.h:3123

Parameters

const clang::ASTContext& Ctx

bool isCallToStdMove() const

Declared at: clang/include/clang/AST/Expr.h:3131

bool isUnevaluatedBuiltinCall(
    const clang::ASTContext& Ctx) const

Description

Returns \c true if this is a call to a builtin which does not evaluate side-effects within its arguments.

Declared at: clang/include/clang/AST/Expr.h:3099

Parameters

const clang::ASTContext& Ctx

void markDependentForPostponedNameLookup()

Description

Used by Sema to implement MSVC-compatible delayed name lookup. (Usually Exprs themselves should set dependence).

Declared at: clang/include/clang/AST/Expr.h:3127

static unsigned int offsetToTrailingObjects(
    clang::Stmt::StmtClass SC)

Description

Map a statement class to the appropriate offset in bytes from the this pointer to the trailing objects.

Declared at: clang/include/clang/AST/Expr.h:2845

Parameters

clang::Stmt::StmtClass SC

void setADLCallKind(
    clang::CallExpr::ADLCallKind V = UsesADL)

Declared at: clang/include/clang/AST/Expr.h:2958

Parameters

clang::CallExpr::ADLCallKind V = UsesADL

void setArg(unsigned int Arg,
            clang::Expr* ArgExpr)

Description

setArg - Set the specified argument. ! the dependence bits might be stale after calling this setter, it is *caller*'s responsibility to recompute them by calling computeDependence().

Declared at: clang/include/clang/AST/Expr.h:3005

Parameters

unsigned int Arg
clang::Expr* ArgExpr

void setCallee(clang::Expr* F)

Declared at: clang/include/clang/AST/Expr.h:2953

Parameters

clang::Expr* F

void setNumArgsUnsafe(unsigned int NewNumArgs)

Description

Bluntly set a new number of arguments without doing any checks whatsoever. Only used during construction of a CallExpr in a few places in Sema. FIXME: Find a way to remove it.

Declared at: clang/include/clang/AST/Expr.h:3033

Parameters

unsigned int NewNumArgs

void setPreArg(unsigned int I,
               clang::Stmt* PreArg)

Declared at: clang/include/clang/AST/Expr.h:2889

Parameters

unsigned int I
clang::Stmt* PreArg

void setRParenLoc(clang::SourceLocation L)

Declared at: clang/include/clang/AST/Expr.h:3116

Parameters

clang::SourceLocation L

void setStoredFPFeatures(
    clang::FPOptionsOverride F)

Description

Set FPOptionsOverride in trailing storage. Used only by Serialization.

Declared at: clang/include/clang/AST/Expr.h:3074

Parameters

clang::FPOptionsOverride F

void shrinkNumArgs(unsigned int NewNumArgs)

Description

Reduce the number of arguments in this call expression. This is used for example during error recovery to drop extra arguments. There is no way to perform the opposite because: 1.) We don't track how much storage we have for the argument array 2.) This would potentially require growing the argument array, something we cannot support since the arguments are stored in a trailing array.

Declared at: clang/include/clang/AST/Expr.h:3024

Parameters

unsigned int NewNumArgs

static unsigned int sizeOfTrailingObjects(
    unsigned int NumPreArgs,
    unsigned int NumArgs,
    bool HasFPFeatures)

Description

Return the size in bytes needed for the trailing objects. Used by the derived classes to allocate the right amount of storage.

Declared at: clang/include/clang/AST/Expr.h:2875

Parameters

unsigned int NumPreArgs
unsigned int NumArgs
bool HasFPFeatures

bool usesADL() const

Declared at: clang/include/clang/AST/Expr.h:2961