clang API Documentation

Public Member Functions | Static Public Member Functions
clang::ento::CallOrObjCMessage Class Reference

Common wrapper for a call expression, ObjC message, or C++ constructor, mainly to provide a common interface for their arguments. More...

#include <ObjCMessage.h>

List of all members.

Public Member Functions

 CallOrObjCMessage (const CallExpr *callE, ProgramStateRef state, const LocationContext *lctx)
 CallOrObjCMessage (const CXXConstructExpr *consE, ProgramStateRef state, const LocationContext *lctx)
 CallOrObjCMessage (const ObjCMessage &msg, ProgramStateRef state, const LocationContext *lctx)
QualType getResultType (ASTContext &ctx) const
bool isFunctionCall () const
bool isCXXConstructExpr () const
bool isObjCMessage () const
bool isCXXCall () const
bool isInSystemHeader () const
 Check if the callee is declared in the system header.
const ExprgetOriginExpr () const
SVal getFunctionCallee () const
SVal getCXXCallee () const
SVal getInstanceMessageReceiver (const LocationContext *LC) const
const DeclgetDecl () const
 Get the declaration of the function or method.
unsigned getNumArgs () const
SVal getArgSVal (unsigned i) const
const ExprgetArg (unsigned i) const
SourceRange getArgSourceRange (unsigned i) const
SourceRange getReceiverSourceRange () const
bool hasNonZeroCallbackArg () const
 Check if one of the arguments might be a callback.

Static Public Member Functions

static bool isCFCGAllowingEscape (StringRef FName)
 Check if the name corresponds to a CoreFoundation or CoreGraphics function that allows objects to escape.

Detailed Description

Common wrapper for a call expression, ObjC message, or C++ constructor, mainly to provide a common interface for their arguments.

Definition at line 162 of file ObjCMessage.h.


Constructor & Destructor Documentation

clang::ento::CallOrObjCMessage::CallOrObjCMessage ( const CallExpr callE,
ProgramStateRef  state,
const LocationContext lctx 
) [inline]

Definition at line 171 of file ObjCMessage.h.

clang::ento::CallOrObjCMessage::CallOrObjCMessage ( const CXXConstructExpr consE,
ProgramStateRef  state,
const LocationContext lctx 
) [inline]

Definition at line 174 of file ObjCMessage.h.

clang::ento::CallOrObjCMessage::CallOrObjCMessage ( const ObjCMessage msg,
ProgramStateRef  state,
const LocationContext lctx 
) [inline]

Definition at line 177 of file ObjCMessage.h.


Member Function Documentation

const Expr* clang::ento::CallOrObjCMessage::getArg ( unsigned  i) const [inline]

Definition at line 242 of file ObjCMessage.h.

References clang::ento::ObjCMessage::getArgExpr(), and getNumArgs().

Referenced by getArgSourceRange(), and getArgSVal().

SourceRange clang::ento::CallOrObjCMessage::getArgSourceRange ( unsigned  i) const [inline]
SVal clang::ento::CallOrObjCMessage::getArgSVal ( unsigned  i) const [inline]
SVal CallOrObjCMessage::getCXXCallee ( ) const

Definition at line 54 of file ObjCMessage.cpp.

References isCXXCall().

Referenced by clang::ento::ExprEngine::invalidateArguments().

const Decl * CallOrObjCMessage::getDecl ( ) const

Get the declaration of the function or method.

Definition at line 227 of file MemRegion.cpp.

References clang::ento::DeclRegion::D.

Referenced by isInSystemHeader().

SVal CallOrObjCMessage::getFunctionCallee ( ) const
SVal CallOrObjCMessage::getInstanceMessageReceiver ( const LocationContext LC) const
unsigned clang::ento::CallOrObjCMessage::getNumArgs ( ) const [inline]
const Expr* clang::ento::CallOrObjCMessage::getOriginExpr ( ) const [inline]
SourceRange clang::ento::CallOrObjCMessage::getReceiverSourceRange ( ) const [inline]
QualType CallOrObjCMessage::getResultType ( ASTContext ctx) const
bool CallOrObjCMessage::hasNonZeroCallbackArg ( ) const
bool CallOrObjCMessage::isCFCGAllowingEscape ( StringRef  FName) [static]

Check if the name corresponds to a CoreFoundation or CoreGraphics function that allows objects to escape.

Many methods allow a tracked object to escape. For example:

CFMutableDictionaryRef x = CFDictionaryCreateMutable(..., customDeallocator); CFDictionaryAddValue(y, key, x);

We handle this and similar cases with the following heuristic. If the function name contains "InsertValue", "SetValue", "AddValue", "AppendValue", or "SetAttribute", then we assume that arguments may escape.

Definition at line 163 of file ObjCMessage.cpp.

bool clang::ento::CallOrObjCMessage::isCXXCall ( ) const [inline]
bool clang::ento::CallOrObjCMessage::isCXXConstructExpr ( ) const [inline]

Definition at line 187 of file ObjCMessage.h.

bool clang::ento::CallOrObjCMessage::isFunctionCall ( ) const [inline]
bool clang::ento::CallOrObjCMessage::isInSystemHeader ( ) const [inline]

Check if the callee is declared in the system header.

Definition at line 201 of file ObjCMessage.h.

References getDecl(), and clang::SourceManager::isInSystemHeader().

bool clang::ento::CallOrObjCMessage::isObjCMessage ( ) const [inline]

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