clang API Documentation

Enumerations | Functions
SemaExprObjC.cpp File Reference
#include "clang/Sema/SemaInternal.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/TypeLoc.h"
#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
#include "clang/Edit/Commit.h"
#include "clang/Edit/Rewriters.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "llvm/ADT/SmallString.h"
Include dependency graph for SemaExprObjC.cpp:

Go to the source code of this file.

Enumerations

enum  ARCConversionTypeClass {
  ACTC_none, ACTC_retainable, ACTC_indirectRetainable, ACTC_voidPtr,
  ACTC_coreFoundation
}
enum  ACCResult
 A result from the cast checker. More...

Functions

static bool validateBoxingMethod (Sema &S, SourceLocation Loc, const ObjCInterfaceDecl *Class, Selector Sel, const ObjCMethodDecl *Method)
 Emits an error if the given method does not exist, or if the return type is not an Objective-C object.
static ObjCMethodDeclgetNSNumberFactoryMethod (Sema &S, SourceLocation Loc, QualType NumberType, bool isLiteral=false, SourceRange R=SourceRange())
 Retrieve the NSNumber factory method that should be used to create an Objective-C literal for the given type.
static ExprResult CheckObjCCollectionLiteralElement (Sema &S, Expr *Element, QualType T, bool ArrayLiteral=false)
 Check that the given expression is a valid element of an Objective-C collection literal.
static bool HelperToDiagnoseMismatchedMethodsInGlobalPool (Sema &S, SourceLocation AtLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, ObjCMethodDecl *Method, ObjCMethodList &MethList)
static void DiagnoseMismatchedSelectors (Sema &S, SourceLocation AtLoc, ObjCMethodDecl *Method, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
static QualType stripObjCInstanceType (ASTContext &Context, QualType T)
static const ObjCMethodDeclfindExplicitInstancetypeDeclarer (const ObjCMethodDecl *MD, QualType instancetype)
 Look for an ObjC method whose result type exactly matches the given type.
static void DiagnoseARCUseOfWeakReceiver (Sema &S, Expr *Receiver)
static void applyCocoaAPICheck (Sema &S, const ObjCMessageExpr *Msg, unsigned DiagID, bool(*refactor)(const ObjCMessageExpr *, const NSAPI &, edit::Commit &))
static void checkCocoaAPI (Sema &S, const ObjCMessageExpr *Msg)
static void DiagnoseCStringFormatDirectiveInObjCAPI (Sema &S, ObjCMethodDecl *Method, Selector Sel, Expr **Args, unsigned NumArgs)
 Diagnose use of s directive in an NSString which is being passed as formatting string to formatting method.
static void RemoveSelectorFromWarningCache (Sema &S, Expr *Arg)
static bool isAnyRetainable (ARCConversionTypeClass ACTC)
static bool isAnyCLike (ARCConversionTypeClass ACTC)
static ARCConversionTypeClass classifyTypeForARCConversion (QualType type)
static void addFixitForObjCARCConversion (Sema &S, DiagnosticBuilder &DiagB, Sema::CheckedConversionKind CCK, SourceLocation afterLParen, QualType castType, Expr *castExpr, Expr *realCast, const char *bridgeKeyword, const char *CFBridgeName)
template<typename T >
static T * getObjCBridgeAttr (const TypedefType *TD)
static ObjCBridgeRelatedAttr * ObjCBridgeRelatedAttrFromType (QualType T, TypedefNameDecl *&TDNDecl)
static void diagnoseObjCARCConversion (Sema &S, SourceRange castRange, QualType castType, ARCConversionTypeClass castACTC, Expr *castExpr, Expr *realCast, ARCConversionTypeClass exprACTC, Sema::CheckedConversionKind CCK)
template<typename TB >
static bool CheckObjCBridgeNSCast (Sema &S, QualType castType, Expr *castExpr, bool &HadTheAttribute, bool warn)
template<typename TB >
static bool CheckObjCBridgeCFCast (Sema &S, QualType castType, Expr *castExpr, bool &HadTheAttribute, bool warn)
static ExprmaybeUndoReclaimObject (Expr *e)
 Look for an ObjCReclaimReturnedObject cast and destroy it.

Enumeration Type Documentation

enum ACCResult

A result from the cast checker.

Definition at line 2915 of file SemaExprObjC.cpp.

Enumerator:
ACTC_none 

int, void, struct A

ACTC_retainable 

id, void (^)()

ACTC_indirectRetainable 

id*, id***, void (^*)(),

ACTC_voidPtr 

void* might be a normal C type, or it might a CF type.

ACTC_coreFoundation 

struct A*

Definition at line 2847 of file SemaExprObjC.cpp.


Function Documentation

static void addFixitForObjCARCConversion ( Sema S,
DiagnosticBuilder DiagB,
Sema::CheckedConversionKind  CCK,
SourceLocation  afterLParen,
QualType  castType,
Expr castExpr,
Expr realCast,
const char *  bridgeKeyword,
const char *  CFBridgeName 
) [static]
static void applyCocoaAPICheck ( Sema S,
const ObjCMessageExpr Msg,
unsigned  DiagID,
bool(*)(const ObjCMessageExpr *, const NSAPI &, edit::Commit &)  refactor 
) [static]
static void checkCocoaAPI ( Sema S,
const ObjCMessageExpr Msg 
) [static]
template<typename TB >
static bool CheckObjCBridgeCFCast ( Sema S,
QualType  castType,
Expr castExpr,
bool HadTheAttribute,
bool  warn 
) [static]
template<typename TB >
static bool CheckObjCBridgeNSCast ( Sema S,
QualType  castType,
Expr castExpr,
bool HadTheAttribute,
bool  warn 
) [static]
static ExprResult CheckObjCCollectionLiteralElement ( Sema S,
Expr Element,
QualType  T,
bool  ArrayLiteral = false 
) [static]
static void DiagnoseARCUseOfWeakReceiver ( Sema S,
Expr Receiver 
) [static]
static void DiagnoseCStringFormatDirectiveInObjCAPI ( Sema S,
ObjCMethodDecl Method,
Selector  Sel,
Expr **  Args,
unsigned  NumArgs 
) [static]
static void DiagnoseMismatchedSelectors ( Sema S,
SourceLocation  AtLoc,
ObjCMethodDecl Method,
SourceLocation  LParenLoc,
SourceLocation  RParenLoc,
bool  WarnMultipleSelectors 
) [static]
static void diagnoseObjCARCConversion ( Sema S,
SourceRange  castRange,
QualType  castType,
ARCConversionTypeClass  castACTC,
Expr castExpr,
Expr realCast,
ARCConversionTypeClass  exprACTC,
Sema::CheckedConversionKind  CCK 
) [static]
static const ObjCMethodDecl* findExplicitInstancetypeDeclarer ( const ObjCMethodDecl MD,
QualType  instancetype 
) [static]
static ObjCMethodDecl* getNSNumberFactoryMethod ( Sema S,
SourceLocation  Loc,
QualType  NumberType,
bool  isLiteral = false,
SourceRange  R = SourceRange() 
) [static]
template<typename T >
static T* getObjCBridgeAttr ( const TypedefType TD) [inline, static]
static bool HelperToDiagnoseMismatchedMethodsInGlobalPool ( Sema S,
SourceLocation  AtLoc,
SourceLocation  LParenLoc,
SourceLocation  RParenLoc,
ObjCMethodDecl Method,
ObjCMethodList MethList 
) [static]
static bool isAnyCLike ( ARCConversionTypeClass  ACTC) [static]

Definition at line 2868 of file SemaExprObjC.cpp.

References ACTC_coreFoundation, ACTC_none, and ACTC_voidPtr.

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

static bool isAnyRetainable ( ARCConversionTypeClass  ACTC) [static]
static Expr* maybeUndoReclaimObject ( Expr e) [static]

Look for an ObjCReclaimReturnedObject cast and destroy it.

Definition at line 3961 of file SemaExprObjC.cpp.

References clang::CK_ARCReclaimReturnedObject.

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

static ObjCBridgeRelatedAttr* ObjCBridgeRelatedAttrFromType ( QualType  T,
TypedefNameDecl *&  TDNDecl 
) [static]
static void RemoveSelectorFromWarningCache ( Sema S,
Expr Arg 
) [static]
static QualType stripObjCInstanceType ( ASTContext Context,
QualType  T 
) [static]
static bool validateBoxingMethod ( Sema S,
SourceLocation  Loc,
const ObjCInterfaceDecl Class,
Selector  Sel,
const ObjCMethodDecl Method 
) [static]