28#include "llvm/ADT/SmallString.h"
29#include "llvm/Support/ConvertUTF.h"
45 if (Strings.size() != 1) {
50 for (
Expr *E : Strings) {
51 S = cast<StringLiteral>(E);
54 if (!S->isOrdinary()) {
55 Diag(S->getBeginLoc(), diag::err_cfstring_literal_not_string_constant)
56 << S->getSourceRange();
61 StrBuf += S->getString();
64 StrLocs.append(S->tokloc_begin(), S->tokloc_end());
70 assert(CAT &&
"String literal not of constant array type!");
72 CAT->
getElementType(), llvm::APInt(32, StrBuf.size() + 1),
nullptr,
75 false, StrTy, &StrLocs[0],
84 if (CheckObjCString(S))
96 std::string StringClass(
getLangOpts().ObjCConstantStringClass);
98 if (StringClass.empty())
112 Diag(S->getBeginLoc(), diag::err_no_nsconstant_string_class)
113 << NSIdent << S->getSourceRange();
153 S.
Diag(Loc, diag::err_undeclared_boxing_method) << Sel <<
Class->getName();
160 S.
Diag(Loc, diag::err_objc_literal_method_sig)
173 switch (LiteralKind) {
191 llvm_unreachable(
"LiteralKind can't be converted into a ClassKind");
203 S.
Diag(Loc, diag::err_undeclared_objc_literal_class)
204 << II->
getName() << LiteralKind;
206 }
else if (!
Decl->hasDefinition() && !S.
getLangOpts().DebuggerObjCLiteral) {
207 S.
Diag(Loc, diag::err_undeclared_objc_literal_class)
208 <<
Decl->getName() << LiteralKind;
245 bool isLiteral =
false,
247 std::optional<NSAPI::NSNumberLiteralMethodKind> Kind =
248 S.
NSAPIObj->getNSNumberFactoryMethodKind(NumberType);
252 S.
Diag(Loc, diag::err_invalid_nsnumber_type)
285 if (!Method && S.
getLangOpts().DebuggerObjCLiteral) {
323 switch (Char->getKind()) {
360 Number = ConvertedNumber.
get();
379 CK_IntegralToBoolean);
389 bool ArrayLiteral =
false) {
391 if (Element->isTypeDependent())
401 if (S.
getLangOpts().CPlusPlus && Element->getType()->isRecordType()) {
409 return Seq.Perform(S, Entity, Kind, Element);
412 Expr *OrigElement = Element;
421 if (!Element->getType()->isObjCObjectPointerType() &&
422 !Element->getType()->isBlockPointerType()) {
423 bool Recovered =
false;
426 if (isa<IntegerLiteral>(OrigElement) ||
427 isa<CharacterLiteral>(OrigElement) ||
428 isa<FloatingLiteral>(OrigElement) ||
429 isa<ObjCBoolLiteralExpr>(OrigElement) ||
430 isa<CXXBoolLiteralExpr>(OrigElement)) {
431 if (S.
NSAPIObj->getNSNumberFactoryMethodKind(OrigElement->
getType())) {
432 int Which = isa<CharacterLiteral>(OrigElement) ? 1
433 : (isa<CXXBoolLiteralExpr>(OrigElement) ||
434 isa<ObjCBoolLiteralExpr>(OrigElement)) ? 2
451 else if (
StringLiteral *String = dyn_cast<StringLiteral>(OrigElement)) {
452 if (String->isOrdinary()) {
467 S.
Diag(Element->getBeginLoc(), diag::err_invalid_collection_element)
468 << Element->getType();
474 dyn_cast<ObjCStringLiteral>(OrigElement)) {
476 unsigned numConcat = SL->getNumConcatenated();
479 bool hasMacro =
false;
480 for (
unsigned i = 0; i < numConcat ; ++i)
481 if (SL->getStrTokenLoc(i).isMacroID()) {
486 S.
Diag(Element->getBeginLoc(),
487 diag::warn_concatenated_nsarray_literal)
488 << Element->getType();
498 Element->getBeginLoc(), Element);
515 ValueExpr = RValue.
get();
533 if (
auto *CE = dyn_cast<ImplicitCastExpr>(ValueExpr))
534 if (CE->getCastKind() == CK_ArrayToPointerDecay)
536 dyn_cast<StringLiteral>(CE->getSubExpr()->IgnoreParens())) {
537 assert((SL->isOrdinary() || SL->isUTF8()) &&
538 "unexpected character encoding");
539 StringRef Str = SL->getString();
540 const llvm::UTF8 *StrBegin = Str.bytes_begin();
541 const llvm::UTF8 *StrEnd = Str.bytes_end();
543 if (llvm::isLegalUTF8String(&StrBegin, StrEnd)) {
551 Diag(SL->getBeginLoc(), diag::warn_objc_boxing_invalid_utf8_string)
561 if (!BoxingMethod &&
getLangOpts().DebuggerObjCLiteral) {
586 stringWithUTF8String, BoxingMethod))
595 std::optional<NullabilityKind> Nullability =
610 dyn_cast<CharacterLiteral>(ValueExpr->
IgnoreParens())) {
613 switch (Char->getKind()) {
638 if (!ET->getDecl()->isComplete()) {
639 Diag(Loc, diag::err_objc_incomplete_boxed_expression_type)
645 ET->getDecl()->getIntegerType());
674 if (!BoxingMethod &&
getLangOpts().DebuggerObjCLiteral) {
697 Params.push_back(
bytes);
707 Params.push_back(
type);
714 ValueWithBytesObjCType, BoxingMethod))
721 Diag(Loc, diag::err_objc_non_trivially_copyable_boxed_expression_type)
731 Diag(Loc, diag::err_objc_illegal_boxed_expression_type)
754 ValueExpr = ConvertedValueExpr.
get();
773 "base or index cannot have dependent type here");
791 getterMethod, setterMethod, RB);
811 if (!Method &&
getLangOpts().DebuggerObjCLiteral) {
828 Params.push_back(objects);
836 Params.push_back(cnt);
851 diag::note_objc_literal_method_param)
858 if (!Method->
parameters()[1]->getType()->isIntegerType()) {
862 diag::note_objc_literal_method_param)
878 Expr **ElementsBuffer = Elements.data();
879 for (
unsigned I = 0, N = Elements.size(); I != N; ++I) {
886 ElementsBuffer[I] = Converted.
get();
903 if (Literal->isValueDependent() || Literal->isTypeDependent())
909 struct APSIntCompare {
910 bool operator()(
const llvm::APSInt &LHS,
const llvm::APSInt &RHS)
const {
911 return llvm::APSInt::compareValues(LHS, RHS) < 0;
915 llvm::DenseMap<StringRef, SourceLocation> StringKeys;
916 std::map<llvm::APSInt, SourceLocation, APSIntCompare> IntegralKeys;
918 auto checkOneKey = [&](
auto &Map,
const auto &Key,
SourceLocation Loc) {
919 auto Pair = Map.insert({Key, Loc});
921 S.
Diag(Loc, diag::warn_nsdictionary_duplicate_key);
922 S.
Diag(Pair.first->second, diag::note_nsdictionary_duplicate_key_here);
926 for (
unsigned Idx = 0, End = Literal->getNumElements(); Idx != End; ++Idx) {
927 Expr *Key = Literal->getKeyValueElement(Idx).Key->IgnoreParenImpCasts();
929 if (
auto *StrLit = dyn_cast<ObjCStringLiteral>(Key)) {
930 StringRef Bytes = StrLit->getString()->getBytes();
932 checkOneKey(StringKeys, Bytes, Loc);
935 if (
auto *BE = dyn_cast<ObjCBoxedExpr>(Key)) {
936 Expr *Boxed = BE->getSubExpr();
941 checkOneKey(StringKeys, Str->getBytes(), Loc);
948 checkOneKey(IntegralKeys,
Result.Val.getInt(), Loc);
973 if (!Method &&
getLangOpts().DebuggerObjCLiteral) {
990 Params.push_back(objects);
998 Params.push_back(keys);
1006 Params.push_back(cnt);
1022 diag::note_objc_literal_method_param)
1056 diag::note_objc_literal_method_param)
1064 QualType CountType = Method->parameters()[2]->getType();
1068 Diag(Method->parameters()[2]->getLocation(),
1069 diag::note_objc_literal_method_param)
1079 QualType ValuesT = DictionaryWithObjectsMethod->parameters()[0]->getType();
1081 QualType KeysT = DictionaryWithObjectsMethod->parameters()[1]->getType();
1086 bool HasPackExpansions =
false;
1097 if (
Value.isInvalid())
1100 Element.Key = Key.
get();
1101 Element.Value =
Value.get();
1103 if (Element.EllipsisLoc.isInvalid())
1106 if (!Element.Key->containsUnexpandedParameterPack() &&
1107 !Element.Value->containsUnexpandedParameterPack()) {
1108 Diag(Element.EllipsisLoc,
1109 diag::err_pack_expansion_without_parameter_packs)
1111 Element.Value->getEndLoc());
1115 HasPackExpansions =
true;
1123 DictionaryWithObjectsMethod, SR);
1125 return MaybeBindToTemporary(Literal);
1139 diag::err_incomplete_type_objc_at_encode,
1146 if (!NotEncodedT.
isNull())
1147 Diag(AtLoc, diag::warn_incomplete_encoded_type)
1148 << EncodedType << NotEncodedT;
1180 bool Warned =
false;
1183 if (MatchingMethodDecl == Method ||
1191 S.
Diag(AtLoc, diag::warn_multiple_selectors)
1197 S.
Diag(MatchingMethodDecl->
getLocation(), diag::note_method_declared_at)
1208 bool WarnMultipleSelectors) {
1209 if (!WarnMultipleSelectors ||
1212 bool Warned =
false;
1218 Method, InstMethList))
1224 Method, ClsMethList) || Warned)
1240 assert(Method->
getSelector() == Sel &&
"Method with wrong selector in method list");
1243 DirectMethod = Method;
1248 return DirectMethod;
1263 S, Sel,
Iter->second.first, onlyDirect, anyDirect);
1265 S, Sel,
Iter->second.second, onlyDirect, anyDirect);
1267 return DirectInstance ? DirectInstance : DirectClass;
1296 bool WarnMultipleSelectors) {
1304 Selector MatchedSel = OM->getSelector();
1307 Diag(SelLoc, diag::warn_undeclared_selector_with_typo)
1308 << Sel << MatchedSel
1312 Diag(SelLoc, diag::warn_undeclared_selector) << Sel;
1315 WarnMultipleSelectors);
1317 bool onlyDirect =
true;
1318 bool anyDirect =
false;
1323 Diag(AtLoc, diag::err_direct_selector_expression)
1327 }
else if (anyDirect) {
1332 if (LikelyTargetMethod && LikelyTargetMethod->
isDirectMethod()) {
1333 Diag(AtLoc, diag::warn_potentially_direct_selector_expression) << Sel;
1335 diag::note_direct_method_declared_at)
1337 }
else if (!LikelyTargetMethod) {
1340 Diag(AtLoc, diag::warn_strict_potentially_direct_selector_expression)
1343 diag::note_direct_method_declared_at)
1364 Diag(AtLoc, diag::err_arc_illegal_selector) <<
1393 Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId;
1397 Diag(ProtoLoc, diag::err_objc_non_runtime_protocol_in_protocol_expr)
1400 Diag(ProtoLoc, diag::err_atprotocol_protocol) << PDecl;
1456 bool isClassMessage,
1457 bool isSuperMessage) {
1458 assert(Method &&
"Must have a method");
1468 if (
auto nullability =
1493 if (isSuperMessage) {
1496 return transferNullability(
1515 return transferNullability(ReceiverType);
1521 bool isClassMessage,
1522 bool isSuperMessage) {
1530 if (isClassMessage) {
1542 cast<ImplicitParamDecl>(
1544 ->getDeclContext());
1551 NewResultType, NewResultType);
1552 return NewResultType;
1564 unsigned receiverNullabilityIdx = 0;
1565 if (std::optional<NullabilityKind> nullability =
1569 receiverNullabilityIdx = 1 +
static_cast<unsigned>(*nullability);
1572 unsigned resultNullabilityIdx = 0;
1573 if (std::optional<NullabilityKind> nullability =
1577 resultNullabilityIdx = 1 +
static_cast<unsigned>(*nullability);
1582 static const uint8_t
None = 0;
1583 static const uint8_t
NonNull = 1;
1586 static const uint8_t nullabilityMap[4][4] = {
1594 unsigned newResultNullabilityIdx
1595 = nullabilityMap[receiverNullabilityIdx][resultNullabilityIdx];
1596 if (newResultNullabilityIdx == resultNullabilityIdx)
1602 if (
auto attributed = dyn_cast<AttributedType>(resultType.
getTypePtr())) {
1603 resultType = attributed->getModifiedType();
1610 if (newResultNullabilityIdx > 0) {
1615 resultType, resultType);
1634 dyn_cast<ObjCCategoryImplDecl>(impl)) {
1635 iface = catImpl->getCategoryDecl();
1637 iface = impl->getClassInterface();
1647 for (
unsigned i = 0, e = overrides.size(); i != e; ++i) {
1668 SourceRange range = overridden->getReturnTypeSourceRange();
1671 loc = overridden->getLocation();
1672 Diag(loc, diag::note_related_result_type_explicit)
1718 if (!SelectorLocs.empty() && SelectorLocs.front().isValid())
1719 SelLoc = SelectorLocs.front();
1725 for (
unsigned i = 0, e = Args.size(); i != e; i++) {
1726 if (Args[i]->isTypeDependent())
1738 Args[i] = result.
get();
1743 DiagID = diag::err_arc_method_not_found;
1745 DiagID = isClassMessage ? diag::warn_class_method_not_found
1746 : diag::warn_inst_method_not_found;
1751 DiagID = diag::err_method_not_found_with_typo;
1753 DiagID = isClassMessage ? diag::warn_class_method_not_found_with_typo
1754 : diag::warn_instance_method_not_found_with_typo;
1756 SourceRange SelectorRange(SelectorLocs.front(), SelectorLocs.back());
1758 Diag(SelLoc, DiagID)
1759 << Sel<< isClassMessage << MatchedSel
1762 Diag(SelLoc, DiagID) << Sel<< isClassMessage << MatchedSel;
1765 Diag(SelLoc, DiagID)
1766 << Sel << isClassMessage <<
SourceRange(SelectorLocs.front(),
1767 SelectorLocs.back());
1771 Diag(ThisClass->getLocation(), diag::note_receiver_class_declared);
1773 if (ThisClass->lookupClassMethod(Sel))
1774 Diag(RecRange.
getBegin(), diag::note_receiver_expr_here)
1776 ThisClass->getNameAsString());
1793 isClassMessage, isSuperMessage);
1802 if (Args.size() < NumNamedArgs) {
1803 Diag(SelLoc, diag::err_typecheck_call_too_few_args)
1804 << 2 << NumNamedArgs << static_cast<unsigned>(Args.size())
1811 std::optional<ArrayRef<QualType>> typeArgs =
1813 bool IsError =
false;
1814 for (
unsigned i = 0; i < NumNamedArgs; i++) {
1816 if (Args[i]->isTypeDependent())
1819 Expr *argExpr = Args[i];
1822 assert(argExpr &&
"CheckMessageArgumentTypes(): missing expression");
1824 if (param->
hasAttr<NoEscapeAttr>() &&
1826 if (
auto *BE = dyn_cast<BlockExpr>(
1828 BE->getBlockDecl()->setDoesNotEscape();
1833 !param->
hasAttr<CFConsumedAttr>())
1844 Args[i] = argE.
get();
1862 diag::err_call_incomplete_argument, argExpr))
1877 Args[i]->getType()->isBlockPointerType() &&
1881 Args[i] = arg.get();
1888 for (
unsigned i = NumNamedArgs, e = Args.size(); i < e; ++i) {
1889 if (Args[i]->isTypeDependent())
1895 Args[i] = Arg.
get();
1899 if (Args.size() != NumNamedArgs) {
1900 Diag(Args[NumNamedArgs]->getBeginLoc(),
1901 diag::err_typecheck_call_too_many_args)
1902 << 2 << NumNamedArgs << static_cast<unsigned>(Args.size())
1905 Args.back()->getEndLoc());
1913 CheckObjCMethodCall(Method, SelLoc,
ArrayRef(Args.data(), Args.size()));
1926 if (!method)
return false;
1929 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(receiver))
1941 if (
ObjCMethodDecl *method = iface->lookupMethod(sel, isInstance))
1946 if (
ObjCMethodDecl *method = iface->lookupPrivateMethod(sel, isInstance))
1951 for (
const auto *I : objType->
quals())
1965 for (
const auto *PROTO : OPT->
quals()) {
1966 if ((MD = PROTO->lookupMethod(Sel, Instance))) {
1986 Diag(MemberLoc, diag::err_invalid_property_name)
1996 diag::err_property_not_found_forward_class,
1997 MemberName, BaseRange))
2015 for (
const auto *I : OPT->
quals())
2025 SuperLoc, SuperType);
2082 if (!(PDecl->getPropertyAttributes() &
2085 diag::warn_property_access_suggest)
2086 << MemberName <<
QualType(OPT, 0) << PDecl->getName()
2091 if (Getter || Setter) {
2113 Corrected.isKeyword() ? nullptr : Corrected.getFoundDecl();
2114 if (ChosenDecl && isa<ObjCPropertyDecl>(ChosenDecl))
2115 if (cast<ObjCPropertyDecl>(ChosenDecl)->isClassProperty()) {
2118 Diag(MemberLoc, diag::err_class_property_found) << MemberName
2126 << MemberName <<
QualType(OPT, 0));
2128 TypoResult, MemberLoc,
2129 SuperLoc, SuperType, Super);
2139 diag::err_property_not_as_forward_class,
2140 MemberName, BaseExpr))
2144 diag::err_ivar_access_using_property_syntax_suggest)
2145 << MemberName <<
QualType(OPT, 0) << Ivar->getDeclName()
2150 Diag(MemberLoc, diag::err_property_not_found)
2172 if (receiverNamePtr->
isStr(
"super")) {
2174 if (
auto classDecl = CurMethod->getClassInterface()) {
2175 SuperType =
QualType(classDecl->getSuperClassType(), 0);
2176 if (CurMethod->isInstanceMethod()) {
2177 if (SuperType.
isNull()) {
2179 Diag(receiverNameLoc, diag::err_root_class_cannot_use_super)
2180 << CurMethod->getClassInterface()->getIdentifier();
2190 receiverNameLoc, T,
true);
2201 Diag(receiverNameLoc, diag::err_expected_either) << tok::identifier
2211 GetterSel = PD->getGetterName();
2212 SetterSel = PD->getSetterName();
2247 if (Getter || Setter) {
2256 propertyNameLoc, receiverNameLoc, IFace);
2258 return ExprError(
Diag(propertyNameLoc, diag::err_property_not_found)
2272 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
2277 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
2278 return std::make_unique<ObjCInterfaceOrSuperCCC>(*
this);
2288 bool HasTrailingDot,
2290 ReceiverType =
nullptr;
2295 if (IsSuper && S->isInObjcMethodScope())
2301 switch (
Result.getResultKind()) {
2326 Result.suppressDiagnostics();
2357 Result.getLookupNameInfo(),
Result.getLookupKind(), S,
nullptr, CCC,
2359 if (Corrected.isKeyword()) {
2363 PDiag(diag::err_unknown_receiver_suggest) << Name);
2370 PDiag(diag::err_unknown_receiver_suggest) << Name);
2392 Diag(SuperLoc, diag::err_invalid_receiver_to_message_super);
2398 Diag(SuperLoc, diag::err_no_super_class_message)
2406 Diag(SuperLoc, diag::err_root_class_cannot_use_super)
2407 <<
Class->getIdentifier();
2422 LBracLoc, SelectorLocs, RBracLoc, Args);
2429 SuperLoc, Sel,
nullptr,
2430 LBracLoc, SelectorLocs, RBracLoc, Args);
2434 bool isSuperReceiver,
2440 if (!ReceiverType.
isNull())
2443 assert(((isSuperReceiver && Loc.
isValid()) || receiverTypeInfo) &&
2444 "Either the super receiver location needs to be valid or the receiver "
2445 "needs valid type source information");
2448 Sel, Method, Loc, Loc, Loc, Args,
2462 if (refactor(Msg,*S.
NSAPIObj, ECommit)) {
2463 auto Builder = S.
Diag(MsgLoc, DiagID)
2471 switch (Edit.
Kind) {
2478 Builder.AddFixItHint(
2499 bool IsClassObjectCall) {
2505 const auto *SE = dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens());
2509 if (!IsClassObjectCall) {
2511 if (!OPT || !OPT->getInterfaceDecl())
2514 OPT->getInterfaceDecl()->lookupInstanceMethod(SE->getSelector());
2517 OPT->getInterfaceDecl()->lookupPrivateMethod(SE->getSelector());
2522 ImpliedMethod = IT->getDecl()->lookupClassMethod(SE->getSelector());
2525 IT->getDecl()->lookupPrivateClassMethod(SE->getSelector());
2530 if (Ret->isRecordType() || Ret->isVectorType() || Ret->isExtVectorType()) {
2531 S.
Diag(Loc, diag::warn_objc_unsafe_perform_selector)
2533 << (!Ret->isRecordType()
2535 : Ret->isUnionType() ? 1 : 0);
2537 diag::note_objc_unsafe_perform_selector_method_declared_here)
2548 Expr **Args,
unsigned NumArgs) {
2550 bool Format =
false;
2564 if (!Format || NumArgs <= Idx)
2567 Expr *FormatExpr = Args[Idx];
2572 S.
Diag(FormatExpr->
getExprLoc(), diag::warn_objc_cdirective_format_string)
2622 Diag(Loc, diag::err_missing_open_square_message_send)
2627 if (!SelectorLocs.empty() && SelectorLocs.front().isValid())
2628 SelectorSlotLocs = SelectorLocs;
2630 SelectorSlotLocs = Loc;
2636 unsigned NumArgs = ArgsIn.size();
2637 Expr **Args = ArgsIn.data();
2638 assert(SuperLoc.
isInvalid() &&
"Message to super with dependent type");
2640 ReceiverTypeInfo, Sel, SelectorLocs,
2642 RBracLoc, isImplicit);
2649 Diag(Loc, diag::err_invalid_receiver_class_message)
2653 assert(
Class &&
"We don't know which class we're messaging?");
2664 ? diag::err_arc_receiver_forward_class
2665 : diag::warn_receiver_forward_class),
2675 Method =
Class->lookupClassMethod(Sel);
2679 Method =
Class->lookupPrivateClassMethod(Sel);
2682 nullptr,
false,
false,
Class))
2690 unsigned NumArgs = ArgsIn.size();
2691 Expr **Args = ArgsIn.data();
2694 Method,
true, SuperLoc.
isValid(), LBracLoc,
2700 diag::err_illegal_message_expr_incomplete_type))
2704 Diag(SuperLoc, diag::err_messaging_super_with_direct_method)
2719 Diag(Loc, diag::warn_direct_initialize_call);
2727 Diag(Loc, diag::warn_direct_super_initialize_call);
2730 Diag(CurMeth->getLocation(), diag::note_method_declared_at)
2731 << CurMeth->getDeclName();
2742 Context, ReturnType, VK, LBracLoc, SuperLoc,
false,
2743 ReceiverType, Sel, SelectorLocs, Method,
ArrayRef(Args, NumArgs),
2744 RBracLoc, isImplicit);
2747 Context, ReturnType, VK, LBracLoc, ReceiverTypeInfo, Sel, SelectorLocs,
2748 Method,
ArrayRef(Args, NumArgs), RBracLoc, isImplicit);
2754 ReceiverType,
true);
2770 if (ReceiverType.
isNull())
2773 if (!ReceiverTypeInfo)
2778 nullptr, LBracLoc, SelectorLocs, RBracLoc,
2790 Sel, Method, Loc, Loc, Loc, Args,
2797 const auto *Protocol = dyn_cast<ObjCProtocolDecl>(M->
getDeclContext());
2801 if (
const auto *RootClass = dyn_cast_or_null<ObjCInterfaceDecl>(
2805 if (
P->getCanonicalDecl() == Protocol->getCanonicalDecl())
2850 assert((Receiver || SuperLoc.
isValid()) &&
"If the Receiver is null, the "
2851 "SuperLoc must be valid so we can "
2859 if (!SelectorLocs.empty() && SelectorLocs.front().isValid())
2860 SelectorSlotLocs = SelectorLocs;
2862 SelectorSlotLocs = Loc;
2866 Diag(Loc, diag::err_missing_open_square_message_send)
2887 unsigned NumArgs = ArgsIn.size();
2888 Expr **Args = ArgsIn.data();
2889 assert(SuperLoc.
isInvalid() &&
"Message to super with dependent type");
2892 SelectorLocs,
nullptr,
ArrayRef(Args, NumArgs), RBracLoc,
2902 ReceiverType = Receiver->
getType();
2915 Diag(Loc, diag::warn_bad_receiver_type) << ReceiverType << RecRange;
2918 CK_CPointerToObjCPointerCast).
get();
2923 CastKind Kind =
IsNull ? CK_NullToPointer : CK_IntegralToPointer;
2927 ReceiverType = Receiver->
getType();
2931 diag::err_incomplete_receiver_type))
2936 Receiver = result.
get();
2937 ReceiverType = Receiver->
getType();
2958 if (!Methods.empty()) {
2961 Method = Methods[0];
2965 Method = BestMethod;
2969 receiverIsIdLike, Methods))
2987 Diag(SelLoc, diag::warn_instance_method_on_class_found)
3000 Method = ClassDecl->lookupClassMethod(Sel);
3003 Method = ClassDecl->lookupPrivateClassMethod(Sel);
3018 if (!Methods.empty()) {
3021 Method = Methods[0];
3027 if (ID->getSuperClass())
3028 Diag(SelLoc, diag::warn_root_inst_method_not_found)
3036 Method = BestMethod;
3058 ClassDecl = OCIType->getInterfaceDecl();
3067 ? diag::err_arc_receiver_forward_instance
3068 : diag::warn_receiver_forward_instance,
3073 forwardClass = OCIType->getInterfaceDecl();
3075 diag::note_receiver_is_id);
3090 Diag(SelLoc, diag::err_arc_may_not_respond)
3091 << OCIType->getPointeeType() << Sel << RecRange
3092 <<
SourceRange(SelectorLocs.front(), SelectorLocs.back());
3096 if (!Method && (!Receiver || !
isSelfExpr(Receiver))) {
3100 if (OCIType->qual_empty()) {
3105 if (!Methods.empty()) {
3108 Method = Methods[0];
3113 Method = BestMethod;
3120 if (Method && !forwardClass)
3121 Diag(SelLoc, diag::warn_maynot_respond)
3122 << OCIType->getInterfaceDecl()->getIdentifier()
3131 Diag(Loc, diag::err_bad_receiver_type) << ReceiverType << RecRange;
3144 diag::err_messaging_unqualified_id_with_direct_method);
3156 diag::err_messaging_class_with_direct_method);
3169 Diag(SuperLoc, diag::err_messaging_super_with_direct_method);
3180 }
else if (ReceiverType->
isObjCIdType() && !isImplicit) {
3181 Diag(Receiver->
getExprLoc(), diag::warn_messaging_unqualified_id);
3184 if (DIFunctionScopeInfo &&
3187 bool isDesignatedInitChain =
false;
3194 if (!ID->declaresOrInheritsDesignatedInitializers() ||
3195 ID->isDesignatedInitializer(Sel)) {
3196 isDesignatedInitChain =
true;
3202 if (!isDesignatedInitChain) {
3206 assert(isDesignated && InitMethod);
3209 diag::warn_objc_designated_init_non_designated_init_call :
3210 diag::warn_objc_designated_init_non_super_designated_init_call);
3212 diag::note_objc_designated_init_marked_here);
3216 if (DIFunctionScopeInfo &&
3220 Diag(SelLoc, diag::warn_objc_secondary_init_super_init_call);
3227 unsigned NumArgs = ArgsIn.size();
3228 Expr **Args = ArgsIn.data();
3235 Method, ClassMessage, SuperLoc.
isValid(),
3236 LBracLoc, RBracLoc, RecRange, ReturnType, VK))
3241 diag::err_illegal_message_expr_incomplete_type))
3270 Diag(SelLoc, diag::err_arc_illegal_explicit_message)
3275 if (Method && NumArgs >= 1) {
3276 if (
const auto *SelExp =
3277 dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens())) {
3278 Selector ArgSel = SelExp->getSelector();
3281 SelExp->getSourceRange());
3285 SelExp->getSourceRange());
3288 switch (SelFamily) {
3295 if (!SelMethod->
hasAttr<NSReturnsNotRetainedAttr>()) {
3298 diag::err_arc_perform_selector_retains);
3305 if (SelMethod->
hasAttr<NSReturnsRetainedAttr>()) {
3308 diag::err_arc_perform_selector_retains);
3317 Diag(SelLoc, diag::warn_arc_perform_selector_leaks);
3318 Diag(Args[0]->getExprLoc(), diag::note_used_here);
3331 Context, ReturnType, VK, LBracLoc, SuperLoc,
true,
3332 ReceiverType, Sel, SelectorLocs, Method,
ArrayRef(Args, NumArgs),
3333 RBracLoc, isImplicit);
3336 Context, ReturnType, VK, LBracLoc, Receiver, Sel, SelectorLocs, Method,
3337 ArrayRef(Args, NumArgs), RBracLoc, isImplicit);
3342 bool IsClassObjectCall = ClassMessage;
3349 if (OPT->getObjectType()->isObjCClass()) {
3351 IsClassObjectCall =
true;
3359 ReceiverType, IsClassObjectCall);
3372 Result->setDelegateInitCall(
true);
3383 if (!isImplicit && Method) {
3396 CheckObjCCircularContainer(
Result);
3426 if (isa<ParenListExpr>(Receiver)) {
3441 nullptr, LBracLoc, SelectorLocs,
3475 bool isIndirect =
false;
3479 type = ref->getPointeeType();
3486 type = ptr->getPointeeType();
3493 }
else if (
const ArrayType *array =
type->getAsArrayTypeUnsafe()) {
3494 type =
QualType(array->getElementType()->getBaseElementTypeUnsafe(), 0);
3502 if (
type->isObjCARCBridgableType())
3507 if (
type->isObjCARCBridgableType())
3528 ACCResult merge(ACCResult left, ACCResult right) {
3529 if (left == right)
return left;
3530 if (left == ACC_bottom)
return right;
3531 if (right == ACC_bottom)
return left;
3537 class ARCCastChecker :
public StmtVisitor<ARCCastChecker, ACCResult> {
3547 return type->isCARCBridgableType();
3553 : Context(Context), SourceClass(source), TargetClass(target),
3554 Diagnose(diagnose) {}
3557 ACCResult Visit(
Expr *e) {
3561 ACCResult VisitStmt(
Stmt *
s) {
3566 ACCResult VisitExpr(
Expr *e) {
3582 ACCResult VisitCastExpr(
CastExpr *e) {
3584 case CK_NullToPointer:
3588 case CK_LValueToRValue:
3590 case CK_CPointerToObjCPointerCast:
3591 case CK_BlockPointerToObjCPointerCast:
3592 case CK_AnyPointerToBlockPointerCast:
3607 return Visit(e->
getRHS());
3613 if (left == ACC_invalid)
return ACC_invalid;
3624 ACCResult VisitStmtExpr(
StmtExpr *e) {
3643 return ACC_plusZero;
3651 ACCResult VisitCallExpr(
CallExpr *e) {
3653 if (ACCResult result = checkCallToFunction(fn))
3656 return super::VisitCallExpr(e);
3668 if (fn->
hasAttr<CFReturnsNotRetainedAttr>())
3669 return ACC_plusZero;
3674 if (fn->
hasAttr<CFReturnsRetainedAttr>())
3675 return Diagnose ? ACC_plusOne
3680 if (builtinID == Builtin::BI__builtin___CFStringMakeConstantString)
3684 if (!fn->
hasAttr<CFAuditedTransferAttr>())
3689 return Diagnose ? ACC_plusOne
3692 return ACC_plusZero;
3705 return checkCallToMethod(method);
3709 if (!method)
return ACC_invalid;
3718 if (method->
hasAttr<CFReturnsNotRetainedAttr>())
3719 return ACC_plusZero;
3723 if (method->
hasAttr<CFReturnsRetainedAttr>())
3735 return ACC_plusZero;
3749template <
typename DiagBuilderT>
3753 Expr *realCast,
const char *bridgeKeyword,
const char *CFBridgeName) {
3769 NCE->getAngleBrackets().getEnd());
3773 char PrevChar = *
SM.getCharacterData(range.getBegin().getLocWithOffset(-1));
3777 BridgeCall += CFBridgeName;
3784 castedE = CCE->getSubExpr();
3791 char PrevChar = *
SM.getCharacterData(range.getBegin().getLocWithOffset(-1));
3795 BridgeCall += CFBridgeName;
3797 if (isa<ParenExpr>(castedE)) {
3815 std::string castCode =
"(";
3816 castCode += bridgeKeyword;
3820 NCE->getAngleBrackets().getEnd());
3824 std::string castCode =
"(";
3825 castCode += bridgeKeyword;
3830 if (isa<ParenExpr>(castedE)) {
3844template <
typename T>
3851 for (
auto *Redecl : RT->getDecl()->getMostRecentDecl()->redecls()) {
3852 if (
auto *
attr = Redecl->getAttr<T>())
3863 TDNDecl = TD->getDecl();
3864 if (ObjCBridgeRelatedAttr *ObjCBAttr =
3865 getObjCBridgeAttr<ObjCBridgeRelatedAttr>(TD))
3882 UnavailableAttr::IR_ARCForbiddenConversion))
3895 unsigned srcKind = 0;
3919 S.
Diag(loc, diag::err_arc_cast_requires_bridge)
3928 ACCResult CreateRule =
3930 assert(CreateRule != ACC_bottom &&
"This cast should already be accepted.");
3931 if (CreateRule != ACC_plusOne)
3934 ? S.
Diag(noteLoc, diag::note_arc_bridge)
3935 : S.
Diag(noteLoc, diag::note_arc_cstyle_bridge);
3938 castType,
castExpr, realCast,
"__bridge ",
3941 if (CreateRule != ACC_plusZero)
3944 ? S.
Diag(noteLoc, diag::note_arc_cstyle_bridge_transfer)
3947 diag::note_arc_bridge_transfer)
3948 << castExprType << br;
3951 castType,
castExpr, realCast,
"__bridge_transfer ",
3952 br ?
"CFBridgingRelease" :
nullptr);
3961 S.
Diag(loc, diag::err_arc_cast_requires_bridge)
3969 ACCResult CreateRule =
3971 assert(CreateRule != ACC_bottom &&
"This cast should already be accepted.");
3972 if (CreateRule != ACC_plusOne)
3975 ? S.
Diag(noteLoc, diag::note_arc_bridge)
3976 : S.
Diag(noteLoc, diag::note_arc_cstyle_bridge);
3978 castType,
castExpr, realCast,
"__bridge ",
3981 if (CreateRule != ACC_plusZero)
3984 ? S.
Diag(noteLoc, diag::note_arc_cstyle_bridge_retained)
3987 diag::note_arc_bridge_retained)
3991 castType,
castExpr, realCast,
"__bridge_retained ",
3992 br ?
"CFBridgingRetain" :
nullptr);
3998 S.
Diag(loc, diag::err_arc_mismatched_cast)
4000 << srcKind << castExprType << castType
4001 << castRange <<
castExpr->getSourceRange();
4004template <
typename TB>
4006 bool &HadTheAttribute,
bool warn) {
4008 HadTheAttribute =
false;
4011 if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
4013 HadTheAttribute =
true;
4014 if (Parm->isStr(
"id"))
4027 = InterfacePointerType->getObjectType()->getInterface();
4028 if ((CastClass == ExprClass) ||
4032 S.
Diag(
castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge)
4037 castType, ExprClass)))
4044 S.
Diag(
castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge)
4045 << T <<
Target->getName() << castType;
4047 S.
Diag(
Target->getBeginLoc(), diag::note_declared_at);
4054 diag::err_objc_cf_bridged_not_interface)
4067template <
typename TB>
4069 bool &HadTheAttribute,
bool warn) {
4071 HadTheAttribute =
false;
4074 if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
4076 HadTheAttribute =
true;
4077 if (Parm->isStr(
"id"))
4089 castExpr->getType()->getAsObjCInterfacePointerType()) {
4091 = InterfacePointerType->getObjectType()->getInterface();
4092 if ((CastClass == ExprClass) ||
4097 diag::warn_objc_invalid_bridge_to_cf)
4098 <<
castExpr->getType()->getPointeeType() << T;
4102 }
else if (
castExpr->getType()->isObjCIdType() ||
4112 diag::warn_objc_invalid_bridge_to_cf)
4113 <<
castExpr->getType() << castType;
4115 S.
Diag(
Target->getBeginLoc(), diag::note_declared_at);
4122 diag::err_objc_ns_bridged_invalid_cfobject)
4123 <<
castExpr->getType() << castType;
4126 S.
Diag(
Target->getBeginLoc(), diag::note_declared_at);
4143 bool HasObjCBridgeAttr;
4144 bool ObjCBridgeAttrWillNotWarn =
4145 CheckObjCBridgeNSCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
4147 if (ObjCBridgeAttrWillNotWarn && HasObjCBridgeAttr)
4149 bool HasObjCBridgeMutableAttr;
4150 bool ObjCBridgeMutableAttrWillNotWarn =
4151 CheckObjCBridgeNSCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
4152 HasObjCBridgeMutableAttr,
false);
4153 if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
4156 if (HasObjCBridgeAttr)
4157 CheckObjCBridgeNSCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
4159 else if (HasObjCBridgeMutableAttr)
4160 CheckObjCBridgeNSCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
4161 HasObjCBridgeMutableAttr,
true);
4164 bool HasObjCBridgeAttr;
4165 bool ObjCBridgeAttrWillNotWarn =
4166 CheckObjCBridgeCFCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
4168 if (ObjCBridgeAttrWillNotWarn && HasObjCBridgeAttr)
4170 bool HasObjCBridgeMutableAttr;
4171 bool ObjCBridgeMutableAttrWillNotWarn =
4172 CheckObjCBridgeCFCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
4173 HasObjCBridgeMutableAttr,
false);
4174 if (ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
4177 if (HasObjCBridgeAttr)
4178 CheckObjCBridgeCFCast<ObjCBridgeAttr>(*
this, castType,
castExpr, HasObjCBridgeAttr,
4180 else if (HasObjCBridgeMutableAttr)
4181 CheckObjCBridgeCFCast<ObjCBridgeMutableAttr>(*
this, castType,
castExpr,
4182 HasObjCBridgeMutableAttr,
true);
4189 if (PRE->isExplicitProperty()) {
4191 SrcType = PDecl->getType();
4193 else if (PRE->isImplicitProperty()) {
4195 SrcType = Getter->getReturnType();
4218 : CK_CPointerToObjCPointerCast;
4230 bool CfToNs,
bool Diagnose) {
4231 QualType T = CfToNs ? SrcType : DestType;
4247 Diag(Loc, diag::err_objc_bridged_related_invalid_class) << RCId
4248 << SrcType << DestType;
4255 RelatedClass = cast<ObjCInterfaceDecl>(
Target);
4258 Diag(Loc, diag::err_objc_bridged_related_invalid_class_name) << RCId
4259 << SrcType << DestType;
4262 Diag(
Target->getBeginLoc(), diag::note_declared_at);
4268 if (CfToNs && CMId) {
4273 Diag(Loc, diag::err_objc_bridged_related_known_method)
4274 << SrcType << DestType << Sel <<
false;
4282 if (!CfToNs && IMId) {
4284 InstanceMethod = RelatedClass->
lookupMethod(Sel,
true);
4285 if (!InstanceMethod) {
4287 Diag(Loc, diag::err_objc_bridged_related_known_method)
4288 << SrcType << DestType << Sel <<
true;
4300 Expr *&SrcExpr,
bool Diagnose) {
4305 if (!CfToNs && !NsToCf)
4313 ClassMethod, InstanceMethod, TDNDecl,
4321 std::string ExpressionString =
"[";
4323 ExpressionString +=
" ";
4324 ExpressionString += ClassMethod->getSelector().getAsString();
4328 Diag(Loc, diag::err_objc_bridged_related_known_method)
4329 << SrcType << DestType << ClassMethod->getSelector() <<
false
4338 Expr *args[] = { SrcExpr };
4340 ClassMethod->getLocation(),
4341 ClassMethod->getSelector(), ClassMethod,
4343 SrcExpr = msg.
get();
4350 if (InstanceMethod) {
4352 std::string ExpressionString;
4355 if (InstanceMethod->isPropertyAccessor())
4357 InstanceMethod->findPropertyDecl()) {
4359 ExpressionString =
".";
4360 ExpressionString += PDecl->getNameAsString();
4361 Diag(Loc, diag::err_objc_bridged_related_known_method)
4362 << SrcType << DestType << InstanceMethod->getSelector() <<
true
4365 if (ExpressionString.empty()) {
4367 ExpressionString =
" ";
4368 ExpressionString += InstanceMethod->getSelector().getAsString();
4369 ExpressionString +=
"]";
4371 Diag(Loc, diag::err_objc_bridged_related_known_method)
4372 << SrcType << DestType << InstanceMethod->getSelector() <<
true
4380 SrcExpr, SrcType, InstanceMethod->getLocation(),
4381 InstanceMethod->getSelector(), InstanceMethod, std::nullopt);
4382 SrcExpr = msg.
get();
4393 bool Diagnose,
bool DiagnoseCFAudited,
4405 if (exprACTC == castACTC) {
4410 castType != castExprType) {
4416 if (
const ParenType *PT = dyn_cast<ParenType>(DT))
4417 QDT = PT->desugar();
4418 else if (
const TypeOfType *TP = dyn_cast<TypeOfType>(DT))
4419 QDT = TP->desugar();
4420 else if (
const AttributedType *AT = dyn_cast<AttributedType>(DT))
4421 QDT = AT->desugar();
4422 if (QDT != castType &&
4427 Diag(loc, diag::err_arc_nolifetime_behavior);
4461 switch (ARCCastChecker(
Context, exprACTC, castACTC,
false).Visit(
castExpr)) {
4474 CK_ARCConsumeObject,
castExpr,
nullptr,
4500 (Opc == BO_NE || Opc == BO_EQ))) {
4522 castType =
cast->getTypeAsWritten();
4525 castRange =
cast->getTypeInfoAsWritten()->getTypeLoc().getSourceRange();
4526 castType =
cast->getTypeAsWritten();
4529 llvm_unreachable(
"Unexpected ImplicitCastExpr");
4547 if (
ParenExpr *pe = dyn_cast<ParenExpr>(e)) {
4550 }
else if (
UnaryOperator *uo = dyn_cast<UnaryOperator>(e)) {
4551 assert(uo->getOpcode() == UO_Extension);
4555 uo->getOperatorLoc(),
false,
4558 assert(!gse->isResultDependent());
4559 assert(!gse->isTypePredicate());
4561 unsigned n = gse->getNumAssocs();
4564 subExprs.reserve(n);
4565 subTypes.reserve(n);
4567 subTypes.push_back(assoc.getTypeSourceInfo());
4568 Expr *sub = assoc.getAssociationExpr();
4569 if (assoc.isSelected())
4571 subExprs.push_back(sub);
4575 Context, gse->getGenericLoc(), gse->getControllingExpr(), subTypes,
4576 subExprs, gse->getDefaultLoc(), gse->getRParenLoc(),
4577 gse->containsUnexpandedParameterPack(), gse->getResultIndex());
4579 assert(isa<ImplicitCastExpr>(e) &&
"bad form of unbridged cast!");
4580 return cast<ImplicitCastExpr>(e)->getSubExpr();
4590 if (isa<ObjCObjectPointerType>(canCastType) &&
4596 return !ObjI->isArcWeakrefUnavailable();
4603 Expr *curExpr = e, *prevExpr =
nullptr;
4608 if (
auto *pe = dyn_cast<ParenExpr>(curExpr)) {
4610 curExpr = pe->getSubExpr();
4614 if (
auto *ce = dyn_cast<CastExpr>(curExpr)) {
4615 if (
auto *ice = dyn_cast<ImplicitCastExpr>(ce))
4616 if (ice->getCastKind() == CK_ARCReclaimReturnedObject) {
4618 return ice->getSubExpr();
4619 if (
auto *pe = dyn_cast<ParenExpr>(prevExpr))
4620 pe->setSubExpr(ice->getSubExpr());
4622 cast<CastExpr>(prevExpr)->setSubExpr(ice->getSubExpr());
4627 curExpr = ce->getSubExpr();
4645 SubExpr = SubResult.
get();
4652 bool MustConsume =
false;
4659 : CK_CPointerToObjCPointerCast);
4666 Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
4673 Diag(BridgeKeywordLoc, diag::note_arc_bridge)
4675 Diag(BridgeKeywordLoc, diag::note_arc_bridge_transfer)
4678 br ?
"CFBridgingRelease "
4679 :
"__bridge_transfer ");
4709 Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
4717 Diag(BridgeKeywordLoc, diag::note_arc_bridge)
4719 Diag(BridgeKeywordLoc, diag::note_arc_bridge_retained)
4722 br ?
"CFBridgingRetain " :
"__bridge_retained");
4729 Diag(LParenLoc, diag::err_arc_bridge_cast_incompatible)
4730 << FromType << T << Kind
Defines the clang::ASTContext interface.
static StringRef bytes(const std::vector< T, Allocator > &v)
Defines enum values for all the target-independent builtin functions.
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.
llvm::MachO::Target Target
Defines the clang::Preprocessor interface.
static bool CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr, bool &HadTheAttribute, bool warn)
static QualType stripObjCInstanceType(ASTContext &Context, QualType T)
static void diagnoseObjCARCConversion(Sema &S, SourceRange castRange, QualType castType, ARCConversionTypeClass castACTC, Expr *castExpr, Expr *realCast, ARCConversionTypeClass exprACTC, Sema::CheckedConversionKind CCK)
static ObjCMethodDecl * findMethodInCurrentClass(Sema &S, Selector Sel)
static void checkCocoaAPI(Sema &S, const ObjCMessageExpr *Msg)
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...
static ObjCMethodDecl * LookupDirectMethodInGlobalPool(Sema &S, Selector Sel, bool &onlyDirect, bool &anyDirect)
static Expr * maybeUndoReclaimObject(Expr *e)
Look for an ObjCReclaimReturnedObject cast and destroy it.
static bool CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr, bool &HadTheAttribute, bool warn)
static void CheckObjCDictionaryLiteralDuplicateKeys(Sema &S, ObjCDictionaryLiteral *Literal)
Check for duplicate keys in an ObjC dictionary literal.
static NSAPI::NSClassIdKindKind ClassKindFromLiteralKind(Sema::ObjCLiteralKind LiteralKind)
Maps ObjCLiteralKind to NSClassIdKindKind.
static bool isAnyCLike(ARCConversionTypeClass ACTC)
static void RemoveSelectorFromWarningCache(Sema &S, Expr *Arg)
static void DiagnoseMismatchedSelectors(Sema &S, SourceLocation AtLoc, ObjCMethodDecl *Method, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
static bool HelperToDiagnoseMismatchedMethodsInGlobalPool(Sema &S, SourceLocation AtLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, ObjCMethodDecl *Method, ObjCMethodList &MethList)
static void applyCocoaAPICheck(Sema &S, const ObjCMessageExpr *Msg, unsigned DiagID, bool(*refactor)(const ObjCMessageExpr *, const NSAPI &, edit::Commit &))
static ObjCMethodDecl * LookupDirectMethodInMethodList(Sema &S, Selector Sel, ObjCMethodList &MethList, bool &onlyDirect, bool &anyDirect)
static ObjCBridgeRelatedAttr * ObjCBridgeRelatedAttrFromType(QualType T, TypedefNameDecl *&TDNDecl)
static T * getObjCBridgeAttr(const TypedefType *TD)
static ARCConversionTypeClass classifyTypeForARCConversion(QualType type)
static bool isAnyRetainable(ARCConversionTypeClass ACTC)
@ ACTC_voidPtr
void* might be a normal C type, or it might a CF type.
@ ACTC_retainable
id, void (^)()
@ ACTC_coreFoundation
struct A*
@ ACTC_indirectRetainable
id*, id***, void (^*)(),
@ ACTC_none
int, void, struct A
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...
static const ObjCMethodDecl * findExplicitInstancetypeDeclarer(const ObjCMethodDecl *MD, QualType instancetype)
Look for an ObjC method whose result type exactly matches the given type.
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...
static bool isMethodDeclaredInRootProtocol(Sema &S, const ObjCMethodDecl *M)
static void addFixitForObjCARCConversion(Sema &S, DiagBuilderT &DiagB, Sema::CheckedConversionKind CCK, SourceLocation afterLParen, QualType castType, Expr *castExpr, Expr *realCast, const char *bridgeKeyword, const char *CFBridgeName)
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 bool ValidateObjCLiteralInterfaceDecl(Sema &S, ObjCInterfaceDecl *Decl, SourceLocation Loc, Sema::ObjCLiteralKind LiteralKind)
Validates ObjCInterfaceDecl availability.
static ObjCInterfaceDecl * LookupObjCInterfaceDeclForLiteral(Sema &S, SourceLocation Loc, Sema::ObjCLiteralKind LiteralKind)
Looks up ObjCInterfaceDecl of a given NSClassIdKindKind.
static void checkFoundationAPI(Sema &S, SourceLocation Loc, const ObjCMethodDecl *Method, ArrayRef< Expr * > Args, QualType ReceiverType, bool IsClassObjectCall)
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.
Defines the clang::TypeLoc interface and its subclasses.
__device__ __2f16 float __ockl_bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
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.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
void setObjCNSStringType(QualType T)
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
SelectorTable & Selectors
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;.
QualType getObjCProtoType() const
Retrieve the type of the Objective-C Protocol class.
CanQualType ObjCBuiltinIdTy
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
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.
CanQualType PseudoObjectTy
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
QualType getObjCIdType() const
Represents the Objective-CC id type.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
QualType getObjCConstantStringInterface() const
QualType getObjCNSStringType() const
QualType getWideCharType() const
Return the type of wide characters.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
An attributed type is a type to which a type attribute has been applied.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
A builtin binary operation expression such as "x + y" or "x <= y".
CStyleCastExpr - An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ [expr....
Abstract class common to all of the C++ "named"/"keyword" casts.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
QualType withConst() const
Retrieves a version of this type with const applied.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
void setExprNeedsCleanups(bool SideEffects)
ConditionalOperator - The ?: ternary operator.
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression representing the value of the expression if the condition eva...
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression representing the value of the expression if the condition eval...
Represents the canonical version of C arrays with a specified constant size.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl * getNonClosureAncestor()
Find the nearest non-closure ancestor of this context, i.e.
Simple template class for restricting typo correction candidates to ones having a single Decl* of the...
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isInvalidDecl() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
bool isIdentifier() const
Predicate functions for querying what type of name this is.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
ExplicitCastExpr - An explicit cast written in the source code.
This represents one expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parentheses and casts which do not change the value (including ptr->int casts of the sa...
@ SE_AllowSideEffects
Allow any unmodeled side effect.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
Expr * IgnoreParenLValueCasts() LLVM_READONLY
Skip past any parentheses and lvalue casts which might surround this expression until reaching a fixe...
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool isObjCSelfExpr() const
Check if this expression is the ObjC 'self' implicit parameter.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
@ NPC_ValueDependentIsNotNull
Specifies that a value-dependent expression should be considered to never be a null pointer constant.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
Represents difference between two FPOptions values.
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.
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
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.
Represents a function declaration or definition.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
QualType getReturnType() const
Represents a C11 generic selection.
AssociationTy< false > Association
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 accepting an expression predicate.
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
Describes the sequence of initializations required to initialize a given object or reference with a s...
Describes an entity that is being initialized.
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
static InitializedEntity InitializeParameter(ASTContext &Context, ParmVarDecl *Parm)
Create the initialization entity for a parameter.
bool isSubscriptPointerArithmetic() const
static bool isAsciiIdentifierContinueChar(char c, const LangOptions &LangOpts)
Returns true if the given character could appear in an identifier.
Represents the results of name lookup.
@ FoundOverloaded
Name lookup found a set of overloaded functions that met the criteria.
@ FoundUnresolvedValue
Name lookup found an unresolvable value declaration and cannot yet complete.
@ Ambiguous
Name lookup results in an ambiguity; use getAmbiguityKind to figure out what kind of ambiguity we hav...
@ NotFound
No entity found met the criteria.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
@ Found
Name lookup found a single declaration that met the criteria.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
@ NSDict_dictionaryWithObjectsForKeysCount
@ NSArr_arrayWithObjectsCount
This represents a decl that may have a name.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
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...
static ObjCArrayLiteral * Create(const ASTContext &C, ArrayRef< Expr * > Elements, QualType T, ObjCMethodDecl *Method, SourceRange SR)
ObjCBoxedExpr - used for generalized expression boxing.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers,...
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCContainerDecl - Represents a container for method declarations.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
ObjCPropertyDecl * FindPropertyDeclaration(const IdentifierInfo *PropertyId, ObjCPropertyQueryKind QueryKind) const
FindPropertyDeclaration - Finds declaration of the property given its name in 'PropertyId' and return...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
static ObjCDictionaryLiteral * Create(const ASTContext &C, ArrayRef< ObjCDictionaryElement > VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, SourceRange SR)
ObjCEncodeExpr, used for @encode in Objective-C.
Represents an ObjC class declaration.
ObjCMethodDecl * lookupClassMethod(Selector Sel) const
Lookup a class method for a given selector.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
ObjCMethodDecl * lookupInstanceMethod(Selector Sel) const
Lookup an instance method for a given selector.
ObjCMethodDecl * lookupPrivateClassMethod(const Selector &Sel)
ObjCMethodDecl * getCategoryClassMethod(Selector Sel) const
ObjCMethodDecl * lookupPrivateMethod(const Selector &Sel, bool Instance=true) const
Lookup a method in the classes implementation hierarchy.
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,...
ObjCInterfaceDecl * getSuperClass() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
Interfaces are the core concept in Objective-C for object oriented design.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ObjCIvarDecl - Represents an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
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.
Selector getSelector() const
const ObjCMethodDecl * getMethodDecl() const
ObjCMethodDecl - Represents an instance or class method declaration.
bool isDesignatedInitializerForTheInterface(const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the method selector resolves to a designated initializer in the class's interface.
ImplicitParamDecl * getSelfDecl() const
ArrayRef< ParmVarDecl * > parameters() const
unsigned param_size() const
bool isPropertyAccessor() const
void getOverriddenMethods(SmallVectorImpl< const ObjCMethodDecl * > &Overridden) const
Return overridden methods for the given Method.
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 isSynthesizedAccessorStub=false, bool isImplicitlyDeclared=false, bool isDefined=false, ObjCImplementationControl impControl=ObjCImplementationControl::None, bool HasRelatedResultType=false)
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
QualType getSendResultType() const
Determine the type of an expression that sends a message to this function.
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type.
SourceLocation getBeginLoc() const LLVM_READONLY
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs=std::nullopt)
Sets the method's parameters and selector source locations.
bool isDirectMethod() const
True if the method is tagged as objc_direct.
Selector getSelector() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isInstanceMethod() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
QualType getReturnType() const
ObjCImplementationControl getImplementationControl() const
bool isClassMethod() const
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
Represents a class type in Objective C.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
Represents one property declaration in an Objective-C interface.
ObjCMethodDecl * getGetterMethodDecl() const
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
ObjCPropertyDecl * getExplicitProperty() const
ObjCMethodDecl * getImplicitPropertyGetter() const
bool isExplicitProperty() const
Represents an Objective-C protocol declaration.
bool hasDefinition() const
Determine whether this protocol has a definition.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
bool isNonRuntimeProtocol() const
This is true iff the protocol is tagged with the objc_non_runtime_protocol attribute.
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
ParenExpr - This represents a parethesized expression, e.g.
Sugar for parentheses used when specifying types.
Represents a parameter to a function.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
IdentifierTable & getIdentifierTable()
SelectorTable & getSelectorTable()
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Expr * getResultExpr()
Return the result-bearing expression, or null if there is none.
A (possibly-)qualified type.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
QualType withConst() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
bool isConstQualified() const
Determine whether this type is const-qualified.
QualType substObjCTypeArgs(ASTContext &ctx, ArrayRef< QualType > typeArgs, ObjCSubstitutionContext context) const
Substitute type arguments for the Objective-C type parameters used in the subject type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Base for LValueReferenceType and RValueReferenceType.
Scope - A scope is a transient data structure that is used while parsing the program.
static Selector constructSetterSelector(IdentifierTable &Idents, SelectorTable &SelTable, const IdentifierInfo *Name)
Return the default setter selector for the given identifier.
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
Selector getNullarySelector(IdentifierInfo *ID)
Selector getUnarySelector(IdentifierInfo *ID)
Smart pointer class that efficiently represents Objective-C method names.
std::string getAsString() const
Derive the full selector name (e.g.
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
bool isUnarySelector() const
bool isNull() const
Determine whether this is the empty selector.
ObjCStringFormatFamily getStringFormatFamily() const
unsigned getNumArgs() const
llvm::DenseMap< Selector, Lists >::iterator iterator
iterator find(Selector Sel)
Sema - This implements semantic analysis and AST building for C.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
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,...
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
void DiagnoseSentinelCalls(const NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
bool FormatStringHasSArg(const StringLiteral *FExpr)
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
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.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
FPOptionsOverride CurFPFeatureOverrides()
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ASTContext & getASTContext() const
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
bool tryCaptureVariable(ValueDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
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.
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
@ None
This is not a defaultable comparison operator.
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
const LangOptions & getLangOpts() const
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
const LangOptions & LangOpts
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
QualType NSStringPointer
Pointer to NSString type (NSString *).
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
sema::FunctionScopeInfo * getCurFunction() const
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
ExprResult DefaultLvalueConversion(Expr *E)
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
static bool isCast(CheckedConversionKind CCK)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
QualType QIDNSCopying
id<NSCopying> type.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const
If AllowLambda is true, treat lambda as function.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
bool isKnownName(StringRef name)
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
CheckedConversionKind
The kind of conversion being performed.
@ CCK_OtherCast
A cast other than a C-style cast.
@ CCK_ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
@ CCK_CStyleCast
A C-style cast.
@ CCK_ImplicitConversion
An implicit conversion.
@ CCK_FunctionalCast
A functional-style cast.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
SourceManager & getSourceManager() const
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
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 ...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
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.
SourceManager & SourceMgr
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
DiagnosticsEngine & Diags
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
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.
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
@ ObjCSuperMessage
The message is sent to 'super'.
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
@ ObjCInstanceMessage
The message is an instance message.
sema::FunctionScopeInfo * getEnclosingFunction() const
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType ¶mType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
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.
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
CompoundStmt * getSubStmt()
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteral - This represents a string literal expression, e.g.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind 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...
StringRef getString() const
The top declaration context.
Represents a declaration of a type.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
The base class of the type hierarchy.
bool isBlockPointerType() const
const ObjCObjectPointerType * getAsObjCQualifiedClassType() const
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
bool isObjCARCBridgableType() const
Determine whether the given type T is a "bridgable" Objective-C type, which is either an Objective-C ...
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool canHaveNullability(bool ResultIfUnknown=true) const
Determine whether the given type can have a nullability specifier applied to it, i....
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isCARCBridgableType() const
Determine whether the given type T is a "bridgeable" C type.
bool isObjCBoxableRecordType() const
bool isObjCIdType() const
bool isObjCClassOrClassKindOfType() const
Whether the type is Objective-C 'Class' or a __kindof type of an Class type, e.g.,...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isObjCObjectPointerType() const
bool isObjCQualifiedClassType() const
bool isObjCClassType() const
std::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...
const ObjCObjectType * getAsObjCInterfaceType() const
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...
const T * getAs() const
Member-template getAs<specific type>'.
bool isObjCRetainableType() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
TypedefNameDecl * getDecl() const
Simple class containing the result of Sema::CorrectTypo.
DeclClass * getCorrectionDeclAs() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Expr * getSubExpr() const
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
void setType(QualType newType)
Represents a variable declaration or definition.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
bool isCommitable() const
edit_iterator edit_begin() const
SmallVectorImpl< Edit >::const_iterator edit_iterator
edit_iterator edit_end() const
Retains information about a function, method, or block that is currently being parsed.
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
bool ObjCIsDesignatedInit
True when this is a method marked as a designated initializer.
bool ObjCShouldCallSuper
A flag that is set when parsing a method that must call super's implementation, such as -dealloc,...
bool ObjCWarnForNoInitDelegation
This starts true for a secondary initializer method and will be set to false if there is an invocatio...
bool ObjCIsSecondaryInit
True when this is an initializer method not marked as a designated initializer within a class that ha...
bool ObjCWarnForNoDesignatedInitChain
This starts true for a method marked as designated initializer and will be set to false if there is a...
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
uint32_t Literal
Literals are represented as positive integers.
bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
bool followsCreateRule(const FunctionDecl *FD)
The JSON file list parser is used to communicate input to InstallAPI.
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
NullabilityKind
Describes the nullability of a particular type.
@ Nullable
Values of this type can be null.
@ NonNull
Values of this type can never be null.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
@ OK_ObjCSubscript
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
ObjCMethodFamily
A family of Objective-C methods.
@ OMF_None
No particular method family.
@ Parameter
The parameter type of a method or function.
@ Result
The result type of a method or function.
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
@ OBC_Bridge
Bridging via __bridge, which does nothing but reinterpret the bits.
@ OBC_BridgeTransfer
Bridging via __bridge_transfer, which transfers ownership of an Objective-C pointer into ARC.
@ OBC_BridgeRetained
Bridging via __bridge_retain, which makes an ARC object available as a +1 C pointer.
CastKind
CastKind - The kind of operation required for a conversion.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
U cast(CodeGen::Address addr)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
MutableArrayRef< Expr * > MultiExprArg
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
EvalResult is a struct with detailed info about an evaluated expression.
An element in an Objective-C dictionary literal.
a linked list of methods with the same selector name but different signatures.
ObjCMethodDecl * getMethod() const
ObjCMethodList * getNext() const
CharSourceRange getFileRange(SourceManager &SM) const
CharSourceRange getInsertFromRange(SourceManager &SM) const