clang
15.0.0git
|
#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/Basic/Builtins.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 "clang/Sema/SemaInternal.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/ConvertUTF.h"
Go to the source code of this file.
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. More... | |
static NSAPI::NSClassIdKindKind | ClassKindFromLiteralKind (Sema::ObjCLiteralKind LiteralKind) |
Maps ObjCLiteralKind to NSClassIdKindKind. More... | |
static bool | ValidateObjCLiteralInterfaceDecl (Sema &S, ObjCInterfaceDecl *Decl, SourceLocation Loc, Sema::ObjCLiteralKind LiteralKind) |
Validates ObjCInterfaceDecl availability. More... | |
enum | ARCConversionTypeClass { ACTC_none, ACTC_retainable, ACTC_indirectRetainable, ACTC_voidPtr, ACTC_coreFoundation } |
static ObjCInterfaceDecl * | LookupObjCInterfaceDeclForLiteral (Sema &S, SourceLocation Loc, Sema::ObjCLiteralKind LiteralKind) |
Looks up ObjCInterfaceDecl of a given NSClassIdKindKind. More... | |
static ObjCMethodDecl * | getNSNumberFactoryMethod (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. More... | |
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. More... | |
static void | CheckObjCDictionaryLiteralDuplicateKeys (Sema &S, ObjCDictionaryLiteral *Literal) |
Check for duplicate keys in an ObjC dictionary literal. More... | |
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 ObjCMethodDecl * | LookupDirectMethodInMethodList (Sema &S, Selector Sel, ObjCMethodList &MethList, bool &onlyDirect, bool &anyDirect) |
static ObjCMethodDecl * | LookupDirectMethodInGlobalPool (Sema &S, Selector Sel, bool &onlyDirect, bool &anyDirect) |
static ObjCMethodDecl * | findMethodInCurrentClass (Sema &S, Selector Sel) |
static QualType | stripObjCInstanceType (ASTContext &Context, QualType T) |
static QualType | getBaseMessageSendResultType (Sema &S, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage) |
Determine the result type of a message send based on the receiver type, method, and the kind of message send. More... | |
static const ObjCMethodDecl * | findExplicitInstancetypeDeclarer (const ObjCMethodDecl *MD, QualType instancetype) |
Look for an ObjC method whose result type exactly matches the given type. More... | |
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 | checkFoundationAPI (Sema &S, SourceLocation Loc, const ObjCMethodDecl *Method, ArrayRef< Expr * > Args, QualType ReceiverType, bool IsClassObjectCall) |
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. More... | |
static bool | isMethodDeclaredInRootProtocol (Sema &S, const ObjCMethodDecl *M) |
static void | RemoveSelectorFromWarningCache (Sema &S, Expr *Arg) |
static bool | isAnyRetainable (ARCConversionTypeClass ACTC) |
static bool | isAnyCLike (ARCConversionTypeClass ACTC) |
static ARCConversionTypeClass | classifyTypeForARCConversion (QualType type) |
template<typename DiagBuilderT > | |
static void | addFixitForObjCARCConversion (Sema &S, DiagBuilderT &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 Expr * | maybeUndoReclaimObject (Expr *e) |
Look for an ObjCReclaimReturnedObject cast and destroy it. More... | |
Definition at line 3446 of file SemaExprObjC.cpp.
|
static |
Definition at line 3751 of file SemaExprObjC.cpp.
|
static |
Definition at line 2449 of file SemaExprObjC.cpp.
|
static |
Definition at line 2488 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildClassMessage().
|
static |
Definition at line 2493 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildClassMessage().
|
static |
Definition at line 4069 of file SemaExprObjC.cpp.
|
static |
Definition at line 4006 of file SemaExprObjC.cpp.
|
static |
Check that the given expression is a valid element of an Objective-C collection literal.
Definition at line 386 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildObjCArrayLiteral().
|
static |
Check for duplicate keys in an ObjC dictionary literal.
For instance: NSDictionary *nd = "foo" : @"bar", @"foo" : @"baz" };
Definition at line 900 of file SemaExprObjC.cpp.
|
static |
Definition at line 3475 of file SemaExprObjC.cpp.
References ACTC_coreFoundation, ACTC_indirectRetainable, ACTC_none, ACTC_retainable, and ACTC_voidPtr.
Referenced by clang::Sema::CheckObjCBridgeRelatedCast(), clang::Sema::CheckObjCBridgeRelatedConversions(), clang::Sema::CheckObjCConversion(), clang::Sema::CheckTollFreeBridgeCast(), clang::Sema::CheckTollFreeBridgeStaticCast(), and clang::Sema::diagnoseARCUnbridgedCast().
|
static |
Maps ObjCLiteralKind to NSClassIdKindKind.
Definition at line 170 of file SemaExprObjC.cpp.
References clang::NSAPI::ClassId_NSArray, clang::NSAPI::ClassId_NSDictionary, clang::NSAPI::ClassId_NSNumber, clang::NSAPI::ClassId_NSString, clang::NSAPI::ClassId_NSValue, clang::Sema::LK_Array, clang::Sema::LK_Block, clang::Sema::LK_Boxed, clang::Sema::LK_Dictionary, clang::Sema::LK_None, clang::Sema::LK_Numeric, and clang::Sema::LK_String.
|
static |
Diagnose use of s directive in an NSString which is being passed as formatting string to formatting method.
Definition at line 2542 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildClassMessage().
|
static |
Definition at line 1206 of file SemaExprObjC.cpp.
Referenced by clang::Sema::ParseObjCSelectorExpression().
|
static |
Definition at line 3874 of file SemaExprObjC.cpp.
Referenced by clang::Sema::CheckObjCConversion(), and clang::Sema::diagnoseARCUnbridgedCast().
|
static |
Look for an ObjC method whose result type exactly matches the given type.
Definition at line 1624 of file SemaExprObjC.cpp.
References clang::Decl::getDeclContext(), clang::ObjCContainerDecl::getMethod(), clang::ObjCMethodDecl::getOverriddenMethods(), clang::ObjCMethodDecl::getReturnType(), clang::ObjCMethodDecl::getSelector(), and clang::ObjCMethodDecl::isInstanceMethod().
Referenced by clang::Sema::EmitRelatedResultTypeNoteForReturn().
|
static |
Definition at line 1272 of file SemaExprObjC.cpp.
Referenced by clang::Sema::ParseObjCSelectorExpression().
|
static |
Determine the result type of a message send based on the receiver type, method, and the kind of message send.
This is the "base" result type, which will still need to be adjusted to account for nullability.
Definition at line 1454 of file SemaExprObjC.cpp.
Referenced by clang::Sema::getMessageSendResultType().
|
static |
Retrieve the NSNumber factory method that should be used to create an Objective-C literal for the given type.
Definition at line 242 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildObjCBoxedExpr(), and clang::Sema::BuildObjCNumericLiteral().
|
inlinestatic |
Definition at line 3846 of file SemaExprObjC.cpp.
References clang::ast_matchers::attr, clang::Type::getAs(), clang::TypedefType::getDecl(), clang::Type::getPointeeType(), clang::TypedefNameDecl::getUnderlyingType(), and clang::Type::isPointerType().
|
static |
Definition at line 1175 of file SemaExprObjC.cpp.
|
static |
Definition at line 3469 of file SemaExprObjC.cpp.
References ACTC_coreFoundation, ACTC_none, and ACTC_voidPtr.
Referenced by clang::Sema::CheckObjCConversion().
|
static |
Definition at line 3463 of file SemaExprObjC.cpp.
References ACTC_coreFoundation, ACTC_retainable, and ACTC_voidPtr.
Referenced by clang::Sema::CheckObjCConversion().
|
static |
Definition at line 2793 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildInstanceMessage().
|
static |
Definition at line 1257 of file SemaExprObjC.cpp.
Referenced by clang::Sema::ParseObjCSelectorExpression().
|
static |
Definition at line 1231 of file SemaExprObjC.cpp.
|
static |
Looks up ObjCInterfaceDecl of a given NSClassIdKindKind.
Used to create ObjC literals, such as NSDictionary (}), NSArray (@[]) and Boxed Expressions (@())
Definition at line 218 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildObjCArrayLiteral(), clang::Sema::BuildObjCBoxedExpr(), and clang::Sema::BuildObjCDictionaryLiteral().
Look for an ObjCReclaimReturnedObject cast and destroy it.
Definition at line 4604 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildObjCBridgedCast().
|
static |
Definition at line 3861 of file SemaExprObjC.cpp.
References clang::QualType::getTypePtr(), and clang::TypedefNameDecl::getUnderlyingType().
Referenced by clang::Sema::checkObjCBridgeRelatedComponents().
Definition at line 3402 of file SemaExprObjC.cpp.
|
static |
|
static |
Emits an error if the given method does not exist, or if the return type is not an Objective-C object.
Definition at line 147 of file SemaExprObjC.cpp.
Referenced by clang::Sema::BuildObjCArrayLiteral(), clang::Sema::BuildObjCBoxedExpr(), and clang::Sema::BuildObjCDictionaryLiteral().
|
static |
Validates ObjCInterfaceDecl availability.
ObjCInterfaceDecl, used to create ObjC literals, should be defined if clang not in a debugger mode.
Definition at line 196 of file SemaExprObjC.cpp.