clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
clang::CallExpr Class Reference

#include <Expr.h>

Inheritance diagram for clang::CallExpr:
Inheritance graph
[legend]
Collaboration diagram for clang::CallExpr:
Collaboration graph
[legend]

List of all members.

Public Types

typedef ExprIterator arg_iterator
typedef ConstExprIterator const_arg_iterator

Public Member Functions

 CallExpr (ASTContext &C, Expr *fn, Expr **args, unsigned numargs, QualType t, ExprValueKind VK, SourceLocation rparenloc)
 CallExpr (ASTContext &C, StmtClass SC, EmptyShell Empty)
 Build an empty call expression.
const ExprgetCallee () const
ExprgetCallee ()
void setCallee (Expr *F)
DeclgetCalleeDecl ()
const DeclgetCalleeDecl () const
FunctionDeclgetDirectCallee ()
 If the callee is a FunctionDecl, return it. Otherwise return 0.
const FunctionDeclgetDirectCallee () const
unsigned getNumArgs () const
Expr ** getArgs ()
 Retrieve the call arguments.
const Expr *const * getArgs () const
ExprgetArg (unsigned Arg)
 getArg - Return the specified argument.
const ExprgetArg (unsigned Arg) const
void setArg (unsigned Arg, Expr *ArgExpr)
 setArg - Set the specified argument.
void setNumArgs (ASTContext &C, unsigned NumArgs)
arg_iterator arg_begin ()
arg_iterator arg_end ()
const_arg_iterator arg_begin () const
const_arg_iterator arg_end () const
unsigned getNumCommas () const
unsigned isBuiltinCall () const
QualType getCallReturnType () const
SourceLocation getRParenLoc () const
void setRParenLoc (SourceLocation L)
SourceRange getSourceRange () const
child_range children ()

Static Public Member Functions

static bool classof (const Stmt *T)
static bool classof (const CallExpr *)

Protected Member Functions

 CallExpr (ASTContext &C, StmtClass SC, Expr *fn, unsigned NumPreArgs, Expr **args, unsigned numargs, QualType t, ExprValueKind VK, SourceLocation rparenloc)
 CallExpr (ASTContext &C, StmtClass SC, unsigned NumPreArgs, EmptyShell Empty)
StmtgetPreArg (unsigned i)
const StmtgetPreArg (unsigned i) const
void setPreArg (unsigned i, Stmt *PreArg)
unsigned getNumPreArgs () const

Detailed 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.

Definition at line 2001 of file Expr.h.


Member Typedef Documentation

Definition at line 2084 of file Expr.h.

Definition at line 2085 of file Expr.h.


Constructor & Destructor Documentation

CallExpr::CallExpr ( ASTContext C,
StmtClass  SC,
Expr fn,
unsigned  NumPreArgs,
Expr **  args,
unsigned  numargs,
QualType  t,
ExprValueKind  VK,
SourceLocation  rparenloc 
) [protected]
CallExpr::CallExpr ( ASTContext C,
StmtClass  SC,
unsigned  NumPreArgs,
EmptyShell  Empty 
) [protected]

Definition at line 778 of file Expr.cpp.

References clang::Stmt::CallExprBits.

CallExpr::CallExpr ( ASTContext C,
Expr fn,
Expr **  args,
unsigned  numargs,
QualType  t,
ExprValueKind  VK,
SourceLocation  rparenloc 
)
CallExpr::CallExpr ( ASTContext C,
StmtClass  SC,
EmptyShell  Empty 
)

Build an empty call expression.

Definition at line 771 of file Expr.cpp.

References clang::Stmt::CallExprBits.


Member Function Documentation

arg_iterator clang::CallExpr::arg_begin ( ) [inline]
const_arg_iterator clang::CallExpr::arg_begin ( ) const [inline]

Definition at line 2091 of file Expr.h.

References getNumPreArgs().

arg_iterator clang::CallExpr::arg_end ( ) [inline]
const_arg_iterator clang::CallExpr::arg_end ( ) const [inline]

Definition at line 2094 of file Expr.h.

References getNumArgs(), and getNumPreArgs().

child_range clang::CallExpr::children ( ) [inline]

Reimplemented from clang::Stmt.

Definition at line 2123 of file Expr.h.

References getNumPreArgs().

static bool clang::CallExpr::classof ( const Stmt T) [inline, static]

Reimplemented from clang::Expr.

Reimplemented in clang::CUDAKernelCallExpr, clang::CXXMemberCallExpr, and clang::CXXOperatorCallExpr.

Definition at line 2116 of file Expr.h.

References clang::Stmt::getStmtClass().

static bool clang::CallExpr::classof ( const CallExpr ) [inline, static]

Definition at line 2120 of file Expr.h.

Expr* clang::CallExpr::getArg ( unsigned  Arg) [inline]
const Expr* clang::CallExpr::getArg ( unsigned  Arg) const [inline]

Definition at line 2068 of file Expr.h.

References getNumPreArgs().

Expr** clang::CallExpr::getArgs ( ) [inline]

Retrieve the call arguments.

Definition at line 2056 of file Expr.h.

References getNumPreArgs().

Referenced by getArgs().

const Expr* const* clang::CallExpr::getArgs ( ) const [inline]

Definition at line 2059 of file Expr.h.

References getArgs().

const Expr* clang::CallExpr::getCallee ( ) const [inline]
Expr* clang::CallExpr::getCallee ( ) [inline]

Definition at line 2037 of file Expr.h.

Decl * CallExpr::getCalleeDecl ( )
const Decl* clang::CallExpr::getCalleeDecl ( ) const [inline]

Definition at line 2041 of file Expr.h.

References getCalleeDecl().

QualType CallExpr::getCallReturnType ( ) const

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.

Definition at line 867 of file Expr.cpp.

References clang::Expr::findBoundMemberType(), getCallee(), clang::FunctionType::getResultType(), and clang::Expr::getType().

Referenced by clang::CodeGen::CodeGenFunction::EmitCallExprLValue().

FunctionDecl * CallExpr::getDirectCallee ( )

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

Definition at line 810 of file Expr.cpp.

References getCalleeDecl().

Referenced by checkBuiltinArgument(), clang::CodeGen::CodeGenFunction::EmitARMBuiltinExpr(), getCalleeName(), getDirectCallee(), and getStrlenExprArg().

const FunctionDecl* clang::CallExpr::getDirectCallee ( ) const [inline]

Definition at line 2047 of file Expr.h.

References getDirectCallee().

unsigned clang::CallExpr::getNumArgs ( ) const [inline]
unsigned clang::CallExpr::getNumCommas ( ) const [inline]

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

Definition at line 2100 of file Expr.h.

unsigned clang::CallExpr::getNumPreArgs ( ) const [inline, protected]
Stmt* clang::CallExpr::getPreArg ( unsigned  i) [inline, protected]

Definition at line 2014 of file Expr.h.

References getNumPreArgs().

Referenced by clang::CUDAKernelCallExpr::getConfig().

const Stmt* clang::CallExpr::getPreArg ( unsigned  i) const [inline, protected]

Definition at line 2018 of file Expr.h.

References getNumPreArgs().

SourceLocation clang::CallExpr::getRParenLoc ( ) const [inline]
SourceRange CallExpr::getSourceRange ( ) const

SourceLocation tokens are not useful in isolation - they are low level value objects created/interpreted by SourceManager. We assume AST clients will have a pointer to the respective SourceManager.

Reimplemented from clang::Stmt.

Reimplemented in clang::CXXOperatorCallExpr.

Definition at line 881 of file Expr.cpp.

References getArg(), getCallee(), clang::Stmt::getLocEnd(), clang::Stmt::getLocStart(), getNumArgs(), getRParenLoc(), and clang::SourceLocation::isInvalid().

Referenced by checkArgCount(), clang::Sema::CheckCallReturnType(), clang::Sema::ConvertArgumentsForCall(), and clang::Sema::SemaBuiltinShuffleVector().

unsigned CallExpr::isBuiltinCall ( ) const

isBuiltinCall - If this is a call to a builtin, return the builtin ID. If not, return 0.

Definition at line 845 of file Expr.cpp.

References clang::FunctionDecl::getBuiltinID(), getCallee(), clang::DeclRefExpr::getDecl(), clang::NamedDecl::getIdentifier(), and clang::CastExpr::getSubExpr().

Referenced by CheckICE(), and IsStringLiteralCall().

void clang::CallExpr::setArg ( unsigned  Arg,
Expr ArgExpr 
) [inline]

setArg - Set the specified argument.

Definition at line 2074 of file Expr.h.

References getNumPreArgs().

Referenced by clang::Sema::BuildResolvedCallExpr(), checkBuiltinArgument(), clang::Sema::ConvertArgumentsForCall(), and clang::Sema::SemaBuiltinShuffleVector().

void clang::CallExpr::setCallee ( Expr F) [inline]

Definition at line 2038 of file Expr.h.

Referenced by clang::Sema::BuildResolvedCallExpr().

void CallExpr::setNumArgs ( ASTContext C,
unsigned  NumArgs 
)

setNumArgs - This changes the number of arguments present in this call. Any orphaned expressions are deleted by this, and any new operands are set to null.

Definition at line 817 of file Expr.cpp.

References clang::ASTContext::Deallocate(), getNumArgs(), and getNumPreArgs().

Referenced by clang::Sema::ConvertArgumentsForCall().

void clang::CallExpr::setPreArg ( unsigned  i,
Stmt PreArg 
) [inline, protected]

Definition at line 2022 of file Expr.h.

References getNumPreArgs().

Referenced by clang::CUDAKernelCallExpr::setConfig().

void clang::CallExpr::setRParenLoc ( SourceLocation  L) [inline]

Definition at line 2112 of file Expr.h.


The documentation for this class was generated from the following files: