;
47 if(Strings.size() != 1) {
52 for(
Expr*
E: Strings) {
53S = cast<StringLiteral>(
E);
56 if(!S->isOrdinary()) {
57 Diag(S->getBeginLoc(), diag::err_cfstring_literal_not_string_constant)
58<< S->getSourceRange();
63StrBuf += S->getString();
66StrLocs.append(S->tokloc_begin(), S->tokloc_end());
72assert(CAT &&
"String literal not of constant array type!");
74CAT->
getElementType(), llvm::APInt(32, StrBuf.size() + 1),
nullptr,
77 false, StrTy, &StrLocs[0],
100std::string StringClass(
getLangOpts().ObjCConstantStringClass);
102 if(StringClass.empty())
103NSIdent = &Context.
Idents.
get(
"NSConstantString");
105NSIdent = &Context.
Idents.
get(StringClass);
116 Diag(S->getBeginLoc(), diag::err_no_nsconstant_string_class)
117<< NSIdent << S->getSourceRange();
157S.
Diag(
Loc, diag::err_undeclared_boxing_method) << Sel <<
Class->getName();
164S.
Diag(
Loc, diag::err_objc_literal_method_sig)
166S.
Diag(Method->
getLocation(), diag::note_objc_literal_method_return)
177 switch(LiteralKind) {
195llvm_unreachable(
"LiteralKind can't be converted into a ClassKind");
208S.
Diag(
Loc, diag::err_undeclared_objc_literal_class)
209<< II->
getName() << LiteralKind;
211}
else if(!
Decl->hasDefinition() && !S.
getLangOpts().DebuggerObjCLiteral) {
212S.
Diag(
Loc, diag::err_undeclared_objc_literal_class)
213<<
Decl->getName() << LiteralKind;
232 if(!ID && S.
getLangOpts().DebuggerObjCLiteral) {
250 boolisLiteral =
false,
252std::optional<NSAPI::NSNumberLiteralMethodKind> Kind =
253S.NSAPIObj->getNSNumberFactoryMethodKind(NumberType);
257S.
Diag(
Loc, diag::err_invalid_nsnumber_type)
264 if(S.NSNumberLiteralMethods[*Kind])
265 returnS.NSNumberLiteralMethods[*Kind];
267 SelectorSel = S.NSAPIObj->getNSNumberLiteralSelector(*Kind,
274 if(!S.NSNumberDecl) {
277 if(!S.NSNumberDecl) {
282 if(S.NSNumberPointer.isNull()) {
290 if(!Method && S.
getLangOpts().DebuggerObjCLiteral) {
295ReturnTInfo, S.NSNumberDecl,
305NumberType,
nullptr,
SC_None,
nullptr);
315S.NSNumberLiteralMethods[*Kind] = Method;
329 switch(Char->getKind()) {
332NumberType = Context.
CharTy;
365Number = ConvertedNumber.
get();
378 Value? tok::kw_true : tok::kw_false);
384CK_IntegralToBoolean);
394 boolArrayLiteral =
false) {
396 if(Element->isTypeDependent())
406 if(S.
getLangOpts().CPlusPlus && Element->getType()->isRecordType()) {
414 return Seq.Perform(S, Entity, Kind, Element);
417 Expr*OrigElement = Element;
426 if(!Element->getType()->isObjCObjectPointerType() &&
427!Element->getType()->isBlockPointerType()) {
428 boolRecovered =
false;
431 if(isa<IntegerLiteral>(OrigElement) ||
432isa<CharacterLiteral>(OrigElement) ||
433isa<FloatingLiteral>(OrigElement) ||
434isa<ObjCBoolLiteralExpr>(OrigElement) ||
435isa<CXXBoolLiteralExpr>(OrigElement)) {
436 if(S.
ObjC().
NSAPIObj->getNSNumberFactoryMethodKind(
438 intWhich = isa<CharacterLiteral>(OrigElement) ? 1
439: (isa<CXXBoolLiteralExpr>(OrigElement) ||
440isa<ObjCBoolLiteralExpr>(OrigElement)) ? 2
443S.
Diag(OrigElement->
getBeginLoc(), diag::err_box_literal_collection)
457 else if(
StringLiteral*String = dyn_cast<StringLiteral>(OrigElement)) {
458 if(String->isOrdinary()) {
459S.
Diag(OrigElement->
getBeginLoc(), diag::err_box_literal_collection)
474S.
Diag(Element->getBeginLoc(), diag::err_invalid_collection_element)
475<< Element->getType();
481dyn_cast<ObjCStringLiteral>(OrigElement)) {
483 unsignednumConcat = SL->getNumConcatenated();
486 boolhasMacro =
false;
487 for(
unsignedi = 0; i < numConcat ; ++i)
488 if(SL->getStrTokenLoc(i).isMacroID()) {
493S.
Diag(Element->getBeginLoc(),
494diag::warn_concatenated_nsarray_literal)
495<< Element->getType();
505Element->getBeginLoc(), Element);
523ValueExpr = RValue.
get();
541 if(
auto*CE = dyn_cast<ImplicitCastExpr>(ValueExpr))
542 if(CE->getCastKind() == CK_ArrayToPointerDecay)
544dyn_cast<StringLiteral>(CE->getSubExpr()->IgnoreParens())) {
545assert((SL->isOrdinary() || SL->isUTF8()) &&
546 "unexpected character encoding");
547StringRef Str = SL->getString();
548 constllvm::UTF8 *StrBegin = Str.bytes_begin();
549 constllvm::UTF8 *StrEnd = Str.bytes_end();
551 if(llvm::isLegalUTF8String(&StrBegin, StrEnd)) {
554 return new(Context)
ObjCBoxedExpr(CE, BoxedType,
nullptr, SR);
557 Diag(SL->getBeginLoc(), diag::warn_objc_boxing_invalid_utf8_string)
567 if(!BoxingMethod &&
getLangOpts().DebuggerObjCLiteral) {
592stringWithUTF8String, BoxingMethod))
601std::optional<NullabilityKind> Nullability =
615dyn_cast<CharacterLiteral>(ValueExpr->
IgnoreParens())) {
618 switch(Char->getKind()) {
621ValueType = Context.
CharTy;
643 if(!ET->getDecl()->isComplete()) {
644 Diag(
Loc, diag::err_objc_incomplete_boxed_expression_type)
650ET->getDecl()->getIntegerType());
676 if(!BoxingMethod &&
getLangOpts().DebuggerObjCLiteral) {
699Params.push_back(
bytes);
709Params.push_back(
type);
716ValueWithBytesObjCType, BoxingMethod))
723 Diag(
Loc, diag::err_objc_non_trivially_copyable_boxed_expression_type)
733 Diag(
Loc, diag::err_objc_illegal_boxed_expression_type)
756ValueExpr = ConvertedValueExpr.
get();
769assert(!
getLangOpts().isSubscriptPointerArithmetic());
775 "base or index cannot have dependent type here");
782IndexExpr =
Result.get();
793getterMethod, setterMethod, RB);
815 if(!Method &&
getLangOpts().DebuggerObjCLiteral) {
832Params.push_back(objects);
840Params.push_back(cnt);
852 Diag(SR.
getBegin(), diag::err_objc_literal_method_sig)
855diag::note_objc_literal_method_param)
862 if(!Method->
parameters()[1]->getType()->isIntegerType()) {
863 Diag(SR.
getBegin(), diag::err_objc_literal_method_sig)
866diag::note_objc_literal_method_param)
882 Expr**ElementsBuffer = Elements.data();
883 for(
unsignedI = 0, N = Elements.size(); I != N; ++I) {
885 SemaRef, ElementsBuffer[I], RequiredType,
true);
889ElementsBuffer[I] = Converted.
get();
905 if(Literal->isValueDependent() || Literal->isTypeDependent())
911 structAPSIntCompare {
912 booloperator()(
constllvm::APSInt &LHS,
constllvm::APSInt &RHS)
const{
913 returnllvm::APSInt::compareValues(LHS, RHS) < 0;
917llvm::DenseMap<StringRef, SourceLocation> StringKeys;
918std::map<llvm::APSInt, SourceLocation, APSIntCompare> IntegralKeys;
921 autoPair = Map.insert({Key,
Loc});
923S.
Diag(
Loc, diag::warn_nsdictionary_duplicate_key);
924S.
Diag(Pair.first->second, diag::note_nsdictionary_duplicate_key_here);
928 for(
unsignedIdx = 0, End = Literal->getNumElements(); Idx != End; ++Idx) {
929 Expr*Key = Literal->getKeyValueElement(Idx).Key->IgnoreParenImpCasts();
931 if(
auto*StrLit = dyn_cast<ObjCStringLiteral>(Key)) {
932StringRef Bytes = StrLit->getString()->getBytes();
934checkOneKey(StringKeys, Bytes,
Loc);
937 if(
auto*BE = dyn_cast<ObjCBoxedExpr>(Key)) {
938 Expr*Boxed = BE->getSubExpr();
943checkOneKey(StringKeys, Str->getBytes(),
Loc);
950checkOneKey(IntegralKeys,
Result.Val.getInt(),
Loc);
976 if(!Method &&
getLangOpts().DebuggerObjCLiteral) {
993Params.push_back(objects);
1001Params.push_back(keys);
1009Params.push_back(cnt);
1022 Diag(SR.
getBegin(), diag::err_objc_literal_method_sig)
1025diag::note_objc_literal_method_param)
1056 Diag(SR.
getBegin(), diag::err_objc_literal_method_sig)
1059diag::note_objc_literal_method_param)
1067 QualTypeCountType = Method->parameters()[2]->getType();
1069 Diag(SR.
getBegin(), diag::err_objc_literal_method_sig)
1071 Diag(Method->parameters()[2]->getLocation(),
1072diag::note_objc_literal_method_param)
1082 QualTypeValuesT = DictionaryWithObjectsMethod->parameters()[0]->getType();
1084 QualTypeKeysT = DictionaryWithObjectsMethod->parameters()[1]->getType();
1089 boolHasPackExpansions =
false;
1100 if(
Value.isInvalid())
1103Element.Key = Key.
get();
1104Element.Value =
Value.get();
1106 if(Element.EllipsisLoc.isInvalid())
1109 if(!Element.Key->containsUnexpandedParameterPack() &&
1110!Element.Value->containsUnexpandedParameterPack()) {
1111 Diag(Element.EllipsisLoc,
1112diag::err_pack_expansion_without_parameter_packs)
1114Element.Value->getEndLoc());
1118HasPackExpansions =
true;
1126DictionaryWithObjectsMethod, SR);
1128 returnSemaRef.MaybeBindToTemporary(Literal);
1143diag::err_incomplete_type_objc_at_encode,
1150 if(!NotEncodedT.
isNull())
1151 Diag(AtLoc, diag::warn_incomplete_encoded_type)
1152<< EncodedType << NotEncodedT;
1159 return new(Context)
ObjCEncodeExpr(StrTy, EncodedTypeInfo, AtLoc, RParenLoc);
1185 boolWarned =
false;
1188 if(MatchingMethodDecl == Method ||
1196S.
Diag(AtLoc, diag::warn_multiple_selectors)
1202S.
Diag(MatchingMethodDecl->
getLocation(), diag::note_method_declared_at)
1213 boolWarnMultipleSelectors) {
1214 if(!WarnMultipleSelectors ||
1217 boolWarned =
false;
1218 for(SemaObjC::GlobalMethodPool::iterator
b= S.
ObjC().
MethodPool.begin(),
1224Method, InstMethList))
1230Method, ClsMethList) || Warned)
1242 for(; M; M = M->
getNext()) {
1246assert(Method->
getSelector() == Sel &&
"Method with wrong selector in method list");
1249DirectMethod = Method;
1251onlyDirect =
false;
1254 returnDirectMethod;
1269S, Sel,
Iter->second.first, onlyDirect, anyDirect);
1271S, Sel,
Iter->second.second, onlyDirect, anyDirect);
1273 returnDirectInstance ? DirectInstance : DirectClass;
1302 boolWarnMultipleSelectors) {
1311 SelectorMatchedSel = OM->getSelector();
1314 Diag(SelLoc, diag::warn_undeclared_selector_with_typo)
1315<< Sel << MatchedSel
1319 Diag(SelLoc, diag::warn_undeclared_selector) << Sel;
1322WarnMultipleSelectors);
1324 boolonlyDirect =
true;
1325 boolanyDirect =
false;
1330 Diag(AtLoc, diag::err_direct_selector_expression)
1334}
else if(anyDirect) {
1340 if(LikelyTargetMethod && LikelyTargetMethod->
isDirectMethod()) {
1341 Diag(AtLoc, diag::warn_potentially_direct_selector_expression) << Sel;
1343diag::note_direct_method_declared_at)
1345}
else if(!LikelyTargetMethod) {
1348 Diag(AtLoc, diag::warn_strict_potentially_direct_selector_expression)
1351diag::note_direct_method_declared_at)
1372 Diag(AtLoc, diag::err_arc_illegal_selector) <<
1402 Diag(ProtoLoc, diag::err_undeclared_protocol) << ProtocolId;
1406 Diag(ProtoLoc, diag::err_objc_non_runtime_protocol_in_protocol_expr)
1409 Diag(ProtoLoc, diag::err_atprotocol_protocol) << PDecl;
1410 Diag(PDecl->
getLocation(), diag::note_entity_declared_at) << PDecl;
1419 return new(Context)
ObjCProtocolExpr(Ty, PDecl, AtLoc, ProtoIdLoc, RParenLoc);
1463 boolisClassMessage,
1464 boolisSuperMessage) {
1465assert(Method &&
"Must have a method");
1475 if(
autonullability =
1497 if(isSuperMessage) {
1500 returntransferNullability(
1519 returntransferNullability(ReceiverType);
1525 boolisClassMessage,
1526 boolisSuperMessage) {
1530 SemaRef, ReceiverType, Method, isClassMessage, isSuperMessage);
1533 if(isClassMessage) {
1540assert(ReceiverType->
isObjCClassType() &&
"expected a Class self");
1545cast<ImplicitParamDecl>(
1547->getDeclContext());
1548assert(MD->
isClassMethod() &&
"expected a class method");
1554 returnNewResultType;
1566 unsignedreceiverNullabilityIdx = 0;
1567 if(std::optional<NullabilityKind> nullability =
1571receiverNullabilityIdx = 1 +
static_cast<unsigned>(*nullability);
1574 unsignedresultNullabilityIdx = 0;
1575 if(std::optional<NullabilityKind> nullability =
1579resultNullabilityIdx = 1 +
static_cast<unsigned>(*nullability);
1584 static constuint8_t
None= 0;
1585 static constuint8_t
NonNull= 1;
1588 static constuint8_t nullabilityMap[4][4] = {
1596 unsignednewResultNullabilityIdx
1597= nullabilityMap[receiverNullabilityIdx][resultNullabilityIdx];
1598 if(newResultNullabilityIdx == resultNullabilityIdx)
1604 if(
autoattributed = dyn_cast<AttributedType>(resultType.
getTypePtr())) {
1605resultType = attributed->getModifiedType();
1612 if(newResultNullabilityIdx > 0) {
1634dyn_cast<ObjCCategoryImplDecl>(impl)) {
1635iface = catImpl->getCategoryDecl();
1637iface = impl->getClassInterface();
1647 for(
unsignedi = 0, e = overrides.size(); i != e; ++i) {
1669 SourceRangerange = overridden->getReturnTypeSourceRange();
1672loc = overridden->getLocation();
1673 Diag(loc, diag::note_related_result_type_explicit)
1708 Diag(Method->
getLocation(), diag::note_related_result_type_inferred)
1721 if(!SelectorLocs.empty() && SelectorLocs.front().isValid())
1722SelLoc = SelectorLocs.front();
1728 for(
unsignedi = 0, e = Args.size(); i != e; i++) {
1729 if(Args[i]->isTypeDependent())
1741Args[i] = result.
get();
1746DiagID = diag::err_arc_method_not_found;
1748DiagID = isClassMessage ? diag::warn_class_method_not_found
1749: diag::warn_inst_method_not_found;
1754DiagID = diag::err_method_not_found_with_typo;
1756DiagID = isClassMessage ? diag::warn_class_method_not_found_with_typo
1757: diag::warn_instance_method_not_found_with_typo;
1759 SourceRangeSelectorRange(SelectorLocs.front(), SelectorLocs.back());
1761 Diag(SelLoc, DiagID)
1762<< Sel<< isClassMessage << MatchedSel
1765 Diag(SelLoc, DiagID) << Sel<< isClassMessage << MatchedSel;
1768 Diag(SelLoc, DiagID)
1769<< Sel << isClassMessage <<
SourceRange(SelectorLocs.front(),
1770SelectorLocs.back());
1774 Diag(ThisClass->getLocation(), diag::note_receiver_class_declared);
1776 if(ThisClass->lookupClassMethod(Sel))
1777 Diag(RecRange.
getBegin(), diag::note_receiver_expr_here)
1779ThisClass->getNameAsString());
1796isClassMessage, isSuperMessage);
1805 if(Args.size() < NumNamedArgs) {
1806 Diag(SelLoc, diag::err_typecheck_call_too_few_args)
1807<< 2 << NumNamedArgs << static_cast<unsigned>(Args.size())
1814std::optional<ArrayRef<QualType>> typeArgs =
1816 boolIsError =
false;
1817 for(
unsignedi = 0; i < NumNamedArgs; i++) {
1819 if(Args[i]->isTypeDependent())
1822 Expr*argExpr = Args[i];
1825assert(argExpr &&
"CheckMessageArgumentTypes(): missing expression");
1827 if(param->
hasAttr<NoEscapeAttr>() &&
1829 if(
auto*BE = dyn_cast<BlockExpr>(
1831BE->getBlockDecl()->setDoesNotEscape();
1836!param->
hasAttr<CFConsumedAttr>())
1847Args[i] = argE.
get();
1865diag::err_call_incomplete_argument, argExpr))
1881Args[i]->getType()->isBlockPointerType() &&
1885Args[i] = arg.get();
1892 for(
unsignedi = NumNamedArgs, e = Args.size(); i < e; ++i) {
1893 if(Args[i]->isTypeDependent())
1899Args[i] = Arg.
get();
1903 if(Args.size() != NumNamedArgs) {
1904 Diag(Args[NumNamedArgs]->getBeginLoc(),
1905diag::err_typecheck_call_too_many_args)
1906<< 2
<< NumNamedArgs << static_cast<unsigned>(Args.size())
1908<<
SourceRange(Args[NumNamedArgs]->getBeginLoc(),
1909Args.back()->getEndLoc());
1930 if(!method)
return false;
1933 if(
DeclRefExpr*DRE = dyn_cast<DeclRefExpr>(receiver))
1945 if(
ObjCMethodDecl*method = iface->lookupMethod(sel, isInstance))
1950 if(
ObjCMethodDecl*method = iface->lookupPrivateMethod(sel, isInstance))
1955 for(
const auto*I : objType->
quals())
1967 for(
const auto*PROTO : OPT->
quals()) {
1968 if((MD = PROTO->lookupMethod(Sel, Instance))) {
1986 Diag(MemberLoc, diag::err_invalid_property_name)
1987<< MemberName <<
QualType(OPT, 0);
1996diag::err_property_not_found_forward_class,
1997MemberName, BaseRange))
2006 return new(Context)
2010 return new(Context)
2015 for(
const auto*I : OPT->
quals())
2025SuperLoc, SuperType);
2027 return new(Context)
2081 if(!(PDecl->getPropertyAttributes() &
2084diag::warn_property_access_suggest)
2085<< MemberName <<
QualType(OPT, 0) << PDecl->getName()
2090 if(Getter || Setter) {
2092 return new(Context)
2096 return new(Context)
2112Corrected.isKeyword() ? nullptr : Corrected.getFoundDecl();
2113 if(ChosenDecl && isa<ObjCPropertyDecl>(ChosenDecl))
2114 if(cast<ObjCPropertyDecl>(ChosenDecl)->isClassProperty()) {
2117 Diag(MemberLoc, diag::err_class_property_found) << MemberName
2125 PDiag(diag::err_property_not_found_suggest)
2126<< MemberName <<
QualType(OPT, 0));
2128TypoResult, MemberLoc,
2129SuperLoc, SuperType, Super);
2139diag::err_property_not_as_forward_class,
2140MemberName, BaseExpr))
2144diag::err_ivar_access_using_property_syntax_suggest)
2145<< MemberName <<
QualType(OPT, 0) << Ivar->getDeclName()
2150 Diag(MemberLoc, diag::err_property_not_found)
2151<< MemberName <<
QualType(OPT, 0);
2170 if(receiverNamePtr->
isStr(
"super")) {
2172 if(
autoclassDecl = CurMethod->getClassInterface()) {
2173SuperType =
QualType(classDecl->getSuperClassType(), 0);
2174 if(CurMethod->isInstanceMethod()) {
2175 if(SuperType.
isNull()) {
2177 Diag(receiverNameLoc, diag::err_root_class_cannot_use_super)
2178<< CurMethod->getClassInterface()->getIdentifier();
2188receiverNameLoc,
T,
true);
2199 Diag(receiverNameLoc, diag::err_expected_either) << tok::identifier
2209GetterSel = PD->getGetterName();
2210SetterSel = PD->getSetterName();
2246 if(Getter || Setter) {
2247 if(!SuperType.
isNull())
2248 return new(Context)
2255propertyNameLoc, receiverNameLoc, IFace);
2257 return ExprError(
Diag(propertyNameLoc, diag::err_property_not_found)
2271 boolValidateCandidate(
const TypoCorrection&candidate)
override{
2276std::unique_ptr<CorrectionCandidateCallback> clone()
override{
2277 returnstd::make_unique<ObjCInterfaceOrSuperCCC>(*
this);
2286 boolHasTrailingDot,
ParsedType&ReceiverType) {
2288ReceiverType =
nullptr;
2293 if(IsSuper && S->isInObjcMethodScope())
2299 switch(
Result.getResultKind()) {
2324 Result.suppressDiagnostics();
2355 Result.getLookupNameInfo(),
Result.getLookupKind(), S,
nullptr, CCC,
2357 if(Corrected.isKeyword()) {
2389 Diag(SuperLoc, diag::err_invalid_receiver_to_message_super);
2395 Diag(SuperLoc, diag::err_no_super_class_message)
2401 if(SuperTy.
isNull()) {
2403 Diag(SuperLoc, diag::err_root_class_cannot_use_super)
2404<<
Class->getIdentifier();
2419LBracLoc, SelectorLocs, RBracLoc, Args);
2426SuperLoc, Sel,
nullptr,
2427LBracLoc, SelectorLocs, RBracLoc, Args);
2431 boolisSuperReceiver,
2437 if(!ReceiverType.
isNull())
2440assert(((isSuperReceiver &&
Loc.
isValid()) || receiverTypeInfo) &&
2441 "Either the super receiver location needs to be valid or the receiver " 2442 "needs valid type source information");
2460 autoBuilder = S.
Diag(MsgLoc, DiagID)
2468 switch(Edit.
Kind) {
2475Builder.AddFixItHint(
2496 boolIsClassObjectCall) {
2502 const auto*SE = dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens());
2506 if(!IsClassObjectCall) {
2508 if(!OPT || !OPT->getInterfaceDecl())
2511OPT->getInterfaceDecl()->lookupInstanceMethod(SE->getSelector());
2514OPT->getInterfaceDecl()->lookupPrivateMethod(SE->getSelector());
2519ImpliedMethod = IT->getDecl()->lookupClassMethod(SE->getSelector());
2522IT->getDecl()->lookupPrivateClassMethod(SE->getSelector());
2527 if(Ret->isRecordType() || Ret->isVectorType() || Ret->isExtVectorType()) {
2528S.
Diag(
Loc, diag::warn_objc_unsafe_perform_selector)
2530<< (!Ret->isRecordType()
2532: Ret->isUnionType() ?
1 :
0);
2534diag::note_objc_unsafe_perform_selector_method_declared_here)
2545 Expr**Args,
unsignedNumArgs) {
2547 boolFormat =
false;
2561 if(!Format || NumArgs <= Idx)
2564 Expr*FormatExpr = Args[Idx];
2569S.
Diag(FormatExpr->
getExprLoc(), diag::warn_objc_cdirective_format_string)
2615 Diag(
Loc, diag::err_missing_open_square_message_send)
2620 if(!SelectorLocs.empty() && SelectorLocs.front().isValid())
2621SelectorSlotLocs = SelectorLocs;
2623SelectorSlotLocs =
Loc;
2629 unsignedNumArgs = ArgsIn.size();
2630 Expr**Args = ArgsIn.data();
2631assert(SuperLoc.
isInvalid() &&
"Message to super with dependent type");
2633ReceiverTypeInfo, Sel, SelectorLocs,
2634 nullptr,
ArrayRef(Args, NumArgs),
2635RBracLoc, isImplicit);
2642 Diag(
Loc, diag::err_invalid_receiver_class_message)
2646assert(
Class&&
"We don't know which class we're messaging?");
2657? diag::err_arc_receiver_forward_class
2658: diag::warn_receiver_forward_class),
2668Method =
Class->lookupClassMethod(Sel);
2672Method =
Class->lookupPrivateClassMethod(Sel);
2675 false,
false,
Class))
2683 unsignedNumArgs = ArgsIn.size();
2684 Expr**Args = ArgsIn.data();
2687Method,
true, SuperLoc.
isValid(), LBracLoc,
2694diag::err_illegal_message_expr_incomplete_type))
2698 Diag(SuperLoc, diag::err_messaging_super_with_direct_method)
2713 Diag(
Loc, diag::warn_direct_initialize_call);
2720 Diag(
Loc, diag::warn_direct_super_initialize_call);
2723 Diag(CurMeth->getLocation(), diag::note_method_declared_at)
2724<< CurMeth->getDeclName();
2735Context, ReturnType, VK, LBracLoc, SuperLoc,
false,
2736ReceiverType, Sel, SelectorLocs, Method,
ArrayRef(Args, NumArgs),
2737RBracLoc, isImplicit);
2740Context, ReturnType, VK, LBracLoc, ReceiverTypeInfo, Sel, SelectorLocs,
2741Method,
ArrayRef(Args, NumArgs), RBracLoc, isImplicit);
2747ReceiverType,
true);
2763 if(ReceiverType.
isNull())
2766 if(!ReceiverTypeInfo)
2771 nullptr, LBracLoc, SelectorLocs, RBracLoc,
2787 const auto*Protocol = dyn_cast<ObjCProtocolDecl>(M->
getDeclContext());
2792 if(
const auto*RootClass = dyn_cast_or_null<ObjCInterfaceDecl>(
2796 if(
P->getCanonicalDecl() == Protocol->getCanonicalDecl())
2836assert((Receiver || SuperLoc.
isValid()) &&
"If the Receiver is null, the " 2837 "SuperLoc must be valid so we can " 2838 "use it instead.");
2846 if(!SelectorLocs.empty() && SelectorLocs.front().isValid())
2847SelectorSlotLocs = SelectorLocs;
2849SelectorSlotLocs =
Loc;
2853 Diag(
Loc, diag::err_missing_open_square_message_send)
2869Receiver =
Result.get();
2875 unsignedNumArgs = ArgsIn.size();
2876 Expr**Args = ArgsIn.data();
2877assert(SuperLoc.
isInvalid() &&
"Message to super with dependent type");
2880SelectorLocs,
nullptr,
ArrayRef(Args, NumArgs), RBracLoc,
2887 if(
Result.isInvalid())
2889Receiver =
Result.get();
2890ReceiverType = Receiver->
getType();
2903 Diag(
Loc, diag::warn_bad_receiver_type) << ReceiverType << RecRange;
2907CK_CPointerToObjCPointerCast)
2913 CastKindKind =
IsNull? CK_NullToPointer : CK_IntegralToPointer;
2918ReceiverType = Receiver->
getType();
2922diag::err_incomplete_receiver_type))
2928Receiver = result.
get();
2929ReceiverType = Receiver->
getType();
2950 if(!Methods.empty()) {
2953Method = Methods[0];
2957Method = BestMethod;
2961receiverIsIdLike, Methods))
2979 Diag(SelLoc, diag::warn_instance_method_on_class_found)
2992Method = ClassDecl->lookupClassMethod(Sel);
2995Method = ClassDecl->lookupPrivateClassMethod(Sel);
3010 if(!Methods.empty()) {
3013Method = Methods[0];
3019 if(ID->getSuperClass())
3020 Diag(SelLoc, diag::warn_root_inst_method_not_found)
3027Method = BestMethod;
3049ClassDecl = OCIType->getInterfaceDecl();
3057 Loc, OCIType->getPointeeType(),
3059? diag::err_arc_receiver_forward_instance
3060: diag::warn_receiver_forward_instance,
3065forwardClass = OCIType->getInterfaceDecl();
3067diag::note_receiver_is_id);
3082 Diag(SelLoc, diag::err_arc_may_not_respond)
3083<< OCIType->getPointeeType() << Sel << RecRange
3084<<
SourceRange(SelectorLocs.front(), SelectorLocs.back());
3088 if(!Method && (!Receiver || !
isSelfExpr(Receiver))) {
3092 if(OCIType->qual_empty()) {
3097 if(!Methods.empty()) {
3100Method = Methods[0];
3104Method = BestMethod;
3111 if(Method && !forwardClass)
3112 Diag(SelLoc, diag::warn_maynot_respond)
3113<< OCIType->getInterfaceDecl()->getIdentifier()
3123 Diag(
Loc, diag::err_bad_receiver_type) << ReceiverType << RecRange;
3137diag::err_messaging_unqualified_id_with_direct_method);
3149diag::err_messaging_class_with_direct_method);
3162 Diag(SuperLoc, diag::err_messaging_super_with_direct_method);
3173}
else if(ReceiverType->
isObjCIdType() && !isImplicit) {
3174 Diag(Receiver->
getExprLoc(), diag::warn_messaging_unqualified_id);
3177 if(DIFunctionScopeInfo &&
3180 boolisDesignatedInitChain =
false;
3187 if(!ID->declaresOrInheritsDesignatedInitializers() ||
3188ID->isDesignatedInitializer(Sel)) {
3189isDesignatedInitChain =
true;
3195 if(!isDesignatedInitChain) {
3198assert(CurMD &&
"Current method declaration should not be null");
3200CurMD->isDesignatedInitializerForTheInterface(&InitMethod);
3201assert(isDesignated && InitMethod);
3204diag::warn_objc_designated_init_non_designated_init_call :
3205diag::warn_objc_designated_init_non_super_designated_init_call);
3207diag::note_objc_designated_init_marked_here);
3211 if(DIFunctionScopeInfo &&
3215 Diag(SelLoc, diag::warn_objc_secondary_init_super_init_call);
3222 unsignedNumArgs = ArgsIn.size();
3223 Expr**Args = ArgsIn.data();
3230Method, ClassMessage, SuperLoc.
isValid(),
3231LBracLoc, RBracLoc, RecRange, ReturnType, VK))
3237diag::err_illegal_message_expr_incomplete_type))
3266 Diag(SelLoc, diag::err_arc_illegal_explicit_message)
3271 if(Method && NumArgs >= 1) {
3272 if(
const auto*SelExp =
3273dyn_cast<ObjCSelectorExpr>(Args[0]->IgnoreParens())) {
3274 SelectorArgSel = SelExp->getSelector();
3277SelExp->getSourceRange());
3281SelExp->getSourceRange());
3284 switch(SelFamily) {
3291 if(!SelMethod->
hasAttr<NSReturnsNotRetainedAttr>()) {
3294diag::err_arc_perform_selector_retains);
3301 if(SelMethod->
hasAttr<NSReturnsRetainedAttr>()) {
3304diag::err_arc_perform_selector_retains);
3313 Diag(SelLoc, diag::warn_arc_perform_selector_leaks);
3314 Diag(Args[0]->getExprLoc(), diag::note_used_here);
3327Context, ReturnType, VK, LBracLoc, SuperLoc,
true,
3328ReceiverType, Sel, SelectorLocs, Method,
ArrayRef(Args, NumArgs),
3329RBracLoc, isImplicit);
3332Context, ReturnType, VK, LBracLoc, Receiver, Sel, SelectorLocs, Method,
3333 ArrayRef(Args, NumArgs), RBracLoc, isImplicit);
3338 boolIsClassObjectCall = ClassMessage;
3345 if(OPT->getObjectType()->isObjCClass()) {
3347IsClassObjectCall =
true;
3355ReceiverType, IsClassObjectCall);
3368 Result->setDelegateInitCall(
true);
3379 if(!isImplicit && Method) {
3386!
getDiagnostics().isIgnored(diag::warn_arc_repeated_use_of_weak,
3403 autoPos = S.ReferencedSelectors.find(Sel);
3404 if(Pos != S.ReferencedSelectors.end() && Pos->second ==
Loc)
3405S.ReferencedSelectors.erase(Pos);
3422 if(isa<ParenListExpr>(Receiver)) {
3426Receiver =
Result.get();
3438 nullptr, LBracLoc, SelectorLocs,
3472 boolisIndirect =
false;
3476 type= ref->getPointeeType();
3483 type= ptr->getPointeeType();
3490}
else if(
const ArrayType*array =
type->getAsArrayTypeUnsafe()) {
3491 type=
QualType(array->getElementType()->getBaseElementTypeUnsafe(), 0);
3499 if(
type->isObjCARCBridgableType())
3504 if(
type->isObjCARCBridgableType())
3525ACCResult merge(ACCResult left, ACCResult right) {
3526 if(left == right)
returnleft;
3527 if(left == ACC_bottom)
returnright;
3528 if(right == ACC_bottom)
returnleft;
3534 classARCCastChecker :
public StmtVisitor<ARCCastChecker, ACCResult> {
3544 return type->isCARCBridgableType();
3550: Context(Context), SourceClass(source), TargetClass(target),
3551Diagnose(diagnose) {}
3554ACCResult Visit(
Expr*e) {
3558ACCResult VisitStmt(
Stmt*
s) {
3563ACCResult VisitExpr(
Expr*e) {
3579ACCResult VisitCastExpr(
CastExpr*e) {
3581 caseCK_NullToPointer:
3585 caseCK_LValueToRValue:
3587 caseCK_CPointerToObjCPointerCast:
3588 caseCK_BlockPointerToObjCPointerCast:
3589 caseCK_AnyPointerToBlockPointerCast:
3604 returnVisit(e->
getRHS());
3610 if(left == ACC_invalid)
returnACC_invalid;
3621ACCResult VisitStmtExpr(
StmtExpr*e) {
3632!
var->hasDefinition(Context) &&
3633 var->getType().isConstQualified()) {
3640 returnACC_plusZero;
3648ACCResult VisitCallExpr(
CallExpr*e) {
3650 if(ACCResult result = checkCallToFunction(fn))
3653 returnsuper::VisitCallExpr(e);
3665 if(fn->
hasAttr<CFReturnsNotRetainedAttr>())
3666 returnACC_plusZero;
3671 if(fn->
hasAttr<CFReturnsRetainedAttr>())
3672 returnDiagnose ? ACC_plusOne
3677 if(builtinID == Builtin::BI__builtin___CFStringMakeConstantString)
3681 if(!fn->
hasAttr<CFAuditedTransferAttr>())
3686 returnDiagnose ? ACC_plusOne
3689 returnACC_plusZero;
3702 returncheckCallToMethod(method);
3706 if(!method)
returnACC_invalid;
3715 if(method->
hasAttr<CFReturnsNotRetainedAttr>())
3716 returnACC_plusZero;
3720 if(method->
hasAttr<CFReturnsRetainedAttr>())
3732 returnACC_plusZero;
3747template<
typenameDiagBuilderT>
3751 Expr*realCast,
const char*bridgeKeyword,
const char*CFBridgeName) {
3767NCE->getAngleBrackets().getEnd());
3771 charPrevChar = *
SM.getCharacterData(range.getBegin().getLocWithOffset(-1));
3775BridgeCall += CFBridgeName;
3782castedE = CCE->getSubExpr();
3789 charPrevChar = *
SM.getCharacterData(range.getBegin().getLocWithOffset(-1));
3793BridgeCall += CFBridgeName;
3795 if(isa<ParenExpr>(castedE)) {
3813std::string castCode =
"(";
3814castCode += bridgeKeyword;
3818NCE->getAngleBrackets().getEnd());
3822std::string castCode =
"(";
3823castCode += bridgeKeyword;
3828 if(isa<ParenExpr>(castedE)) {
3842template<
typenameT>
3849 for(
auto*Redecl : RT->getDecl()->getMostRecentDecl()->redecls()) {
3850 if(
auto*
attr= Redecl->getAttr<
T>())
3861TDNDecl = TD->getDecl();
3862 if(ObjCBridgeRelatedAttr *ObjCBAttr =
3863getObjCBridgeAttr<ObjCBridgeRelatedAttr>(TD))
3880UnavailableAttr::IR_ARCForbiddenConversion))
3893 unsignedsrcKind = 0;
3917S.
Diag(loc, diag::err_arc_cast_requires_bridge)
3926ACCResult CreateRule =
3927ARCCastChecker(S.
Context, exprACTC, castACTC,
true).Visit(
castExpr);
3928assert(CreateRule != ACC_bottom &&
"This cast should already be accepted.");
3929 if(CreateRule != ACC_plusOne)
3932? S.
Diag(noteLoc, diag::note_arc_bridge)
3933: S.
Diag(noteLoc, diag::note_arc_cstyle_bridge);
3936castType,
castExpr, realCast,
"__bridge ",
3939 if(CreateRule != ACC_plusZero)
3942? S.
Diag(noteLoc, diag::note_arc_cstyle_bridge_transfer)
3945diag::note_arc_bridge_transfer)
3946<< castExprType << br;
3949castType,
castExpr, realCast,
"__bridge_transfer ",
3950br ?
"CFBridgingRelease":
nullptr);
3959S.
Diag(loc, diag::err_arc_cast_requires_bridge)
3967ACCResult CreateRule =
3968ARCCastChecker(S.
Context, exprACTC, castACTC,
true).Visit(
castExpr);
3969assert(CreateRule != ACC_bottom &&
"This cast should already be accepted.");
3970 if(CreateRule != ACC_plusOne)
3973? S.
Diag(noteLoc, diag::note_arc_bridge)
3974: S.
Diag(noteLoc, diag::note_arc_cstyle_bridge);
3976castType,
castExpr, realCast,
"__bridge ",
3979 if(CreateRule != ACC_plusZero)
3982? S.
Diag(noteLoc, diag::note_arc_cstyle_bridge_retained)
3985diag::note_arc_bridge_retained)
3989castType,
castExpr, realCast,
"__bridge_retained ",
3990br ?
"CFBridgingRetain":
nullptr);
3996S.
Diag(loc, diag::err_arc_mismatched_cast)
3998<< srcKind << castExprType << castType
3999<< castRange <<
castExpr->getSourceRange();
4002template<
typenameTB>
4004 bool&HadTheAttribute,
boolwarn) {
4006HadTheAttribute =
false;
4009 if(TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
4011HadTheAttribute =
true;
4012 if(Parm->isStr(
"id"))
4025= InterfacePointerType->getObjectType()->getInterface();
4026 if((CastClass == ExprClass) ||
4030S.
Diag(
castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge)
4035castType, ExprClass)))
4042S.
Diag(
castExpr->getBeginLoc(), diag::warn_objc_invalid_bridge)
4043<<
T<<
Target->getName() << castType;
4045S.
Diag(
Target->getBeginLoc(), diag::note_declared_at);
4052diag::err_objc_cf_bridged_not_interface)
4065template<
typenameTB>
4067 bool&HadTheAttribute,
boolwarn) {
4069HadTheAttribute =
false;
4072 if(TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
4074HadTheAttribute =
true;
4075 if(Parm->isStr(
"id"))
4087 castExpr->getType()->getAsObjCInterfacePointerType()) {
4089= InterfacePointerType->getObjectType()->getInterface();
4090 if((CastClass == ExprClass) ||
4095diag::warn_objc_invalid_bridge_to_cf)
4096<<
castExpr->getType()->getPointeeType() <<
T;
4100}
else if(
castExpr->getType()->isObjCIdType() ||
4110diag::warn_objc_invalid_bridge_to_cf)
4111<<
castExpr->getType() << castType;
4113S.
Diag(
Target->getBeginLoc(), diag::note_declared_at);
4120diag::err_objc_ns_bridged_invalid_cfobject)
4121<<
castExpr->getType() << castType;
4124S.
Diag(
Target->getBeginLoc(), diag::note_declared_at);
4141 boolHasObjCBridgeAttr;
4142 boolObjCBridgeAttrWillNotWarn = CheckObjCBridgeNSCast<ObjCBridgeAttr>(
4144 if(ObjCBridgeAttrWillNotWarn && HasObjCBridgeAttr)
4146 boolHasObjCBridgeMutableAttr;
4147 boolObjCBridgeMutableAttrWillNotWarn =
4148CheckObjCBridgeNSCast<ObjCBridgeMutableAttr>(
4150 if(ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
4153 if(HasObjCBridgeAttr)
4155HasObjCBridgeAttr,
true);
4156 else if(HasObjCBridgeMutableAttr)
4157CheckObjCBridgeNSCast<ObjCBridgeMutableAttr>(
4161 boolHasObjCBridgeAttr;
4162 boolObjCBridgeAttrWillNotWarn = CheckObjCBridgeCFCast<ObjCBridgeAttr>(
4164 if(ObjCBridgeAttrWillNotWarn && HasObjCBridgeAttr)
4166 boolHasObjCBridgeMutableAttr;
4167 boolObjCBridgeMutableAttrWillNotWarn =
4168CheckObjCBridgeCFCast<ObjCBridgeMutableAttr>(
4170 if(ObjCBridgeMutableAttrWillNotWarn && HasObjCBridgeMutableAttr)
4173 if(HasObjCBridgeAttr)
4175HasObjCBridgeAttr,
true);
4176 else if(HasObjCBridgeMutableAttr)
4177CheckObjCBridgeCFCast<ObjCBridgeMutableAttr>(
4185 if(PRE->isExplicitProperty()) {
4187SrcType = PDecl->getType();
4189 else if(PRE->isImplicitProperty()) {
4191SrcType = Getter->getReturnType();
4214: CK_CPointerToObjCPointerCast;
4226 QualType T= CfToNs ? SrcType : DestType;
4242 Diag(
Loc, diag::err_objc_bridged_related_invalid_class) << RCId
4243<< SrcType << DestType;
4250RelatedClass = cast<ObjCInterfaceDecl>(
Target);
4253 Diag(
Loc, diag::err_objc_bridged_related_invalid_class_name) << RCId
4254<< SrcType << DestType;
4257 Diag(
Target->getBeginLoc(), diag::note_declared_at);
4263 if(CfToNs && CMId) {
4265ClassMethod = RelatedClass->
lookupMethod(Sel,
false);
4268 Diag(
Loc, diag::err_objc_bridged_related_known_method)
4269<< SrcType << DestType << Sel <<
false;
4277 if(!CfToNs && IMId) {
4279InstanceMethod = RelatedClass->
lookupMethod(Sel,
true);
4280 if(!InstanceMethod) {
4282 Diag(
Loc, diag::err_objc_bridged_related_known_method)
4283<< SrcType << DestType << Sel <<
true;
4302 if(!CfToNs && !NsToCf)
4310ClassMethod, InstanceMethod, TDNDecl,
4318std::string ExpressionString =
"[";
4320ExpressionString +=
" ";
4321ExpressionString += ClassMethod->getSelector().getAsString();
4325 Diag(
Loc, diag::err_objc_bridged_related_known_method)
4326<< SrcType << DestType << ClassMethod->getSelector() <<
false 4335 Expr*args[] = { SrcExpr };
4337ClassMethod->getLocation(),
4338ClassMethod->getSelector(), ClassMethod,
4340SrcExpr = msg.
get();
4347 if(InstanceMethod) {
4349std::string ExpressionString;
4352 if(InstanceMethod->isPropertyAccessor())
4354InstanceMethod->findPropertyDecl()) {
4356ExpressionString =
".";
4357ExpressionString += PDecl->getNameAsString();
4358 Diag(
Loc, diag::err_objc_bridged_related_known_method)
4359<< SrcType << DestType << InstanceMethod->getSelector() <<
true 4362 if(ExpressionString.empty()) {
4364ExpressionString =
" ";
4365ExpressionString += InstanceMethod->getSelector().getAsString();
4366ExpressionString +=
"]";
4368 Diag(
Loc, diag::err_objc_bridged_related_known_method)
4369<< SrcType << DestType << InstanceMethod->getSelector() <<
true 4377SrcExpr, SrcType, InstanceMethod->getLocation(),
4378InstanceMethod->getSelector(), InstanceMethod, {});
4379SrcExpr = msg.
get();
4390 boolDiagnose,
boolDiagnoseCFAudited,
4403 if(exprACTC == castACTC) {
4409castType != castExprType) {
4415 if(
const ParenType*PT = dyn_cast<ParenType>(DT))
4416QDT = PT->desugar();
4417 else if(
const TypeOfType*TP = dyn_cast<TypeOfType>(DT))
4418QDT = TP->desugar();
4419 else if(
const AttributedType*AT = dyn_cast<AttributedType>(DT))
4420QDT = AT->desugar();
4421 if(QDT != castType &&
4426 Diag(loc, diag::err_arc_nolifetime_behavior);
4460 switch(ARCCastChecker(Context, exprACTC, castACTC,
false).Visit(
castExpr)) {
4473CK_ARCConsumeObject,
castExpr,
nullptr,
4500(Opc == BO_NE || Opc == BO_EQ))) {
4522castType =
cast->getTypeAsWritten();
4525castRange =
cast->getTypeInfoAsWritten()->getTypeLoc().getSourceRange();
4526castType =
cast->getTypeAsWritten();
4529llvm_unreachable(
"Unexpected ImplicitCastExpr");
4548 if(
ParenExpr*pe = dyn_cast<ParenExpr>(e)) {
4550 return new(Context)
ParenExpr(pe->getLParen(), pe->getRParen(), sub);
4551}
else if(
UnaryOperator*uo = dyn_cast<UnaryOperator>(e)) {
4552assert(uo->getOpcode() == UO_Extension);
4556uo->getOperatorLoc(),
false,
4559assert(!gse->isResultDependent());
4560assert(!gse->isTypePredicate());
4562 unsignedn = gse->getNumAssocs();
4565subExprs.reserve(n);
4566subTypes.reserve(n);
4568subTypes.push_back(assoc.getTypeSourceInfo());
4569 Expr*sub = assoc.getAssociationExpr();
4570 if(assoc.isSelected())
4572subExprs.push_back(sub);
4576Context, gse->getGenericLoc(), gse->getControllingExpr(), subTypes,
4577subExprs, gse->getDefaultLoc(), gse->getRParenLoc(),
4578gse->containsUnexpandedParameterPack(), gse->getResultIndex());
4580assert(isa<ImplicitCastExpr>(e) &&
"bad form of unbridged cast!");
4581 returncast<ImplicitCastExpr>(e)->getSubExpr();
4592 if(isa<ObjCObjectPointerType>(canCastType) &&
4598 return!ObjI->isArcWeakrefUnavailable();
4605 Expr*curExpr = e, *prevExpr =
nullptr;
4610 if(
auto*pe = dyn_cast<ParenExpr>(curExpr)) {
4612curExpr = pe->getSubExpr();
4616 if(
auto*ce = dyn_cast<CastExpr>(curExpr)) {
4617 if(
auto*ice = dyn_cast<ImplicitCastExpr>(ce))
4618 if(ice->getCastKind() == CK_ARCReclaimReturnedObject) {
4620 returnice->getSubExpr();
4621 if(
auto*pe = dyn_cast<ParenExpr>(prevExpr))
4622pe->setSubExpr(ice->getSubExpr());
4624cast<CastExpr>(prevExpr)->setSubExpr(ice->getSubExpr());
4629curExpr = ce->getSubExpr();
4648SubExpr = SubResult.
get();
4655 boolMustConsume =
false;
4662: CK_CPointerToObjCPointerCast);
4669 Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
4676 Diag(BridgeKeywordLoc, diag::note_arc_bridge)
4678 Diag(BridgeKeywordLoc, diag::note_arc_bridge_transfer)
4681br ?
"CFBridgingRelease " 4682:
"__bridge_transfer ");
4690MustConsume =
true;
4712 Diag(BridgeKeywordLoc, diag::err_arc_bridge_cast_wrong_kind)
4720 Diag(BridgeKeywordLoc, diag::note_arc_bridge)
4722 Diag(BridgeKeywordLoc, diag::note_arc_bridge_retained)
4725br ?
"CFBridgingRetain ":
"__bridge_retained");
4732 Diag(LParenLoc, diag::err_arc_bridge_cast_incompatible)
4733<< FromType <<
T<< Kind
4790 if(Lookup.
empty())
4791LookForIvars =
true;
4792 else if(IsClassMethod)
4793LookForIvars =
false;
4804 if(IsClassMethod) {
4825 Diag(
Loc, diag::warn_ivar_use_hidden) << IV->getDeclName();
4833 Diag(
Loc, diag::err_ivar_use_in_class_method) << IV->getDeclName();
4844 boolAllowBuiltinCreation) {
4851cast<ObjCIvarDecl>(Ivar.
get()));
4853 if(Lookup.
empty() && II && AllowBuiltinCreation)
4865 "should not reference ivar from this context");
4868assert(IFace &&
"should not reference ivar from this context");
4933CK_CPointerToObjCPointerCast);
4939CK_CPointerToObjCPointerCast);
4946CK_CPointerToObjCPointerCast);
4952CK_CPointerToObjCPointerCast);
5000RHSOPT->isObjCQualifiedIdType()) &&
5011 Diag(QuestionLoc, diag::ext_typecheck_cond_incompatible_operands)
5022 returncompositeType;
5029 Diag(QuestionLoc, diag::err_cond_voidptr_arc)
5050 Diag(QuestionLoc, diag::err_cond_voidptr_arc)
5085 if(OV->getSourceExpr())
5088 if(
auto*SL = dyn_cast<StringLiteral>(SrcExpr)) {
5089 if(!PT->
isObjCIdType() && !(ID && ID->getIdentifier()->isStr(
"NSString")))
5091 if(!SL->isOrdinary())
5095 Diag(SL->getBeginLoc(), diag::err_missing_atsign_prefix)
5102 if((isa<IntegerLiteral>(SrcExpr) || isa<CharacterLiteral>(SrcExpr) ||
5103isa<FloatingLiteral>(SrcExpr) || isa<ObjCBoolLiteralExpr>(SrcExpr) ||
5104isa<CXXBoolLiteralExpr>(SrcExpr)) &&
5107 if(!ID || !ID->getIdentifier()->isStr(
"NSNumber"))
5127assert((Kind == tok::kw___objc_yes || Kind == tok::kw___objc_no) &&
5128 "Unknown Objective-C Boolean value!");
5135 Result.isSingleResult()) {
5143 return new(Context)
5151 autoFindSpecVersion =
5152[&](StringRef Platform) -> std::optional<VersionTuple> {
5158 if(Spec == AvailSpecs.end() && Platform ==
"maccatalyst") {
5163 if(Spec == AvailSpecs.end())
5164 returnstd::nullopt;
5168VersionTuple Version;
5169 if(
autoMaybeVersion =
5171Version = *MaybeVersion;
5176Context->HasPotentialAvailabilityViolations =
true;
5178 return new(Context)
5186 if(
type->isObjCObjectPointerType()) {
5188}
else if(
type->isBlockPointerType()) {
5190 returnCK_BlockPointerToObjCPointerCast;
5192assert(
type->isPointerType());
5193 returnCK_CPointerToObjCPointerCast;
5202 caseStmt::ObjCStringLiteralClass:
5205 caseStmt::ObjCArrayLiteralClass:
5208 caseStmt::ObjCDictionaryLiteralClass:
5211 caseStmt::BlockExprClass:
5213 caseStmt::ObjCBoxedExprClass: {
5214 Expr*Inner = cast<ObjCBoxedExpr>(FromE)->getSubExpr()->IgnoreParens();
5215 switch(Inner->getStmtClass()) {
5216 caseStmt::IntegerLiteralClass:
5217 caseStmt::FloatingLiteralClass:
5218 caseStmt::CharacterLiteralClass:
5219 caseStmt::ObjCBoolLiteralExprClass:
5220 caseStmt::CXXBoolLiteralExprClass:
5223 caseStmt::ImplicitCastExprClass: {
5224 CastKindCK = cast<CastExpr>(Inner)->getCastKind();
5226 if(CK == CK_IntegralToBoolean || CK == CK_IntegralCast)
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 ObjCMethodDecl * getNSNumberFactoryMethod(SemaObjC &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 QualType stripObjCInstanceType(ASTContext &Context, QualType T)
static void diagnoseObjCARCConversion(Sema &S, SourceRange castRange, QualType castType, ARCConversionTypeClass castACTC, Expr *castExpr, Expr *realCast, ARCConversionTypeClass exprACTC, CheckedConversionKind CCK)
static ObjCInterfaceDecl * LookupObjCInterfaceDeclForLiteral(Sema &S, SourceLocation Loc, SemaObjC::ObjCLiteralKind LiteralKind)
Looks up ObjCInterfaceDecl of a given NSClassIdKindKind.
static ObjCMethodDecl * findMethodInCurrentClass(Sema &S, Selector Sel)
static void checkCocoaAPI(Sema &S, const ObjCMessageExpr *Msg)
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 bool ValidateObjCLiteralInterfaceDecl(Sema &S, ObjCInterfaceDecl *Decl, SourceLocation Loc, SemaObjC::ObjCLiteralKind LiteralKind)
Validates ObjCInterfaceDecl availability.
static NSAPI::NSClassIdKindKind ClassKindFromLiteralKind(SemaObjC::ObjCLiteralKind LiteralKind)
Maps ObjCLiteralKind to NSClassIdKindKind.
static bool isAnyCLike(ARCConversionTypeClass ACTC)
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)
static void RemoveSelectorFromWarningCache(SemaObjC &S, Expr *Arg)
@ 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 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 void checkFoundationAPI(Sema &S, SourceLocation Loc, const ObjCMethodDecl *Method, ArrayRef< Expr * > Args, QualType ReceiverType, bool IsClassObjectCall)
static void addFixitForObjCARCConversion(Sema &S, DiagBuilderT &DiagB, CheckedConversionKind CCK, SourceLocation afterLParen, QualType castType, Expr *castExpr, Expr *realCast, const char *bridgeKeyword, const char *CFBridgeName)
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.
This file declares semantic analysis for Objective-C.
static QualType getPointeeType(const MemRegion *R)
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
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
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)
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
QualType getObjCSelRedefinitionType() const
Retrieve the type that 'SEL' has been defined to, which may be different from the built-in 'SEL' if '...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
bool isObjCSelType(QualType T) const
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
TypedefDecl * getBOOLDecl() const
Retrieve declaration of 'BOOL' typedef.
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
void setBOOLDecl(TypedefDecl *TD)
Save declaration of 'BOOL' typedef.
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.
QualType getBOOLType() const
type of 'BOOL' type.
CanQualType PseudoObjectTy
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
CanQualType ObjCBuiltinBoolTy
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.
QualType getObjCClassRedefinitionType() const
Retrieve the type that Class has been defined to, which may be different from the built-in Class if C...
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
QualType getObjCConstantStringInterface() const
QualType getObjCIdRedefinitionType() const
Retrieve the type that id has been defined to, which may be different from the built-in id if id has ...
const TargetInfo & getTargetInfo() 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 std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
One specifier in an @available expression.
StringRef getPlatform() const
VersionTuple getVersion() const
A builtin binary operation expression such as "x + y" or "x <= y".
Represents a block literal declaration, which is like an unnamed FunctionDecl.
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.
Represents a C++ nested-name-specifier or a global scope specifier.
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.
const BlockDecl * getInnermostBlockDecl() const
Return this DeclContext if it is a BlockDecl.
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
bool isDefinedOutsideFunctionOrMethod() const
isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...
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_NeverValueDependent
Specifies that the expression should never be value-dependent.
@ 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.
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.
bool empty() const
Return true if no decls were found.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
@ 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)
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
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, const 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.
AccessControl getAccessControl() const
QualType getUsageType(QualType objectType) const
Retrieve the type of this instance variable when viewed as a member of a specific object type.
ObjCIvarRefExpr - A reference to 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.
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.
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs={})
Sets the method's parameters and selector source locations.
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
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.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
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.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
ParenExpr - This represents a parenthesized 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, const 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 getQualifiers() const
Retrieve the set of qualifiers applied to this 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...
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 getNullarySelector(const IdentifierInfo *ID)
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Selector getUnarySelector(const 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
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ASTContext & getASTContext() const
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
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 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.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
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 ...
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 BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
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)
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
ExprResult ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void CheckObjCCircularContainer(ObjCMessageExpr *Message)
Check whether receiver is mutable ObjC container which attempts to add itself into the container.
ObjCInterfaceDecl * getObjCInterfaceDecl(const IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
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.
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
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.
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
QualType QIDNSCopying
id<NSCopying> type.
bool CheckObjCString(Expr *Arg)
CheckObjCString - Checks that the argument to the builtin CFString constructor is correct Note: It mi...
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
ExprResult ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, bool Value)
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
QualType NSStringPointer
Pointer to NSString type (NSString *).
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Find the protocol with the given name, if any.
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
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 ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
@ ObjCInstanceMessage
The message is an instance message.
@ ObjCSuperMessage
The message is sent to 'super'.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
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.
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, ArrayRef< const Expr * > Args)
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
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.
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
bool isKnownName(StringRef name)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Sema - This implements semantic analysis and AST building for C.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
Scope * getCurScope() const
Retrieve the parser's current scope.
@ 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...
bool FormatStringHasSArg(const StringLiteral *FExpr)
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
FPOptionsOverride CurFPFeatureOverrides()
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
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...
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ASTContext & getASTContext() const
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 ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
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.
const LangOptions & LangOpts
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
sema::FunctionScopeInfo * getCurFunction() const
ExprResult DefaultLvalueConversion(Expr *E)
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 isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
ObjCMethodDecl * SelectBestMethod(Selector Sel, MultiExprArg Args, bool IsInstance, SmallVectorImpl< ObjCMethodDecl * > &Methods)
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const
If AllowLambda is true, treat lambda as function.
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
SourceManager & getSourceManager() const
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
sema::FunctionScopeInfo * getCurFunctionAvailabilityContext()
Retrieve the current function, if any, that should be analyzed for potential availability violations.
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.
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...
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
SourceManager & SourceMgr
DiagnosticsEngine & Diags
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
ExprResult ActOnIntegerConstant(SourceLocation Loc, int64_t Val)
sema::FunctionScopeInfo * getEnclosingFunction() const
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)
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType ¶mType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
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
StmtClass getStmtClass() const
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
StringRef getPlatformName() const
Retrieve the name of the platform as it is used in the availability attribute.
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 isObjCBuiltinType() const
bool isVoidPointerType() 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.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
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)
Represents a C++ unqualified-id that has been parsed.
void setImplicitSelfParam(const IdentifierInfo *Id)
Specify that this unqualified-id is an implicit 'self' parameter.
void setType(QualType newType)
Represents a variable declaration or definition.
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...
Defines the clang::TargetInfo interface.
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.
constexpr Variable var(Literal L)
Returns the variable of L.
uint32_t Literal
Literals are represented as positive integers.
bool rewriteObjCRedundantCallWithLiteral(const ObjCMessageExpr *Msg, const NSAPI &NS, Commit &commit)
bool followsCreateRule(const FunctionDecl *FD)
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
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...
@ Seq
'seq' clause, allowed on 'loop' and 'routine' directives.
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.
ActionResult< Expr * > ExprResult
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.
const FunctionProtoType * T
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
ActionResult< Decl * > DeclResult
U cast(CodeGen::Address addr)
@ None
The alignment was not explicit in code.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
CheckedConversionKind
The kind of conversion being performed.
@ Implicit
An implicit conversion.
@ CStyleCast
A C-style cast.
@ ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
@ OtherCast
A cast other than a C-style cast.
@ FunctionalCast
A functional-style cast.
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
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4