27 #include "llvm/ADT/SmallString.h" 28 #include "llvm/Support/ConvertUTF.h" 30 using namespace clang;
32 using llvm::makeArrayRef;
43 if (Strings.size() != 1) {
48 for (
Expr *E : Strings) {
49 S = cast<StringLiteral>(E);
68 assert(CAT &&
"String literal not of constant array type!");
73 false, StrTy, &StrLocs[0],
77 return BuildObjCStringLiteral(AtLocs[0], S);
82 if (CheckObjCString(S))
92 }
else if (getLangOpts().NoConstantCFStrings) {
94 std::string StringClass(getLangOpts().ObjCConstantStringClass);
96 if (StringClass.empty())
97 NSIdent = &Context.
Idents.
get(
"NSConstantString");
99 NSIdent = &Context.
Idents.
get(StringClass);
101 NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLoc,
116 NamedDecl *IF = LookupSingleName(TUScope, NSIdent, AtLoc,
151 S.
Diag(Loc, diag::err_undeclared_boxing_method) << Sel << Class->
getName();
158 S.
Diag(Loc, diag::err_objc_literal_method_sig)
171 switch (LiteralKind) {
189 llvm_unreachable(
"LiteralKind can't be converted into a ClassKind");
201 S.
Diag(Loc, diag::err_undeclared_objc_literal_class)
202 << II->
getName() << LiteralKind;
205 S.
Diag(Loc, diag::err_undeclared_objc_literal_class)
206 << Decl->
getName() << LiteralKind;
246 S.
NSAPIObj->getNSNumberFactoryMethodKind(NumberType);
250 S.
Diag(Loc, diag::err_invalid_nsnumber_type)
283 if (!Method && S.
getLangOpts().DebuggerObjCLiteral) {
320 switch (Char->getKind()) {
323 NumberType = Context.
CharTy;
352 ExprResult ConvertedNumber = PerformCopyInitialization(Entity,
357 Number = ConvertedNumber.
get();
360 return MaybeBindToTemporary(
370 Inner = ActOnCXXBoolLiteral(ValueLoc, Value? tok::kw_true : tok::kw_false);
374 Inner = ActOnIntegerConstant(ValueLoc, Value? 1 : 0);
375 Inner = ImpCastExprToType(Inner.
get(), Context.
BoolTy,
376 CK_IntegralToBoolean);
379 return BuildObjCNumericLiteral(AtLoc, Inner.
get());
386 bool ArrayLiteral =
false) {
394 Element = Result.
get();
406 return Seq.Perform(S, Entity, Kind, Element);
409 Expr *OrigElement = Element;
415 Element = Result.
get();
420 bool Recovered =
false;
423 if (isa<IntegerLiteral>(OrigElement) ||
424 isa<CharacterLiteral>(OrigElement) ||
425 isa<FloatingLiteral>(OrigElement) ||
426 isa<ObjCBoolLiteralExpr>(OrigElement) ||
427 isa<CXXBoolLiteralExpr>(OrigElement)) {
428 if (S.
NSAPIObj->getNSNumberFactoryMethodKind(OrigElement->
getType())) {
429 int Which = isa<CharacterLiteral>(OrigElement) ? 1
430 : (isa<CXXBoolLiteralExpr>(OrigElement) ||
431 isa<ObjCBoolLiteralExpr>(OrigElement)) ? 2
440 if (Result.isInvalid())
443 Element = Result.get();
448 else if (
StringLiteral *String = dyn_cast<StringLiteral>(OrigElement)) {
449 if (String->isAscii()) {
455 if (Result.isInvalid())
458 Element = Result.get();
471 dyn_cast<ObjCStringLiteral>(OrigElement)) {
473 unsigned numConcat = SL->getNumConcatenated();
476 bool hasMacro =
false;
477 for (
unsigned i = 0;
i < numConcat ; ++
i)
478 if (SL->getStrTokenLoc(
i).isMacroID()) {
484 diag::warn_concatenated_nsarray_literal)
507 ExprResult RValue = DefaultFunctionArrayLvalueConversion(ValueExpr);
512 ValueExpr = RValue.
get();
530 if (
auto *CE = dyn_cast<ImplicitCastExpr>(ValueExpr))
531 if (CE->getCastKind() == CK_ArrayToPointerDecay)
533 dyn_cast<StringLiteral>(CE->getSubExpr()->IgnoreParens())) {
534 assert((SL->isAscii() || SL->isUTF8()) &&
535 "unexpected character encoding");
536 StringRef Str = SL->getString();
537 const llvm::UTF8 *StrBegin = Str.bytes_begin();
538 const llvm::UTF8 *StrEnd = Str.bytes_end();
540 if (llvm::isLegalUTF8String(&StrBegin, StrEnd)) {
544 NSStringPointer, NSStringPointer);
545 return new (Context)
ObjCBoxedExpr(CE, BoxedType,
nullptr, SR);
548 Diag(SL->getBeginLoc(), diag::warn_objc_boxing_invalid_utf8_string)
549 << NSStringPointer << SL->getSourceRange();
552 if (!StringWithUTF8StringMethod) {
557 BoxingMethod = NSStringDecl->lookupClassMethod(stringWithUTF8String);
558 if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) {
563 NSStringPointer, ReturnTInfo, NSStringDecl,
582 stringWithUTF8String, BoxingMethod))
585 StringWithUTF8StringMethod = BoxingMethod;
588 BoxingMethod = StringWithUTF8StringMethod;
589 BoxedType = NSStringPointer;
598 }
else if (ValueType->isBuiltinType()) {
606 dyn_cast<CharacterLiteral>(ValueExpr->
IgnoreParens())) {
609 switch (Char->getKind()) {
612 ValueType = Context.
CharTy;
632 BoxedType = NSNumberPointer;
634 if (!ET->getDecl()->isComplete()) {
635 Diag(Loc, diag::err_objc_incomplete_boxed_expression_type)
641 ET->getDecl()->getIntegerType());
642 BoxedType = NSNumberPointer;
643 }
else if (ValueType->isObjCBoxableRecordType()) {
661 if (!ValueWithBytesObjCTypeMethod) {
669 BoxingMethod = NSValueDecl->lookupClassMethod(ValueWithBytesObjCType);
670 if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) {
677 ValueWithBytesObjCType,
698 Params.push_back(bytes);
708 Params.push_back(type);
715 ValueWithBytesObjCType, BoxingMethod))
718 ValueWithBytesObjCTypeMethod = BoxingMethod;
721 if (!ValueType.isTriviallyCopyableType(Context)) {
722 Diag(Loc, diag::err_objc_non_trivially_copyable_boxed_expression_type)
727 BoxingMethod = ValueWithBytesObjCTypeMethod;
728 BoxedType = NSValuePointer;
732 Diag(Loc, diag::err_objc_illegal_boxed_expression_type)
737 DiagnoseUseOfDecl(BoxingMethod, Loc);
740 if (ValueType->isObjCBoxableRecordType()) {
742 ConvertedValueExpr = PerformCopyInitialization(IE, ValueExpr->
getExprLoc(),
749 ConvertedValueExpr = PerformCopyInitialization(IE,
SourceLocation(),
755 ValueExpr = ConvertedValueExpr.
get();
760 return MaybeBindToTemporary(BoxedExpr);
769 assert(!LangOpts.isSubscriptPointerArithmetic());
774 "base or index cannot have dependent type here");
778 ExprResult Result = CheckPlaceholderExpr(IndexExpr);
781 IndexExpr = Result.
get();
784 Result = DefaultLvalueConversion(BaseExpr);
787 BaseExpr = Result.
get();
792 getterMethod, setterMethod, RB);
808 if (!ArrayWithObjectsMethod) {
812 if (!Method && getLangOpts().DebuggerObjCLiteral) {
829 Params.push_back(objects);
837 Params.push_back(cnt);
852 diag::note_objc_literal_method_param)
859 if (!Method->
parameters()[1]->getType()->isIntegerType()) {
863 diag::note_objc_literal_method_param)
871 ArrayWithObjectsMethod = Method;
874 QualType ObjectsType = ArrayWithObjectsMethod->parameters()[0]->getType();
879 Expr **ElementsBuffer = Elements.data();
880 for (
unsigned I = 0, N = Elements.size(); I != N; ++I) {
887 ElementsBuffer[I] = Converted.
get();
894 return MaybeBindToTemporary(
896 ArrayWithObjectsMethod, SR));
903 if (!NSDictionaryDecl) {
906 if (!NSDictionaryDecl) {
914 if (!DictionaryWithObjectsMethod) {
915 Selector Sel = NSAPIObj->getNSDictionarySelector(
917 ObjCMethodDecl *Method = NSDictionaryDecl->lookupClassMethod(Sel);
918 if (!Method && getLangOpts().DebuggerObjCLiteral) {
937 Params.push_back(objects);
945 Params.push_back(keys);
953 Params.push_back(cnt);
969 diag::note_objc_literal_method_param)
983 if (QIDNSCopying.isNull()) {
997 if (!QIDNSCopying.isNull())
1006 diag::note_objc_literal_method_param)
1019 diag::note_objc_literal_method_param)
1026 DictionaryWithObjectsMethod = Method;
1029 QualType ValuesT = DictionaryWithObjectsMethod->parameters()[0]->getType();
1031 QualType KeysT = DictionaryWithObjectsMethod->parameters()[1]->getType();
1036 bool HasPackExpansions =
false;
1050 Element.Key = Key.
get();
1051 Element.Value = Value.
get();
1053 if (Element.EllipsisLoc.isInvalid())
1056 if (!Element.Key->containsUnexpandedParameterPack() &&
1057 !Element.Value->containsUnexpandedParameterPack()) {
1058 Diag(Element.EllipsisLoc,
1059 diag::err_pack_expansion_without_parameter_packs)
1061 Element.Value->getEndLoc());
1065 HasPackExpansions =
true;
1072 Context, Elements, HasPackExpansions, Ty,
1073 DictionaryWithObjectsMethod, SR));
1086 if (RequireCompleteType(AtLoc, EncodedType,
1087 diag::err_incomplete_type_objc_at_encode,
1094 if (!NotEncodedT.
isNull())
1095 Diag(AtLoc, diag::warn_incomplete_encoded_type)
1096 << EncodedType << NotEncodedT;
1103 return new (Context)
ObjCEncodeExpr(StrTy, EncodedTypeInfo, AtLoc, RParenLoc);
1113 QualType EncodedType = GetTypeFromParser(ty, &TInfo);
1116 getLocForEndOfToken(LParenLoc));
1118 return BuildObjCEncodeExpression(AtLoc, TInfo, RParenLoc);
1128 bool Warned =
false;
1131 if (MatchingMethodDecl == Method ||
1139 S.
Diag(AtLoc, diag::warn_multiple_selectors)
1145 S.
Diag(MatchingMethodDecl->
getLocation(), diag::note_method_declared_at)
1156 bool WarnMultipleSelectors) {
1157 if (!WarnMultipleSelectors ||
1160 bool Warned =
false;
1161 for (Sema::GlobalMethodPool::iterator
b = S.
MethodPool.begin(),
1166 Method, InstMethList))
1172 Method, ClsMethList) || Warned)
1182 bool WarnMultipleSelectors) {
1186 Method = LookupFactoryMethodInGlobalPool(Sel,
1189 if (
const ObjCMethodDecl *OM = SelectorsForTypoCorrection(Sel)) {
1190 Selector MatchedSel = OM->getSelector();
1193 Diag(SelLoc, diag::warn_undeclared_selector_with_typo)
1194 << Sel << MatchedSel
1198 Diag(SelLoc, diag::warn_undeclared_selector) << Sel;
1201 WarnMultipleSelectors);
1205 !getSourceManager().isInSystemHeader(Method->
getLocation()))
1206 ReferencedSelectors.insert(std::make_pair(Sel, AtLoc));
1210 if (getLangOpts().ObjCAutoRefCount) {
1217 Diag(AtLoc, diag::err_arc_illegal_selector) <<
1246 Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId;
1250 Diag(ProtoLoc, diag::err_atprotocol_protocol) << PDecl;
1260 return new (Context)
ObjCProtocolExpr(Ty, PDecl, AtLoc, ProtoIdLoc, RParenLoc);
1306 bool isClassMessage,
1307 bool isSuperMessage) {
1308 assert(Method &&
"Must have a method");
1343 if (isSuperMessage) {
1346 return transferNullability(
1365 return transferNullability(ReceiverType);
1371 bool isClassMessage,
1372 bool isSuperMessage) {
1380 if (isClassMessage) {
1392 cast<ImplicitParamDecl>(
1394 ->getDeclContext());
1401 NewResultType, NewResultType);
1402 return NewResultType;
1414 unsigned receiverNullabilityIdx = 0;
1416 receiverNullabilityIdx = 1 + static_cast<unsigned>(*nullability);
1418 unsigned resultNullabilityIdx = 0;
1420 resultNullabilityIdx = 1 + static_cast<unsigned>(*nullability);
1424 static const uint8_t None = 0;
1425 static const uint8_t
NonNull = 1;
1428 static const uint8_t nullabilityMap[4][4] = {
1430 { None, None, Nullable, None },
1431 { None, NonNull, Nullable, Unspecified },
1432 { Nullable, Nullable, Nullable, Nullable },
1433 { None, Unspecified, Nullable, Unspecified }
1436 unsigned newResultNullabilityIdx
1437 = nullabilityMap[receiverNullabilityIdx][resultNullabilityIdx];
1438 if (newResultNullabilityIdx == resultNullabilityIdx)
1444 if (
auto attributed = dyn_cast<AttributedType>(resultType.
getTypePtr())) {
1445 resultType = attributed->getModifiedType();
1452 if (newResultNullabilityIdx > 0) {
1457 resultType, resultType);
1476 dyn_cast<ObjCCategoryImplDecl>(impl)) {
1477 iface = catImpl->getCategoryDecl();
1479 iface = impl->getClassInterface();
1489 for (
unsigned i = 0, e = overrides.size();
i != e; ++
i) {
1513 loc = overridden->getLocation();
1514 Diag(loc, diag::note_related_result_type_explicit)
1560 if (!SelectorLocs.empty() && SelectorLocs.front().isValid())
1561 SelLoc = SelectorLocs.front();
1567 for (
unsigned i = 0, e = Args.size();
i != e;
i++) {
1568 if (Args[
i]->isTypeDependent())
1572 if (getLangOpts().DebuggerSupport) {
1574 result = checkUnknownAnyArg(SelLoc, Args[
i], paramTy);
1576 result = DefaultArgumentPromotion(Args[
i]);
1580 Args[
i] = result.
get();
1584 if (getLangOpts().ObjCAutoRefCount)
1585 DiagID = diag::err_arc_method_not_found;
1587 DiagID = isClassMessage ? diag::warn_class_method_not_found
1588 : diag::warn_inst_method_not_found;
1589 if (!getLangOpts().DebuggerSupport) {
1590 const ObjCMethodDecl *OMD = SelectorsForTypoCorrection(Sel, ReceiverType);
1592 if (getLangOpts().ObjCAutoRefCount)
1593 DiagID = diag::err_method_not_found_with_typo;
1595 DiagID = isClassMessage ? diag::warn_class_method_not_found_with_typo
1596 : diag::warn_instance_method_not_found_with_typo;
1598 SourceRange SelectorRange(SelectorLocs.front(), SelectorLocs.back());
1600 Diag(SelLoc, DiagID)
1601 << Sel<< isClassMessage << MatchedSel
1604 Diag(SelLoc, DiagID) << Sel<< isClassMessage << MatchedSel;
1607 Diag(SelLoc, DiagID)
1608 << Sel << isClassMessage <<
SourceRange(SelectorLocs.front(),
1609 SelectorLocs.back());
1614 Diag(ThisClass->getLocation(), diag::note_receiver_class_declared);
1616 if (ThisClass->lookupClassMethod(Sel))
1617 Diag(RecRange.
getBegin(),diag::note_receiver_expr_here)
1619 ThisClass->getNameAsString());
1626 if (getLangOpts().DebuggerSupport) {
1635 ReturnType = getMessageSendResultType(Receiver, ReceiverType, Method,
1636 isClassMessage, isSuperMessage);
1645 if (Args.size() < NumNamedArgs) {
1646 Diag(SelLoc, diag::err_typecheck_call_too_few_args)
1647 << 2 << NumNamedArgs << static_cast<unsigned>(Args.size());
1655 bool IsError =
false;
1656 for (
unsigned i = 0;
i < NumNamedArgs;
i++) {
1658 if (Args[
i]->isTypeDependent())
1661 Expr *argExpr = Args[
i];
1664 assert(argExpr &&
"CheckMessageArgumentTypes(): missing expression");
1666 if (param->
hasAttr<NoEscapeAttr>())
1667 if (
auto *BE = dyn_cast<BlockExpr>(
1669 BE->getBlockDecl()->setDoesNotEscape();
1674 !param->
hasAttr<CFConsumedAttr>())
1675 argExpr = stripARCUnbridgedCast(argExpr);
1681 ExprResult argE = checkUnknownAnyArg(SelLoc, argExpr, paramType);
1685 Args[
i] = argE.
get();
1703 diag::err_call_incomplete_argument, argExpr))
1718 Args[
i]->getType()->isBlockPointerType() &&
1721 maybeExtendBlockObject(arg);
1722 Args[
i] = arg.
get();
1729 for (
unsigned i = NumNamedArgs, e = Args.size();
i < e; ++
i) {
1730 if (Args[
i]->isTypeDependent())
1733 ExprResult Arg = DefaultVariadicArgumentPromotion(Args[
i], VariadicMethod,
1736 Args[
i] = Arg.
get();
1740 if (Args.size() != NumNamedArgs) {
1741 Diag(Args[NumNamedArgs]->getBeginLoc(),
1742 diag::err_typecheck_call_too_many_args)
1743 << 2 << NumNamedArgs << static_cast<unsigned>(Args.size())
1746 Args.back()->getEndLoc());
1750 DiagnoseSentinelCalls(Method, SelLoc, Args);
1753 IsError |= CheckObjCMethodCall(
1754 Method, SelLoc, makeArrayRef(Args.data(), Args.size()));
1762 dyn_cast_or_null<ObjCMethodDecl>(CurContext->getNonClosureAncestor());
1763 return isSelfExpr(RExpr, Method);
1767 if (!method)
return false;
1770 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(receiver))
1782 if (
ObjCMethodDecl *method = iface->lookupMethod(sel, isInstance))
1787 if (
ObjCMethodDecl *method = iface->lookupPrivateMethod(sel, isInstance))
1792 for (
const auto *I : objType->
quals())
1806 for (
const auto *PROTO : OPT->
quals()) {
1807 if ((MD = PROTO->lookupMethod(Sel, Instance))) {
1827 Diag(MemberLoc, diag::err_invalid_property_name)
1837 diag::err_property_not_found_forward_class,
1838 MemberName, BaseRange))
1844 if (DiagnoseUseOfDecl(PD, MemberLoc))
1847 return new (Context)
1851 return new (Context)
1856 for (
const auto *I : OPT->
quals())
1860 if (DiagnoseUseOfDecl(PD, MemberLoc))
1866 SuperLoc, SuperType);
1868 return new (Context)
1878 Selector Sel = PP.getSelectorTable().getNullarySelector(Member);
1883 Getter = LookupMethodInQualifiedType(Sel, OPT,
true);
1891 if (DiagnoseUseOfDecl(Getter, MemberLoc))
1898 PP.getSelectorTable(), Member);
1903 Setter = LookupMethodInQualifiedType(SetterSel, OPT,
true);
1911 if (Setter && DiagnoseUseOfDecl(Setter, MemberLoc))
1917 if (Setter && Setter->isImplicit() && Setter->isPropertyAccessor() &&
1925 diag::warn_property_access_suggest)
1926 << MemberName <<
QualType(OPT, 0) << PDecl->getName()
1931 if (Getter || Setter) {
1933 return new (Context)
1937 return new (Context)
1947 nullptr,
nullptr, CCC, CTK_ErrorRecovery, IFace,
false, OPT)) {
1953 Corrected.isKeyword() ? nullptr : Corrected.getFoundDecl();
1954 if (ChosenDecl && isa<ObjCPropertyDecl>(ChosenDecl))
1955 if (cast<ObjCPropertyDecl>(ChosenDecl)->isClassProperty()) {
1958 Diag(MemberLoc, diag::err_class_property_found) << MemberName
1965 diagnoseTypo(Corrected, PDiag(diag::err_property_not_found_suggest)
1966 << MemberName <<
QualType(OPT, 0));
1967 return HandleExprPropertyRefExpr(OPT, BaseExpr, OpLoc,
1968 TypoResult, MemberLoc,
1969 SuperLoc, SuperType, Super);
1974 IFace->lookupInstanceVariable(Member, ClassDeclared)) {
1978 if (RequireCompleteType(MemberLoc, OBJPT->getPointeeType(),
1979 diag::err_property_not_as_forward_class,
1980 MemberName, BaseExpr))
1984 diag::err_ivar_access_using_property_syntax_suggest)
1985 << MemberName <<
QualType(OPT, 0) << Ivar->getDeclName()
1990 Diag(MemberLoc, diag::err_property_not_found)
1993 Diag(Setter->getLocation(), diag::note_getter_unavailable)
2012 if (receiverNamePtr->
isStr(
"super")) {
2013 if (
ObjCMethodDecl *CurMethod = tryCaptureObjCSelf(receiverNameLoc)) {
2014 if (
auto classDecl = CurMethod->getClassInterface()) {
2015 SuperType =
QualType(classDecl->getSuperClassType(), 0);
2016 if (CurMethod->isInstanceMethod()) {
2017 if (SuperType.
isNull()) {
2019 Diag(receiverNameLoc, diag::err_root_class_cannot_use_super)
2020 << CurMethod->getClassInterface()->getIdentifier();
2030 receiverNameLoc, T,
true);
2041 Diag(receiverNameLoc, diag::err_expected_either) << tok::identifier
2051 GetterSel = PD->getGetterName();
2052 SetterSel = PD->getSetterName();
2054 GetterSel = PP.getSelectorTable().getNullarySelector(&propertyName);
2056 PP.getIdentifierTable(), PP.getSelectorTable(), &propertyName);
2069 if (DiagnoseUseOfDecl(Getter, propertyNameLoc))
2084 if (Setter && DiagnoseUseOfDecl(Setter, propertyNameLoc))
2087 if (Getter || Setter) {
2089 return new (Context)
2096 propertyNameLoc, receiverNameLoc, IFace);
2098 return ExprError(
Diag(propertyNameLoc, diag::err_property_not_found)
2112 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
2117 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
2118 return llvm::make_unique<ObjCInterfaceOrSuperCCC>(*this);
2128 bool HasTrailingDot,
2130 ReceiverType =
nullptr;
2136 return HasTrailingDot? ObjCInstanceMessage : ObjCSuperMessage;
2138 LookupResult Result(*
this, Name, NameLoc, LookupOrdinaryName);
2139 LookupName(Result, S);
2148 if (!Method->getClassInterface()) {
2150 return ObjCInstanceMessage;
2154 if (Method->getClassInterface()->lookupInstanceVariable(Name,
2156 return ObjCInstanceMessage;
2167 return ObjCInstanceMessage;
2173 return ObjCInstanceMessage;
2182 DiagnoseUseOfDecl(
Type, NameLoc);
2185 return ObjCInstanceMessage;
2190 ReceiverType = CreateParsedType(T, TSInfo);
2191 return ObjCClassMessage;
2195 ObjCInterfaceOrSuperCCC CCC(getCurMethodDecl());
2198 CTK_ErrorRecovery,
nullptr,
false,
nullptr,
false)) {
2199 if (Corrected.isKeyword()) {
2202 diagnoseTypo(Corrected,
2203 PDiag(diag::err_unknown_receiver_suggest) << Name);
2204 return ObjCSuperMessage;
2209 diagnoseTypo(Corrected,
2210 PDiag(diag::err_unknown_receiver_suggest) << Name);
2213 ReceiverType = CreateParsedType(T, TSInfo);
2214 return ObjCClassMessage;
2219 return ObjCInstanceMessage;
2232 Diag(SuperLoc, diag::err_invalid_receiver_to_message_super);
2238 Diag(SuperLoc, diag::err_no_super_class_message)
2244 if (SuperTy.isNull()) {
2246 Diag(SuperLoc, diag::err_root_class_cannot_use_super)
2254 getCurFunction()->ObjCShouldCallSuper =
false;
2260 return BuildInstanceMessage(
nullptr, SuperTy, SuperLoc,
2262 LBracLoc, SelectorLocs, RBracLoc, Args);
2267 return BuildClassMessage(
nullptr,
2269 SuperLoc, Sel,
nullptr,
2270 LBracLoc, SelectorLocs, RBracLoc, Args);
2274 bool isSuperReceiver,
2280 if (!ReceiverType.
isNull())
2283 return BuildClassMessage(receiverTypeInfo, ReceiverType,
2285 Sel, Method, Loc, Loc, Loc, Args,
2299 if (refactor(Msg,*S.
NSAPIObj, ECommit)) {
2308 switch (Edit.
Kind) {
2336 bool IsClassObjectCall) {
2346 if (!IsClassObjectCall) {
2348 if (!OPT || !OPT->getInterfaceDecl())
2351 OPT->getInterfaceDecl()->lookupInstanceMethod(SE->getSelector());
2354 OPT->getInterfaceDecl()->lookupPrivateMethod(SE->getSelector());
2359 ImpliedMethod = IT->getDecl()->lookupClassMethod(SE->getSelector());
2362 IT->getDecl()->lookupPrivateClassMethod(SE->getSelector());
2369 S.
Diag(Loc, diag::warn_objc_unsafe_perform_selector)
2375 diag::note_objc_unsafe_perform_selector_method_declared_here)
2386 Expr **Args,
unsigned NumArgs) {
2388 bool Format =
false;
2402 if (!Format || NumArgs <= Idx)
2405 Expr *FormatExpr = Args[Idx];
2410 S.
Diag(FormatExpr->
getExprLoc(), diag::warn_objc_cdirective_format_string)
2460 Diag(Loc, diag::err_missing_open_square_message_send)
2465 if (!SelectorLocs.empty() && SelectorLocs.front().isValid())
2466 SelectorSlotLocs = SelectorLocs;
2468 SelectorSlotLocs = Loc;
2474 unsigned NumArgs = ArgsIn.size();
2475 Expr **Args = ArgsIn.data();
2476 assert(SuperLoc.
isInvalid() &&
"Message to super with dependent type");
2478 Context, ReceiverType,
VK_RValue, LBracLoc, ReceiverTypeInfo, Sel,
2479 SelectorLocs,
nullptr, makeArrayRef(Args, NumArgs), RBracLoc,
2486 if (!ClassType || !(Class = ClassType->
getInterface())) {
2487 Diag(Loc, diag::err_invalid_receiver_class_message)
2491 assert(Class &&
"We don't know which class we're messaging?");
2494 (void)DiagnoseUseOfDecl(Class, SelectorSlotLocs);
2501 (getLangOpts().ObjCAutoRefCount
2502 ? diag::err_arc_receiver_forward_class
2503 : diag::warn_receiver_forward_class),
2506 Method = LookupFactoryMethodInGlobalPool(Sel,
2508 if (Method && !getLangOpts().ObjCAutoRefCount)
2519 if (Method && DiagnoseUseOfDecl(Method, SelectorSlotLocs,
2520 nullptr,
false,
false, Class))
2528 unsigned NumArgs = ArgsIn.size();
2529 Expr **Args = ArgsIn.data();
2530 if (CheckMessageArgumentTypes(
nullptr, ReceiverType,
2532 Method,
true, SuperLoc.
isValid(), LBracLoc,
2538 diag::err_illegal_message_expr_incomplete_type))
2547 Diag(Loc, diag::warn_direct_initialize_call);
2555 Diag(Loc, diag::warn_direct_super_initialize_call);
2558 Diag(CurMeth->getLocation(), diag::note_method_declared_at)
2559 << CurMeth->getDeclName();
2571 ReceiverType, Sel, SelectorLocs,
2572 Method, makeArrayRef(Args, NumArgs),
2573 RBracLoc, isImplicit);
2576 ReceiverTypeInfo, Sel, SelectorLocs,
2577 Method, makeArrayRef(Args, NumArgs),
2578 RBracLoc, isImplicit);
2584 ReceiverType,
true);
2585 return MaybeBindToTemporary(Result);
2599 QualType ReceiverType = GetTypeFromParser(Receiver, &ReceiverTypeInfo);
2600 if (ReceiverType.
isNull())
2603 if (!ReceiverTypeInfo)
2606 return BuildClassMessage(ReceiverTypeInfo, ReceiverType,
2608 nullptr, LBracLoc, SelectorLocs, RBracLoc,
2618 return BuildInstanceMessage(Receiver, ReceiverType,
2620 Sel, Method, Loc, Loc, Loc, Args,
2631 if (
const auto *RootClass = dyn_cast_or_null<ObjCInterfaceDecl>(
2635 if (
P->getCanonicalDecl() == Protocol->getCanonicalDecl())
2680 assert((Receiver || SuperLoc.
isValid()) &&
"If the Receiver is null, the " 2681 "SuperLoc must be valid so we can " 2689 if (!SelectorLocs.empty() && SelectorLocs.front().isValid())
2690 SelectorSlotLocs = SelectorLocs;
2692 SelectorSlotLocs = Loc;
2696 Diag(Loc, diag::err_missing_open_square_message_send)
2707 Result = forceUnknownAnyToType(Receiver, Context.
getObjCIdType());
2709 Result = CheckPlaceholderExpr(Receiver);
2711 Receiver = Result.
get();
2717 unsigned NumArgs = ArgsIn.size();
2718 Expr **Args = ArgsIn.data();
2719 assert(SuperLoc.
isInvalid() &&
"Message to super with dependent type");
2722 SelectorLocs,
nullptr, makeArrayRef(Args, NumArgs),
2723 RBracLoc, isImplicit);
2728 ExprResult Result = DefaultFunctionArrayLvalueConversion(Receiver);
2731 Receiver = Result.
get();
2732 ReceiverType = Receiver->
getType();
2739 }
else if (!getLangOpts().ObjCAutoRefCount &&
2745 Diag(Loc, diag::warn_bad_receiver_type)
2749 Receiver = ImpCastExprToType(Receiver, Context.
getObjCIdType(),
2750 CK_CPointerToObjCPointerCast).
get();
2755 CastKind Kind = IsNull ? CK_NullToPointer : CK_IntegralToPointer;
2756 Receiver = ImpCastExprToType(Receiver, Context.
getObjCIdType(),
2759 ReceiverType = Receiver->
getType();
2762 if (RequireCompleteType(Loc, Receiver->
getType(),
2763 diag::err_incomplete_receiver_type))
2768 Receiver = result.
get();
2769 ReceiverType = Receiver->
getType();
2775 Diag(Receiver->
getExprLoc(), diag::warn_messaging_unqualified_id);
2791 CollectMultipleMethodsInGlobalPool(Sel, Methods,
true,
2793 if (!Methods.empty()) {
2796 Method = Methods[0];
2800 Method = BestMethod;
2802 if (!AreMultipleMethodsInGlobalPool(Sel, Method,
2804 receiverIsIdLike, Methods))
2805 DiagnoseUseOfDecl(Method, SelectorSlotLocs);
2817 Method = LookupMethodInQualifiedType(Sel, QClassTy,
false);
2819 Method = LookupMethodInQualifiedType(Sel, QClassTy,
true);
2822 Diag(SelLoc, diag::warn_instance_method_on_class_found)
2835 Method = ClassDecl->lookupClassMethod(Sel);
2838 Method = ClassDecl->lookupPrivateClassMethod(Sel);
2840 if (Method && DiagnoseUseOfDecl(Method, SelectorSlotLocs))
2846 if (!Receiver || !isSelfExpr(Receiver)) {
2850 CollectMultipleMethodsInGlobalPool(Sel, Methods,
2853 if (!Methods.empty()) {
2856 Method = Methods[0];
2862 if (
ID->getSuperClass())
2863 Diag(SelLoc, diag::warn_root_inst_method_not_found)
2871 Method = BestMethod;
2885 Method = LookupMethodInQualifiedType(Sel, QIdTy,
true);
2887 Method = LookupMethodInQualifiedType(Sel, QIdTy,
false);
2888 if (Method && DiagnoseUseOfDecl(Method, SelectorSlotLocs))
2893 ClassDecl = OCIType->getInterfaceDecl();
2900 if (RequireCompleteType(Loc, OCIType->getPointeeType(),
2901 getLangOpts().ObjCAutoRefCount
2902 ? diag::err_arc_receiver_forward_instance
2903 : diag::warn_receiver_forward_instance,
2906 if (getLangOpts().ObjCAutoRefCount)
2909 forwardClass = OCIType->getInterfaceDecl();
2911 diag::note_receiver_is_id);
2919 Method = LookupMethodInQualifiedType(Sel, OCIType,
true);
2925 if (!Method && getLangOpts().ObjCAutoRefCount) {
2926 Diag(SelLoc, diag::err_arc_may_not_respond)
2927 << OCIType->getPointeeType() << Sel << RecRange
2928 <<
SourceRange(SelectorLocs.front(), SelectorLocs.back());
2932 if (!Method && (!Receiver || !isSelfExpr(Receiver))) {
2936 if (OCIType->qual_empty()) {
2938 CollectMultipleMethodsInGlobalPool(Sel, Methods,
2941 if (!Methods.empty()) {
2944 Method = Methods[0];
2949 Method = BestMethod;
2951 AreMultipleMethodsInGlobalPool(Sel, Method,
2956 if (Method && !forwardClass)
2957 Diag(SelLoc, diag::warn_maynot_respond)
2958 << OCIType->getInterfaceDecl()->getIdentifier()
2963 if (Method && DiagnoseUseOfDecl(Method, SelectorSlotLocs, forwardClass))
2967 Diag(Loc, diag::err_bad_receiver_type)
2976 ? getEnclosingFunction() :
nullptr;
2978 if (DIFunctionScopeInfo &&
2980 (SuperLoc.
isValid() || isSelfExpr(Receiver))) {
2981 bool isDesignatedInitChain =
false;
2988 if (!
ID->declaresOrInheritsDesignatedInitializers() ||
2989 ID->isDesignatedInitializer(Sel)) {
2990 isDesignatedInitChain =
true;
2996 if (!isDesignatedInitChain) {
3000 assert(isDesignated && InitMethod);
3003 diag::warn_objc_designated_init_non_designated_init_call :
3004 diag::warn_objc_designated_init_non_super_designated_init_call);
3006 diag::note_objc_designated_init_marked_here);
3010 if (DIFunctionScopeInfo &&
3012 (SuperLoc.
isValid() || isSelfExpr(Receiver))) {
3014 Diag(SelLoc, diag::warn_objc_secondary_init_super_init_call);
3021 unsigned NumArgs = ArgsIn.size();
3022 Expr **Args = ArgsIn.data();
3027 if (CheckMessageArgumentTypes(Receiver, ReceiverType,
3029 Method, ClassMessage, SuperLoc.
isValid(),
3030 LBracLoc, RBracLoc, RecRange, ReturnType, VK))
3035 diag::err_illegal_message_expr_incomplete_type))
3040 if (getLangOpts().ObjCAutoRefCount) {
3046 checkInitMethod(Method, ReceiverType);
3064 Diag(SelLoc, diag::err_arc_illegal_explicit_message)
3069 if (Method && NumArgs >= 1) {
3070 if (
const auto *SelExp =
3071 dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens())) {
3072 Selector ArgSel = SelExp->getSelector();
3074 LookupInstanceMethodInGlobalPool(ArgSel,
3075 SelExp->getSourceRange());
3078 LookupFactoryMethodInGlobalPool(ArgSel,
3079 SelExp->getSourceRange());
3082 switch (SelFamily) {
3089 if (!SelMethod->
hasAttr<NSReturnsNotRetainedAttr>()) {
3092 diag::err_arc_perform_selector_retains);
3099 if (SelMethod->
hasAttr<NSReturnsRetainedAttr>()) {
3102 diag::err_arc_perform_selector_retains);
3111 Diag(SelLoc, diag::warn_arc_perform_selector_leaks);
3112 Diag(Args[0]->getExprLoc(), diag::note_used_here);
3126 ReceiverType, Sel, SelectorLocs, Method,
3127 makeArrayRef(Args, NumArgs), RBracLoc,
3131 Receiver, Sel, SelectorLocs, Method,
3132 makeArrayRef(Args, NumArgs), RBracLoc,
3138 bool IsClassObjectCall = ClassMessage;
3143 if (Receiver && isSelfExpr(Receiver)) {
3145 if (OPT->getObjectType()->isObjCClass()) {
3146 if (
const auto *CurMeth = getCurMethodDecl()) {
3147 IsClassObjectCall =
true;
3155 ReceiverType, IsClassObjectCall);
3158 if (getLangOpts().ObjCAutoRefCount) {
3161 (SuperLoc.
isValid() || isSelfExpr(Receiver))) {
3175 checkRetainCycles(Result);
3178 if (getLangOpts().ObjCWeak) {
3179 if (!isImplicit && Method) {
3185 if (IsWeak && !isUnevaluatedContext() &&
3186 !Diags.isIgnored(diag::warn_arc_repeated_use_of_weak, LBracLoc))
3187 getCurFunction()->recordUseOfWeak(Result, Prop);
3192 CheckObjCCircularContainer(Result);
3194 return MaybeBindToTemporary(Result);
3222 if (isa<ParenListExpr>(Receiver)) {
3223 ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Receiver);
3225 Receiver = Result.
get();
3228 if (RespondsToSelectorSel.isNull()) {
3232 if (Sel == RespondsToSelectorSel)
3235 return BuildInstanceMessage(Receiver, Receiver->
getType(),
3237 nullptr, LBracLoc, SelectorLocs,
3271 bool isIndirect =
false;
3290 type =
QualType(array->getElementType()->getBaseElementTypeUnsafe(), 0);
3325 if (left == right)
return left;
3326 if (left == ACC_bottom)
return right;
3327 if (right == ACC_bottom)
return left;
3333 class ARCCastChecker :
public StmtVisitor<ARCCastChecker, ACCResult> {
3349 : Context(Context), SourceClass(source), TargetClass(target),
3350 Diagnose(diagnose) {}
3380 case CK_NullToPointer:
3384 case CK_LValueToRValue:
3386 case CK_CPointerToObjCPointerCast:
3387 case CK_BlockPointerToObjCPointerCast:
3388 case CK_AnyPointerToBlockPointerCast:
3403 return Visit(e->
getRHS());
3409 if (left == ACC_invalid)
return ACC_invalid;
3439 return ACC_plusZero;
3452 return super::VisitCallExpr(e);
3464 if (fn->
hasAttr<CFReturnsNotRetainedAttr>())
3465 return ACC_plusZero;
3470 if (fn->
hasAttr<CFReturnsRetainedAttr>())
3471 return Diagnose ? ACC_plusOne
3476 if (builtinID == Builtin::BI__builtin___CFStringMakeConstantString)
3480 if (!fn->
hasAttr<CFAuditedTransferAttr>())
3485 return Diagnose ? ACC_plusOne
3488 return ACC_plusZero;
3501 return checkCallToMethod(method);
3505 if (!method)
return ACC_invalid;
3514 if (method->
hasAttr<CFReturnsNotRetainedAttr>())
3515 return ACC_plusZero;
3519 if (method->
hasAttr<CFReturnsRetainedAttr>())
3531 return ACC_plusZero;
3542 return LookupName(R, TUScope,
false);
3552 const char *bridgeKeyword,
3553 const char *CFBridgeName) {
3569 NCE->getAngleBrackets().getEnd());
3577 BridgeCall += CFBridgeName;
3584 castedE = CCE->getSubExpr();
3595 BridgeCall += CFBridgeName;
3597 if (isa<ParenExpr>(castedE)) {
3615 std::string castCode =
"(";
3616 castCode += bridgeKeyword;
3620 NCE->getAngleBrackets().getEnd());
3624 std::string castCode =
"(";
3625 castCode += bridgeKeyword;
3630 if (isa<ParenExpr>(castedE)) {
3644 template <
typename T>
3652 return RD->getAttr<T>();
3660 TDNDecl = TD->getDecl();
3661 if (ObjCBridgeRelatedAttr *ObjCBAttr =
3662 getObjCBridgeAttr<ObjCBridgeRelatedAttr>(TD))
3679 UnavailableAttr::IR_ARCForbiddenConversion))
3692 unsigned srcKind = 0;
3716 S.
Diag(loc, diag::err_arc_cast_requires_bridge)
3726 ARCCastChecker(S.
Context, exprACTC, castACTC,
true).Visit(castExpr);
3727 assert(CreateRule != ACC_bottom &&
"This cast should already be accepted.");
3728 if (CreateRule != ACC_plusOne)
3732 : S.
Diag(noteLoc, diag::note_arc_cstyle_bridge);
3735 castType, castExpr, realCast,
"__bridge ",
3738 if (CreateRule != ACC_plusZero)
3742 S.
Diag(noteLoc, diag::note_arc_cstyle_bridge_transfer) << castExprType :
3744 diag::note_arc_bridge_transfer)
3745 << castExprType << br;
3748 castType, castExpr, realCast,
"__bridge_transfer ",
3749 br ?
"CFBridgingRelease" :
nullptr);
3758 S.
Diag(loc, diag::err_arc_cast_requires_bridge)
3767 ARCCastChecker(S.
Context, exprACTC, castACTC,
true).Visit(castExpr);
3768 assert(CreateRule != ACC_bottom &&
"This cast should already be accepted.");
3769 if (CreateRule != ACC_plusOne)
3773 : S.
Diag(noteLoc, diag::note_arc_cstyle_bridge);
3775 castType, castExpr, realCast,
"__bridge ",
3778 if (CreateRule != ACC_plusZero)
3782 S.
Diag(noteLoc, diag::note_arc_cstyle_bridge_retained) << castType :
3784 diag::note_arc_bridge_retained)
3788 castType, castExpr, realCast,
"__bridge_retained ",
3789 br ?
"CFBridgingRetain" :
nullptr);
3795 S.
Diag(loc, diag::err_arc_mismatched_cast)
3797 << srcKind << castExprType << castType
3801 template <
typename TB>
3803 bool &HadTheAttribute,
bool warn) {
3805 HadTheAttribute =
false;
3808 if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
3810 HadTheAttribute =
true;
3811 if (Parm->isStr(
"id"))
3820 if (Target && isa<ObjCInterfaceDecl>(Target)) {
3825 = InterfacePointerType->getObjectType()->getInterface();
3826 if ((CastClass == ExprClass) ||
3835 castType, ExprClass)))
3843 << T << Target->
getName() << castType;
3852 diag::err_objc_cf_bridged_not_interface)
3853 << castExpr->
getType() << Parm;
3867 template <
typename TB>
3869 bool &HadTheAttribute,
bool warn) {
3871 HadTheAttribute =
false;
3874 if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
3876 HadTheAttribute =
true;
3877 if (Parm->isStr(
"id"))
3886 if (Target && isa<ObjCInterfaceDecl>(Target)) {
3891 = InterfacePointerType->getObjectType()->getInterface();
3892 if ((CastClass == ExprClass) ||
3897 diag::warn_objc_invalid_bridge_to_cf)
3904 castExpr->
getType(), CastClass)))
3912 diag::warn_objc_invalid_bridge_to_cf)
3913 << castExpr->
getType() << castType;
3922 diag::err_objc_ns_bridged_invalid_cfobject)
3923 << castExpr->
getType() << castType;
3937 if (!getLangOpts().ObjC)
3943 bool HasObjCBridgeAttr;
3944 bool ObjCBridgeAttrWillNotWarn =
3945 CheckObjCBridgeNSCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
3947 if (ObjCBridgeAttrWillNotWarn && HasObjCBridgeAttr)
3949 bool HasObjCBridgeMutableAttr;
3950 bool ObjCBridgeMutableAttrWillNotWarn =
3951 CheckObjCBridgeNSCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
3952 HasObjCBridgeMutableAttr,
false);
3953 if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
3956 if (HasObjCBridgeAttr)
3957 CheckObjCBridgeNSCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
3959 else if (HasObjCBridgeMutableAttr)
3960 CheckObjCBridgeNSCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
3961 HasObjCBridgeMutableAttr,
true);
3964 bool HasObjCBridgeAttr;
3965 bool ObjCBridgeAttrWillNotWarn =
3966 CheckObjCBridgeCFCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
3968 if (ObjCBridgeAttrWillNotWarn && HasObjCBridgeAttr)
3970 bool HasObjCBridgeMutableAttr;
3971 bool ObjCBridgeMutableAttrWillNotWarn =
3972 CheckObjCBridgeCFCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
3973 HasObjCBridgeMutableAttr,
false);
3974 if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
3977 if (HasObjCBridgeAttr)
3978 CheckObjCBridgeCFCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
3980 else if (HasObjCBridgeMutableAttr)
3981 CheckObjCBridgeCFCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
3982 HasObjCBridgeMutableAttr,
true);
3989 if (PRE->isExplicitProperty()) {
3991 SrcType = PDecl->getType();
3993 else if (PRE->isImplicitProperty()) {
3995 SrcType = Getter->getReturnType();
4003 CheckObjCBridgeRelatedConversions(castExpr->
getBeginLoc(), castType, SrcType,
4009 if (!getLangOpts().ObjC)
4016 CheckTollFreeBridgeCast(castType, castExpr);
4018 : CK_CPointerToObjCPointerCast;
4030 bool CfToNs,
bool Diagnose) {
4031 QualType T = CfToNs ? SrcType : DestType;
4045 if (!LookupName(R, TUScope)) {
4047 Diag(Loc, diag::err_objc_bridged_related_invalid_class) << RCId
4048 << SrcType << DestType;
4054 if (Target && isa<ObjCInterfaceDecl>(Target))
4055 RelatedClass = cast<ObjCInterfaceDecl>(Target);
4058 Diag(Loc, diag::err_objc_bridged_related_invalid_class_name) << RCId
4059 << SrcType << DestType;
4068 if (CfToNs && CMId) {
4073 Diag(Loc, diag::err_objc_bridged_related_known_method)
4074 << SrcType << DestType << Sel <<
false;
4082 if (!CfToNs && IMId) {
4084 InstanceMethod = RelatedClass->
lookupMethod(Sel,
true);
4085 if (!InstanceMethod) {
4087 Diag(Loc, diag::err_objc_bridged_related_known_method)
4088 << SrcType << DestType << Sel <<
true;
4100 Expr *&SrcExpr,
bool Diagnose) {
4105 if (!CfToNs && !NsToCf)
4112 if (!checkObjCBridgeRelatedComponents(Loc, DestType, SrcType, RelatedClass,
4113 ClassMethod, InstanceMethod, TDNDecl,
4121 std::string ExpressionString =
"[";
4123 ExpressionString +=
" ";
4126 getLocForEndOfToken(SrcExpr->
getEndLoc());
4128 Diag(Loc, diag::err_objc_bridged_related_known_method)
4129 << SrcType << DestType << ClassMethod->
getSelector() <<
false 4138 Expr *args[] = { SrcExpr };
4139 ExprResult msg = BuildClassMessageImplicit(receiverType,
false,
4143 SrcExpr = msg.
get();
4150 if (InstanceMethod) {
4152 std::string ExpressionString;
4154 getLocForEndOfToken(SrcExpr->
getEndLoc());
4159 ExpressionString =
".";
4160 ExpressionString += PDecl->getNameAsString();
4161 Diag(Loc, diag::err_objc_bridged_related_known_method)
4162 << SrcType << DestType << InstanceMethod->
getSelector() <<
true 4165 if (ExpressionString.empty()) {
4167 ExpressionString =
" ";
4169 ExpressionString +=
"]";
4171 Diag(Loc, diag::err_objc_bridged_related_known_method)
4172 << SrcType << DestType << InstanceMethod->
getSelector() <<
true 4180 BuildInstanceMessageImplicit(SrcExpr, SrcType,
4183 InstanceMethod, None);
4184 SrcExpr = msg.get();
4195 bool Diagnose,
bool DiagnoseCFAudited,
4207 if (exprACTC == castACTC) {
4211 (CCK == CCK_CStyleCast || CCK == CCK_OtherCast) &&
4212 castType != castExprType) {
4218 if (
const ParenType *PT = dyn_cast<ParenType>(DT))
4219 QDT = PT->desugar();
4220 else if (
const TypeOfType *TP = dyn_cast<TypeOfType>(DT))
4221 QDT = TP->desugar();
4222 else if (
const AttributedType *AT = dyn_cast<AttributedType>(DT))
4223 QDT = AT->desugar();
4224 if (QDT != castType &&
4229 Diag(loc, diag::err_arc_nolifetime_behavior);
4239 if (!getLangOpts().ObjCAutoRefCount)
4258 switch (ARCCastChecker(Context, exprACTC, castACTC,
false).Visit(castExpr)) {
4273 Cleanup.setExprNeedsCleanups(
true);
4281 return ACR_unbridged;
4287 ConversionToObjCStringLiteralCheck(castType, castExpr, Diagnose))
4297 (Opc == BO_NE || Opc == BO_EQ))) {
4300 castExpr, exprACTC, CCK);
4319 castType =
cast->getTypeAsWritten();
4320 CCK = CCK_CStyleCast;
4322 castRange =
cast->getTypeInfoAsWritten()->getTypeLoc().getSourceRange();
4323 castType =
cast->getTypeAsWritten();
4324 CCK = CCK_OtherCast;
4326 llvm_unreachable(
"Unexpected ImplicitCastExpr");
4344 if (
ParenExpr *pe = dyn_cast<ParenExpr>(e)) {
4345 Expr *sub = stripARCUnbridgedCast(pe->getSubExpr());
4346 return new (Context)
ParenExpr(pe->getLParen(), pe->getRParen(), sub);
4347 }
else if (
UnaryOperator *uo = dyn_cast<UnaryOperator>(e)) {
4348 assert(uo->getOpcode() == UO_Extension);
4349 Expr *sub = stripARCUnbridgedCast(uo->getSubExpr());
4350 return new (Context)
4351 UnaryOperator(sub, UO_Extension, sub->getType(), sub->getValueKind(),
4352 sub->getObjectKind(), uo->getOperatorLoc(),
false);
4354 assert(!gse->isResultDependent());
4356 unsigned n = gse->getNumAssocs();
4359 subExprs.reserve(n);
4360 subTypes.reserve(n);
4362 subTypes.push_back(assoc.getTypeSourceInfo());
4363 Expr *sub = assoc.getAssociationExpr();
4364 if (assoc.isSelected())
4365 sub = stripARCUnbridgedCast(sub);
4366 subExprs.push_back(sub);
4370 Context, gse->getGenericLoc(), gse->getControllingExpr(), subTypes,
4371 subExprs, gse->getDefaultLoc(), gse->getRParenLoc(),
4372 gse->containsUnexpandedParameterPack(), gse->getResultIndex());
4374 assert(isa<ImplicitCastExpr>(e) &&
"bad form of unbridged cast!");
4375 return cast<ImplicitCastExpr>(e)->getSubExpr();
4385 if (isa<ObjCObjectPointerType>(canCastType) &&
4391 return !ObjI->isArcWeakrefUnavailable();
4398 Expr *curExpr = e, *prevExpr =
nullptr;
4403 if (
auto *pe = dyn_cast<ParenExpr>(curExpr)) {
4405 curExpr = pe->getSubExpr();
4409 if (
auto *ce = dyn_cast<CastExpr>(curExpr)) {
4410 if (
auto *ice = dyn_cast<ImplicitCastExpr>(ce))
4411 if (ice->getCastKind() == CK_ARCReclaimReturnedObject) {
4413 return ice->getSubExpr();
4414 if (
auto *pe = dyn_cast<ParenExpr>(prevExpr))
4415 pe->setSubExpr(ice->getSubExpr());
4417 cast<CastExpr>(prevExpr)->setSubExpr(ice->getSubExpr());
4422 curExpr = ce->getSubExpr();
4438 ExprResult SubResult = UsualUnaryConversions(SubExpr);
4440 SubExpr = SubResult.
get();
4447 bool MustConsume =
false;
4454 : CK_CPointerToObjCPointerCast);
4460 bool br = isKnownName(
"CFBridgingRelease");
4461 Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
4468 Diag(BridgeKeywordLoc, diag::note_arc_bridge)
4470 Diag(BridgeKeywordLoc, diag::note_arc_bridge_transfer)
4473 br ?
"CFBridgingRelease " 4474 :
"__bridge_transfer ");
4498 CK_ARCProduceObject,
4503 bool br = isKnownName(
"CFBridgingRetain");
4504 Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
4512 Diag(BridgeKeywordLoc, diag::note_arc_bridge)
4514 Diag(BridgeKeywordLoc, diag::note_arc_bridge_retained)
4517 br ?
"CFBridgingRetain " :
"__bridge_retained");
4524 Diag(LParenLoc, diag::err_arc_bridge_cast_incompatible)
4525 << FromType << T << Kind
4536 Cleanup.setExprNeedsCleanups(
true);
4552 QualType T = GetTypeFromParser(Type, &TSInfo);
4554 CheckTollFreeBridgeCast(T, SubExpr);
4557 return BuildObjCBridgedCast(LParenLoc, Kind, BridgeKeywordLoc, TSInfo,
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
ObjCMethodDecl * lookupPrivateClassMethod(const Selector &Sel)
bool hasDefinition() const
Determine whether this class has been defined.
QualType withConst() const
Retrieves a version of this type with const applied.
bool isClassMethod() const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
Represents a function declaration or definition.
Name lookup found a set of overloaded functions that met the criteria.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
static ObjCArrayLiteral * Create(const ASTContext &C, ArrayRef< Expr *> Elements, QualType T, ObjCMethodDecl *Method, SourceRange SR)
Smart pointer class that efficiently represents Objective-C method names.
QualType getObjCIdType() const
Represents the Objective-CC id type.
static void checkFoundationAPI(Sema &S, SourceLocation Loc, const ObjCMethodDecl *Method, ArrayRef< Expr *> Args, QualType ReceiverType, bool IsClassObjectCall)
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
A (possibly-)qualified type.
bool isBlockPointerType() const
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type...
Simple class containing the result of Sema::CorrectTypo.
unsigned param_size() const
Selector getSelector() const
ObjCInterfaceDecl * getClassInterface()
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
A cast other than a C-style cast.
void* might be a normal C type, or it might a CF type.
void AddFixItHint(const FixItHint &Hint) const
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
CompoundStmt * getSubStmt()
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier...
Stmt - This represents one statement.
NullabilityKind
Describes the nullability of a particular type.
static void diagnoseObjCARCConversion(Sema &S, SourceRange castRange, QualType castType, ARCConversionTypeClass castACTC, Expr *castExpr, Expr *realCast, ARCConversionTypeClass exprACTC, Sema::CheckedConversionKind CCK)
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g., __kindof Class <NSCopying>.
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
Bridging via __bridge, which does nothing but reinterpret the bits.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr, bool &HadTheAttribute, bool warn)
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
bool isRecordType() const
static InitializedEntity InitializeParameter(ASTContext &Context, const ParmVarDecl *Parm)
Create the initialization entity for a parameter.
const ObjCObjectType * getAsObjCInterfaceType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
SourceLocation getBeginLoc() const LLVM_READONLY
static bool HelperToDiagnoseMismatchedMethodsInGlobalPool(Sema &S, SourceLocation AtLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, ObjCMethodDecl *Method, ObjCMethodList &MethList)
SmallVectorImpl< Edit >::const_iterator edit_iterator
bool isExtVectorType() const
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
ParenExpr - This represents a parethesized expression, e.g.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
const char * getCharacterData(SourceLocation SL, bool *Invalid=nullptr) const
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer...
The base class of the type hierarchy.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
static void RemoveSelectorFromWarningCache(Sema &S, Expr *Arg)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
static FixItHint CreateInsertionFromRange(SourceLocation InsertionLoc, CharSourceRange FromRange, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code from FromRange at a specific location...
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
QualType withConst() const
A container of type source information.
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
ObjCMethodDecl * getMethod() const
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver, the method expected to receive the message, and the form of the message send.
void setDelegateInitCall(bool isDelegate)
QualType getElementType() const
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
Retains information about a function, method, or block that is currently being parsed.
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
Represents a variable declaration or definition.
QualType getReturnType() const
DiagnosticsEngine & Diags
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
const T * getAs() const
Member-template getAs<specific type>'.
bool isInObjcMethodScope() const
isInObjcMethodScope - Return true if this scope is, or is contained in, an Objective-C method body...
ObjCMethodDecl - Represents an instance or class method declaration.
DeclClass * getCorrectionDeclAs() const
bool isInvalidDecl() const
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
static const ObjCMethodDecl * findExplicitInstancetypeDeclarer(const ObjCMethodDecl *MD, QualType instancetype)
Look for an ObjC method whose result type exactly matches the given type.
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
static StringRef bytes(const std::vector< T, Allocator > &v)
Represents a parameter to a function.
ObjCPropertyDecl * getExplicitProperty() const
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i.e., if it is any kind of pointer type.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Represents a struct/union/class.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Selector getUnarySelector(IdentifierInfo *ID)
One of these records is kept for each identifier that is lexed.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
bool isObjCIdOrObjectKindOfType(const ASTContext &ctx, const ObjCObjectType *&bound) const
Whether the type is Objective-C 'id' or a __kindof type of an object type, e.g., __kindof NSView * or...
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
Expr * getFalseExpr() const
An element in an Objective-C dictionary literal.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Represents a class type in Objective C.
edit_iterator edit_end() const
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
ObjCMethodFamily
A family of Objective-C methods.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
bool isExplicitProperty() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isObjCIdType() const
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly...
static ObjCMessageExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, SourceLocation LBracLoc, SourceLocation SuperLoc, bool IsInstanceSuper, QualType SuperType, Selector Sel, ArrayRef< SourceLocation > SelLocs, ObjCMethodDecl *Method, ArrayRef< Expr *> Args, SourceLocation RBracLoc, bool isImplicit)
Create a message send to super.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
LookupResultKind getResultKind() const
static ObjCBridgeRelatedAttr * ObjCBridgeRelatedAttrFromType(QualType T, TypedefNameDecl *&TDNDecl)
bool isObjCQualifiedClassType() const
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Values of this type can be null.
bool isUnarySelector() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
static Selector constructSetterSelector(IdentifierTable &Idents, SelectorTable &SelTable, const IdentifierInfo *Name)
Return the default setter selector for the given identifier.
bool followsCreateRule(const FunctionDecl *FD)
Selector getNullarySelector(IdentifierInfo *ID)
Represents the results of name lookup.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
ObjCContainerDecl - Represents a container for method declarations.
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
static void applyCocoaAPICheck(Sema &S, const ObjCMessageExpr *Msg, unsigned DiagID, bool(*refactor)(const ObjCMessageExpr *, const NSAPI &, edit::Commit &))
Whether values of this type can be null is (explicitly) unspecified.
QualType getObjCNSStringType() const
SourceLocation getBeginLoc() const LLVM_READONLY
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Represents a declaration of a type.
A builtin binary operation expression such as "x + y" or "x <= y".
CanQualType PseudoObjectTy
tokloc_iterator tokloc_end() const
A conversion for an operand of a builtin overloaded operator.
CheckedConversionKind
The kind of conversion being performed.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
ObjCStringLiteral, used for Objective-C string literals i.e.
Values of this type can never be null.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
Scope - A scope is a transient data structure that is used while parsing the program.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
void getOverriddenMethods(SmallVectorImpl< const ObjCMethodDecl *> &Overridden) const
Return overridden methods for the given Method.
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Lookup a class method for a given selector.
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents an Objective-C protocol declaration.
AssociationTy< false > Association
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
const LangOptions & getLangOpts() const
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
Represents an ObjC class declaration.
Bridging via __bridge_transfer, which transfers ownership of an Objective-C pointer into ARC...
QualType getReturnType() const
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
QualType getObjCProtoType() const
Retrieve the type of the Objective-C Protocol class.
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl *> Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations.
const LangOptions & LangOpts
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point...
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
bool isKnownName(StringRef name)
ObjCMethodDecl * getCategoryClassMethod(Selector Sel) const
static bool isAnyRetainable(ARCConversionTypeClass ACTC)
ConditionalOperator - The ?: ternary operator.
Sema - This implements semantic analysis and AST building for C.
RecordDecl * getMostRecentDecl()
StringRef getString() const
CharSourceRange getFileRange(SourceManager &SM) const
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
A little helper class used to produce diagnostics.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
CastKind
CastKind - The kind of operation required for a conversion.
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 ObjCInterfaceDecl * LookupObjCInterfaceDeclForLiteral(Sema &S, SourceLocation Loc, Sema::ObjCLiteralKind LiteralKind)
Looks up ObjCInterfaceDecl of a given NSClassIdKindKind.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
bool hasDefinition() const
Determine whether this protocol has a definition.
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
ObjCStringFormatFamily getStringFormatFamily() const
This represents one expression.
ObjCMethodList * getNext() const
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool isImplicitlyDeclared=false, bool isDefined=false, ImplementationControl impControl=None, bool HasRelatedResultType=false)
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast...
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
const T * castAs() const
Member-template castAs<specific type>.
static bool isAnyCLike(ARCConversionTypeClass ACTC)
bool isObjCRetainableType() const
static ARCConversionTypeClass classifyTypeForARCConversion(QualType type)
static QualType stripObjCInstanceType(ASTContext &Context, QualType T)
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
Defines the clang::Preprocessor interface.
bool isObjCClassType() const
DeclContext * getDeclContext()
edit_iterator edit_begin() const
ObjCInterfaceDecl * getSuperClass() const
ObjCSelectorExpr used for @selector in Objective-C.
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
static ObjCDictionaryLiteral * Create(const ASTContext &C, ArrayRef< ObjCDictionaryElement > VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, SourceRange SR)
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Defines the clang::TypeLoc interface and its subclasses.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl * getImplicitPropertyGetter() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
bool isInstanceMethod() const
ArraySizeModifier getSizeModifier() const
bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
unsigned getNumArgs() const
Selector getSelector() const
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr.cast]), which uses the syntax (Type)expr.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
ImplicitParamDecl * getSelfDecl() const
SourceLocation getEndLoc() const LLVM_READONLY
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType)
bool isConstQualified() const
Determine whether this type is const-qualified.
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
QualType getWideCharType() const
Return the type of wide characters.
There is no lifetime qualification on this type.
static bool isMethodDeclaredInRootProtocol(Sema &S, const ObjCMethodDecl *M)
std::string getAsString() const
Derive the full selector name (e.g.
SelectorTable & Selectors
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Sugar for parentheses used when specifying types.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
Expr * getSubExpr() const
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
CastKind getCastKind() const
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
ObjCMethodFamily getMethodFamily() const
MutableArrayRef< Expr * > MultiExprArg
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
bool ObjCWarnForNoDesignatedInitChain
This starts true for a method marked as designated initializer and will be set to false if there is a...
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ExprResult DefaultLvalueConversion(Expr *E)
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
bool isLiteral(TokenKind K)
Return true if this is a "literal" kind, like a numeric constant, string, etc.
Name lookup found an unresolvable value declaration and cannot yet complete.
static bool isCast(CheckedConversionKind CCK)
Specifies that a value-dependent expression should be considered to never be a null pointer constant...
ObjCProtocolExpr used for protocol expression in Objective-C.
Describes the kind of initialization being performed, along with location information for tokens rela...
SourceLocation getBeginLoc() const LLVM_READONLY
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
bool isObjCObjectPointerType() const
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.
bool FormatStringHasSArg(const StringLiteral *FExpr)
Represents one property declaration in an Objective-C interface.
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
No entity found met the criteria.
bool ObjCIsDesignatedInit
True when this is a method marked as a designated initializer.
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 messa...
const ObjCMethodDecl * getMethodDecl() const
bool isVectorType() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
ObjCBoxedExpr - used for generalized expression boxing.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
static Expr * maybeUndoReclaimObject(Expr *e)
Look for an ObjCReclaimReturnedObject cast and destroy it.
bool isDesignatedInitializerForTheInterface(const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the method selector resolves to a designated initializer in the class's interface...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;...
Represents a C11 generic selection.
StringRef getName() const
Return the actual identifier string.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Base class for declarations which introduce a typedef-name.
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
CanQualType ObjCBuiltinIdTy
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
tokloc_iterator tokloc_begin() const
ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const
Lookup a method in the classes implementation hierarchy.
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and return...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
bool isCommitable() const
static void addFixitForObjCARCConversion(Sema &S, DiagnosticBuilder &DiagB, Sema::CheckedConversionKind CCK, SourceLocation afterLParen, QualType castType, Expr *castExpr, Expr *realCast, const char *bridgeKeyword, const char *CFBridgeName)
CharSourceRange getInsertFromRange(SourceManager &SM) const
bool ObjCIsSecondaryInit
True when this is an initializer method not marked as a designated initializer within a class that ha...
QualType getUnderlyingType() const
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static GenericSelectionExpr * Create(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo *> AssocTypes, ArrayRef< Expr *> AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
Create a non-result-dependent generic selection expression.
The name of a declaration.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
U cast(CodeGen::Address addr)
bool ObjCWarnForNoInitDelegation
This starts true for a secondary initializer method and will be set to false if there is an invocatio...
ExplicitCastExpr - An explicit cast written in the source code.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Bridging via __bridge_retain, which makes an ARC object available as a +1 C pointer.
ACCResult
A result from the cast checker.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
Represents a pointer to an Objective C object.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Name lookup found a single declaration that met the criteria.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
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 m...
unsigned getIndexTypeCVRQualifiers() const
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length...
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
CanQualType UnsignedLongTy
ObjCEncodeExpr, used for @encode in Objective-C.
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression...
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface...
Expr * IgnoreParenLValueCasts() LLVM_READONLY
Skip past any parentheses and lvalue casts which might surround this expression until reaching a fixe...
Base for LValueReferenceType and RValueReferenceType.
Simple template class for restricting typo correction candidates to ones having a single Decl* of the...
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
Optional< ArrayRef< QualType > > getObjCSubstitutions(const DeclContext *dc) const
Retrieve the set of substitutions required when accessing a member of the Objective-C receiver type t...
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
lookupMethod - This method returns an instance/class method by looking in the class, its categories, and its super classes (using a linear search).
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
QualType getObjCConstantStringInterface() const
SourceManager & getSourceManager()
static bool isIdentifierBodyChar(char c, const LangOptions &LangOpts)
Returns true if the given character could appear in an identifier.
ImplementationControl getImplementationControl() const
static NSAPI::NSClassIdKindKind ClassKindFromLiteralKind(Sema::ObjCLiteralKind LiteralKind)
Maps ObjCLiteralKind to NSClassIdKindKind.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
TypedefNameDecl * getDecl() const
Reading or writing from this object requires a barrier call.
No particular method family.
void setObjCNSStringType(QualType T)
An attributed type is a type to which a type attribute has been applied.
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
TranslationUnitDecl * getTranslationUnitDecl() const
Describes the sequence of initializations required to initialize a given object or reference with a s...
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Expr * getTrueExpr() const
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false...
The parameter type of a method or function.
ObjCIvarDecl - Represents an ObjC instance variable.
static bool CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr, bool &HadTheAttribute, bool warn)
QualType getSendResultType() const
Determine the type of an expression that sends a message to this function.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
static T * getObjCBridgeAttr(const TypedefType *TD)
SourceManager & getSourceManager() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
StringLiteral - This represents a string literal expression, e.g.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
SourceLocation getBeginLoc() const LLVM_READONLY
a linked list of methods with the same selector name but different signatures.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type...
Abstract class common to all of the C++ "named"/"keyword" casts.
The top declaration context.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
static bool ValidateObjCLiteralInterfaceDecl(Sema &S, ObjCInterfaceDecl *Decl, SourceLocation Loc, Sema::ObjCLiteralKind LiteralKind)
Validates ObjCInterfaceDecl availability.
A reference to a declared variable, function, enum, etc.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
bool isPointerType() const
SourceManager & SourceMgr
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
An l-value expression is a reference to an object with independent storage.
A trivial tuple used to represent a source range.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
ObjCMethodDecl * getGetterMethodDecl() const
static void DiagnoseMismatchedSelectors(Sema &S, SourceLocation AtLoc, ObjCMethodDecl *Method, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
This represents a decl that may have a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime...
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 giv...
bool isPropertyAccessor() const
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parenthese and casts which do not change the value (including ptr->int casts of the sam...
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
Describes an entity that is being initialized.
void setType(QualType newType)
SourceLocation getBegin() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
This class handles loading and caching of source files into memory.
Represents the canonical version of C arrays with a specified constant size.
static void checkCocoaAPI(Sema &S, const ObjCMessageExpr *Msg)
SourceLocation getLocation() const
QualType getType() const
Return the type wrapped by this type source info.
ArrayRef< ParmVarDecl * > parameters() const
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr *> Strings)
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.