;
64assert(resultClass &&
"unexpected object type!");
69 if(receiverTypeIfCall.
isNull() &&
79 if(receiverTypeIfCall.
isNull())
86 if(!receiverClass)
return false;
89assert(receiverClass &&
"method not associated with a class!");
103 if(receiverTypeIfCall.
isNull() &&
105method->
addAttr(UnavailableAttr::CreateImplicit(Context,
"",
106UnavailableAttr::IR_ARCInitReturnsUnrelated, loc));
111 Diag(loc, diag::err_arc_init_method_unrelated_result_type);
120 if(OldD->
hasAttr<NoEscapeAttr>() && !NewD->
hasAttr<NoEscapeAttr>()) {
121S.
Diag(NewD->
getLocation(), diag::warn_overriding_method_missing_noescape);
122S.
Diag(OldD->
getLocation(), diag::note_overridden_marked_noescape);
158CurrentClass = Cat->getClassInterface();
159 else if(
ObjCImplDecl*Impl = dyn_cast<ObjCImplDecl>(DC))
160CurrentClass = Impl->getClassInterface();
162= dyn_cast<ObjCCategoryImplDecl>(DC))
163CurrentClass = CatImpl->getClassInterface();
168diag::warn_related_result_type_compatibility_class)
174diag::warn_related_result_type_compatibility_protocol)
181diag::note_related_result_type_family)
186diag::note_related_result_type_overridden);
189 if((NewMethod->
hasAttr<NSReturnsRetainedAttr>() !=
190Overridden->
hasAttr<NSReturnsRetainedAttr>())) {
193? diag::err_nsreturns_retained_attribute_mismatch
194: diag::warn_nsreturns_retained_attribute_mismatch)
196 Diag(Overridden->
getLocation(), diag::note_previous_decl) <<
"method";
198 if((NewMethod->
hasAttr<NSReturnsNotRetainedAttr>() !=
199Overridden->
hasAttr<NSReturnsNotRetainedAttr>())) {
202? diag::err_nsreturns_retained_attribute_mismatch
203: diag::warn_nsreturns_retained_attribute_mismatch)
205 Diag(Overridden->
getLocation(), diag::note_previous_decl) <<
"method";
212ni != ne && oi != oe; ++ni, ++oi) {
215 if(newDecl->
hasAttr<NSConsumedAttr>() !=
216oldDecl->
hasAttr<NSConsumedAttr>()) {
219? diag::err_nsconsumed_attribute_mismatch
220: diag::warn_nsconsumed_attribute_mismatch);
221 Diag(oldDecl->
getLocation(), diag::note_previous_decl) <<
"parameter";
265method->
addAttr(NSConsumesSelfAttr::CreateImplicit(Context));
269 if(method->
hasAttr<NSReturnsRetainedAttr>())
277 if(method->
hasAttr<NSReturnsRetainedAttr>() ||
278method->
hasAttr<NSReturnsNotRetainedAttr>() ||
279method->
hasAttr<NSReturnsAutoreleasedAttr>())
284method->
addAttr(NSReturnsRetainedAttr::CreateImplicit(Context));
292 boolIsCategory =
false;
293StringRef RealizedPlatform;
295 nullptr,
VersionTuple(),
298 if(isa<ObjCMethodDecl>(ND)) {
301 if(RealizedPlatform.empty())
305 if(RealizedPlatform.ends_with(
"_app_extension"))
307S.
Diag(ImplLoc, diag::warn_unavailable_def);
312 if(
const auto*CD = dyn_cast<ObjCCategoryDecl>(ND)) {
313 if(!CD->getClassInterface()->isDeprecated())
315ND = CD->getClassInterface();
320S.
Diag(ImplLoc, diag::warn_deprecated_def)
321<< (isa<ObjCMethodDecl>(ND)
323: isa<ObjCCategoryDecl>(ND) || IsCategory ?
2
325 if(isa<ObjCMethodDecl>(ND))
330<< (isa<ObjCCategoryDecl>(ND) ?
"category":
"class");
363 return!
T.getLocalQualifiers().hasObjCLifetime();
385diag::err_func_def_incomplete_result))
407 if(!Param->isInvalidDecl() &&
getLangOpts().ObjCAutoRefCount &&
409 Diag(Param->getLocation(), diag::warn_arc_strong_pointer_objc_pointer) <<
412 if(Param->getIdentifier())
455ImplDeclOfMethodDecl = OID->getImplementation();
456 else if(
ObjCCategoryDecl*CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl)) {
457 if(CD->IsClassExtension()) {
459ImplDeclOfMethodDecl = OID->getImplementation();
461ImplDeclOfMethodDecl = CD->getImplementation();
465 if(!ImplDeclOfMethodDecl || ImplDeclOfMethodDecl != ImplDeclOfMethodDef)
473IC->getSuperClass() !=
nullptr;
474}
else if(IC->hasDesignatedInitializers()) {
500(SuperMethod && SuperMethod->
hasAttr<ObjCRequiresSuperAttr>());
517ObjCInterfaceValidatorCCC() : CurrentIDecl(nullptr) {}
519: CurrentIDecl(IDecl) {}
521 boolValidateCandidate(
const TypoCorrection&candidate)
override{
526std::unique_ptr<CorrectionCandidateCallback> clone()
override{
527 returnstd::make_unique<ObjCInterfaceValidatorCCC>(*
this);
539 unsignedNumProtoRefs,
544 for(
unsignedi = 0; i < NumProtoRefs; ++i) {
565ObjCInterfaceValidatorCCC CCC(IDecl);
570<< SuperName << ClassName);
576 Diag(SuperLoc, diag::err_recursive_superclass)
577<< SuperName << ClassName <<
SourceRange(AtInterfaceLoc, ClassLoc);
581dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
585 if(SuperClassDecl) {
590 if(PrevDecl && !SuperClassDecl) {
594dyn_cast_or_null<TypedefNameDecl>(PrevDecl)) {
598SuperClassDecl = dyn_cast<ObjCInterfaceDecl>(IDecl);
616 if(!SuperClassDecl) {
617 Diag(SuperLoc, diag::err_redefinition_different_kind) << SuperName;
622 if(!isa_and_nonnull<TypedefNameDecl>(PrevDecl)) {
624 Diag(SuperLoc, diag::err_undef_superclass)
625<< SuperName << ClassName <<
SourceRange(AtInterfaceLoc, ClassLoc);
627SuperLoc, SuperClassType, diag::err_forward_superclass,
630SuperClassDecl =
nullptr;
635 if(SuperClassType.
isNull()) {
636assert(!SuperClassDecl &&
"Failed to set SuperClassType?");
642 if(!SuperTypeArgs.empty()) {
645SuperTypeArgsRange.
getBegin(), SuperTypeArgs,
648 if(!fullSuperClassType.
isUsable())
655 if(!SuperClassTInfo) {
672 if(parsedTypeBound) {
684diag::err_objc_type_param_bound_missing_pointer)
685<< typeBound << paramName
704diag::err_objc_type_param_bound_nonobject)
705<< typeBound << paramName;
708typeBoundInfo =
nullptr;
717 booldiagnosed =
false;
721rangeToRemove =
attr.getLocalSourceRange();
722 if(
attr.getTypePtr()->getImmediateNullability()) {
724diag::err_objc_type_param_bound_explicit_nullability)
725<< paramName << typeBound
735diag::err_objc_type_param_bound_qualified)
736<< paramName << typeBound
746 if(!quals.
empty()) {
756 if(!typeBoundInfo) {
763varianceLoc, index, paramLoc, paramName,
764colonLoc, typeBoundInfo);
776typeParamsIn.size());
782llvm::SmallDenseMap<IdentifierInfo *, ObjCTypeParamDecl *> knownParams;
783 for(
auto*typeParam : typeParams) {
784 autoknown = knownParams.find(typeParam->getIdentifier());
785 if(known != knownParams.end()) {
786 Diag(typeParam->getLocation(), diag::err_objc_type_param_redecl)
787<< typeParam->getIdentifier()
790typeParam->setInvalidDecl();
792knownParams.insert(std::make_pair(typeParam->getIdentifier(), typeParam));
805 for(
auto*typeParam : *typeParamList) {
806 if(!typeParam->isInvalidDecl()) {
807S->RemoveDecl(typeParam);
816 enum classTypeParamListContext {
830TypeParamListContext newContext) {
832 if(prevTypeParams->
size() != newTypeParams->
size()) {
834 if(newTypeParams->
size() > prevTypeParams->
size()) {
840S.
Diag(diagLoc, diag::err_objc_type_param_arity_mismatch)
841<<
static_cast<unsigned>(newContext)
842<< (newTypeParams->
size() > prevTypeParams->
size())
843<< prevTypeParams->
size()
844<< newTypeParams->
size();
850 for(
unsignedi = 0, n = prevTypeParams->
size(); i != n; ++i) {
857newContext != TypeParamListContext::Definition) {
876 autodiag = S.
Diag(diagLoc,
877diag::err_objc_type_param_variance_conflict)
878<<
static_cast<unsigned>(newTypeParam->
getVariance())
880<<
static_cast<unsigned>(prevTypeParam->
getVariance())
889StringRef newVarianceStr
892:
"__contravariant";
896(newVarianceStr +
" ").str());
905S.
Diag(prevTypeParam->
getLocation(), diag::note_objc_type_param_here)
923S.
Diag(newBoundRange.
getBegin(), diag::err_objc_type_param_bound_conflict)
935S.
Diag(prevTypeParam->
getLocation(), diag::note_objc_type_param_here)
947 if(newContext == TypeParamListContext::ForwardDeclaration ||
948newContext == TypeParamListContext::Definition) {
956diag::err_objc_type_param_bound_missing)
959<< (newContext == TypeParamListContext::ForwardDeclaration)
962S.
Diag(prevTypeParam->
getLocation(), diag::note_objc_type_param_here)
978 Decl*
const*ProtoRefs,
unsignedNumProtoRefs,
981assert(ClassName &&
"Missing class identifier");
989 if(PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
990 Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
997 if(PrevIDecl && PrevIDecl->
getIdentifier() != ClassName) {
1017 if(typeParamList) {
1021TypeParamListContext::Definition)) {
1022typeParamList =
nullptr;
1025 Diag(ClassLoc, diag::err_objc_parameterized_forward_class_first)
1027 Diag(prevTypeParamList->getLAngleLoc(), diag::note_previous_decl)
1032 for(
auto*typeParam : *prevTypeParamList) {
1038typeParam->getUnderlyingType())));
1051ClassName, typeParamList, PrevIDecl, ClassLoc);
1057SkipBody->
New= IDecl;
1060 Diag(AtInterfaceLoc, diag::err_duplicate_class_def)
1062 Diag(Def->getLocation(), diag::note_previous_definition);
1090ClassName, ClassLoc,
1091SuperName, SuperLoc, SuperTypeArgs,
1092SuperTypeArgsRange);
1100NumProtoRefs, ProtoLocs);
1102ProtoLocs, Context);
1125 if(
const TypedefNameDecl*TDecl = dyn_cast_or_null<TypedefNameDecl>(IDecl)) {
1126 QualType T= TDecl->getUnderlyingType();
1129ProtocolRefs.append(OPT->qual_begin(), OPT->qual_end());
1134ProtocolLocs.append(OPT->getNumProtocols(), SuperLoc);
1152 Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
1161dyn_cast_or_null<TypedefNameDecl>(CDeclU)) {
1162 QualType T= TDecl->getUnderlyingType();
1165ClassName = IDecl->getIdentifier();
1174 Diag(ClassLocation, diag::warn_undef_interface) << ClassName;
1196 E= PList.
end(); I !=
E; ++I) {
1198 if(PDecl->getIdentifier() == PName) {
1199 Diag(Ploc, diag::err_protocol_has_circular_dependency);
1200 Diag(PrevLoc, diag::note_previous_definition);
1204 if(!PDecl->hasDefinition())
1208PDecl->getLocation(), PDecl->getReferencedProtocols()))
1223assert(ProtocolName &&
"Missing protocol identifier");
1233ProtocolLoc, AtProtoInterfaceLoc,
1238SkipBody->
New= PDecl;
1242 Diag(ProtocolLoc, diag::warn_duplicate_protocol_def) << ProtocolName;
1243 Diag(Def->getLocation(), diag::note_previous_definition);
1258ProtocolName, ProtocolLoc, PrevDecl->
getLocation(), PList);
1263ProtocolLoc, AtProtoInterfaceLoc,
1278 if(!err && NumProtoRefs ) {
1281NumProtoRefs, ProtoLocs);
1283ProtoLocs, Context);
1295UndefinedProtocol = PDecl;
1301UndefinedProtocol = PI;
1311 boolForObjCContainer,
1324 PDiag(diag::err_undeclared_protocol_suggest)
1329 Diag(Pair.second, diag::err_undeclared_protocol) << Pair.first;
1338 if(!ForObjCContainer) {
1347 if(WarnOnDeclarations &&
1349 Diag(Pair.second, diag::warn_undef_protocolref) << Pair.first;
1350 Diag(UndefinedProtocol->
getLocation(), diag::note_protocol_decl_undefined)
1351<< UndefinedProtocol;
1353Protocols.push_back(PDecl);
1360classObjCTypeArgOrProtocolValidatorCCC final
1365ObjCTypeArgOrProtocolValidatorCCC(
ASTContext&context,
1367: Context(context), LookupKind(lookupKind) { }
1369 boolValidateCandidate(
const TypoCorrection&candidate)
override{
1383 if(isa<RecordDecl>(typeDecl) && !Context.
getLangOpts().CPlusPlus)
1389 if(
type->isObjCObjectPointerType() ||
1390 type->isBlockPointerType() ||
1391 type->isDependentType() ||
1392 type->isObjCObjectType())
1409std::unique_ptr<CorrectionCandidateCallback> clone()
override{
1410 returnstd::make_unique<ObjCTypeArgOrProtocolValidatorCCC>(*
this);
1419 boolSelectProtocolFirst) {
1420 Diag(TypeArgLoc, diag::err_objc_type_args_and_protocols)
1421<< SelectProtocolFirst << TypeArgId << ProtocolId
1432 boolwarnOnIncompleteProtocols) {
1436 unsignednumProtocolsResolved = 0;
1437 autoresolvedAsProtocols = [&] {
1438assert(numProtocolsResolved == identifiers.size() &&
"Unresolved protocols");
1445 boolallAreTypeNames =
false;
1449baseClass = objcObjectType->getInterface();
1452 if(typeParams->size() == numProtocolsResolved) {
1454allAreTypeNames =
true;
1461 for(
unsignedi = 0, n = protocols.size(); i != n; ++i) {
1466 if(!warnOnIncompleteProtocols) {
1478 if(warnOnIncompleteProtocols &&
1480 Diag(identifierLocs[i], diag::warn_undef_protocolref)
1482 Diag(forwardDecl->
getLocation(), diag::note_protocol_decl_undefined)
1489 if(allAreTypeNames) {
1493 if(isa<ObjCInterfaceDecl>(
decl)) {
1495firstClassNameLoc = identifierLocs[i];
1496}
else if(!isa<TypeDecl>(
decl)) {
1498allAreTypeNames =
false;
1501allAreTypeNames =
false;
1510 if(allAreTypeNames && firstClassNameLoc.
isValid()) {
1513 boolallProtocolsDeclared =
true;
1514 for(
auto*proto : protocols) {
1515 if(knownProtocols.count(
static_cast<ObjCProtocolDecl*
>(proto)) == 0) {
1516allProtocolsDeclared =
false;
1521 if(allProtocolsDeclared) {
1522 Diag(firstClassNameLoc, diag::warn_objc_redundant_qualified_class_type)
1529protocolLAngleLoc = lAngleLoc;
1530protocolRAngleLoc = rAngleLoc;
1531assert(protocols.size() == identifierLocs.size());
1535 for(
unsignedi = 0, n = identifiers.size(); i != n; ++i) {
1537protocols.push_back(proto);
1539++numProtocolsResolved;
1543 if(numProtocolsResolved == identifiers.size())
1544 returnresolvedAsProtocols();
1550 typedefllvm::PointerUnion<TypeDecl *, ObjCInterfaceDecl *> TypeOrClassDecl;
1552 unsignednumTypeDeclsResolved = 0;
1553 for(
unsignedi = 0, n = identifiers.size(); i != n; ++i) {
1557typeDecls.push_back(TypeOrClassDecl());
1561 if(
autotypeDecl = dyn_cast<TypeDecl>(
decl)) {
1562typeDecls.push_back(typeDecl);
1563++numTypeDeclsResolved;
1567 if(
autoobjcClass = dyn_cast<ObjCInterfaceDecl>(
decl)) {
1568typeDecls.push_back(objcClass);
1569++numTypeDeclsResolved;
1573typeDecls.push_back(TypeOrClassDecl());
1580 autoresolveTypeReference = [&](TypeOrClassDecl typeDecl,
SourceLocationloc)
1584 const char* prevSpec;
1587 if(
auto*actualTypeDecl = typeDecl.dyn_cast<
TypeDecl*>())
1615 Diag(loc, diag::err_objc_type_arg_missing_star)
1626 autoresolvedAsTypeDecls = [&] {
1630assert(numTypeDeclsResolved == identifiers.size() &&
"Unresolved type decl");
1632 for(
unsignedi = 0, n = identifiers.size(); i != n; ++i) {
1634 TypeResult type= resolveTypeReference(typeDecls[i], identifierLocs[i]);
1635 if(!
type.isUsable()) {
1640typeArgs.push_back(
type.get());
1643typeArgsLAngleLoc = lAngleLoc;
1644typeArgsRAngleLoc = rAngleLoc;
1649 if(numTypeDeclsResolved == identifiers.size())
1650 returnresolvedAsTypeDecls();
1656 for(
unsignedi = 0, n = identifiers.size(); i != n; ++i) {
1659 if(protocols[i] || typeDecls[i]) {
1665 if(protocols[i] && typeDecls[i])
1688identifiers[i], identifierLocs[i],
1689protocols[i] !=
nullptr);
1697ObjCTypeArgOrProtocolValidatorCCC CCC(Context, lookupKind);
1705 PDiag(diag::err_undeclared_protocol_suggest)
1708protocols[i] = proto;
1709++numProtocolsResolved;
1716 PDiag(diag::err_unknown_typename_suggest)
1719typeDecls[i] = typeDecl;
1720++numTypeDeclsResolved;
1727 PDiag(diag::err_unknown_type_or_class_name_suggest)
1728<< identifiers[i] <<
true);
1730typeDecls[i] = objcClass;
1731++numTypeDeclsResolved;
1737 Diag(identifierLocs[i],
1740? diag::err_undeclared_protocol
1741: diag::err_unknown_typename))
1750 if(numProtocolsResolved == identifiers.size())
1751 returnresolvedAsProtocols();
1754assert(numTypeDeclsResolved == identifiers.size() &&
"Not all types?");
1755 returnresolvedAsTypeDecls();
1766llvm::DenseMap<Selector, const ObjCMethodDecl*> MethodMap;
1767 for(
auto*MD : ID->methods())
1768MethodMap[MD->getSelector()] = MD;
1770 if(MethodMap.empty())
1772 for(
const auto*Method : CAT->
methods()) {
1773 const ObjCMethodDecl*&PrevMethod = MethodMap[Method->getSelector()];
1777 Diag(Method->getLocation(), diag::err_duplicate_method_decl)
1778<< Method->getDeclName();
1796IdentPair.second, AtProtocolLoc, PrevDecl);
1807DeclsInGroup.push_back(PDecl);
1817 Decl*
const*ProtoRefs,
unsignedNumProtoRefs,
1828diag::err_category_forward_interface,
1829CategoryName ==
nullptr)) {
1834AtInterfaceLoc, ClassLoc, CategoryLoc,
1835CategoryName, IDecl, typeParamList);
1840 Diag(ClassLoc, diag::err_undef_interface) << ClassName;
1846 Diag(ClassLoc, diag::err_class_extension_after_impl) << ClassName;
1848diag::note_implementation_declared);
1856 Diag(CategoryLoc, diag::warn_dup_category_def)
1857<< ClassName << CategoryName;
1858 Diag(
Previous->getLocation(), diag::note_previous_definition);
1863 if(typeParamList) {
1866 SemaRef, prevTypeParamList, typeParamList,
1867CategoryName ? TypeParamListContext::Category
1868: TypeParamListContext::Extension))
1869typeParamList =
nullptr;
1872diag::err_objc_parameterized_category_nonclass)
1873<< (CategoryName !=
nullptr)
1877typeParamList =
nullptr;
1882ClassLoc, CategoryLoc, CategoryName, IDecl,
1895NumProtoRefs, ProtoLocs);
1897ProtoLocs, Context);
1901NumProtoRefs, Context);
1926ClassLoc, CatLoc, CatName, IDecl,
1934ClassLoc, AtCatImplLoc, CatLoc);
1937 Diag(ClassLoc, diag::err_undef_interface) << ClassName;
1941diag::err_undef_interface)) {
1953 if(IDecl && IDecl->
hasAttr<ObjCRuntimeVisibleAttr>()) {
1954 Diag(ClassLoc, diag::err_objc_runtime_visible_category)
1961 Diag(ClassLoc, diag::err_dup_implementation_category) << ClassName
1964diag::note_previous_definition);
1990 if(PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
1991 Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
1993}
else if((IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl))) {
1997diag::warn_undef_interface);
2001ObjCInterfaceValidatorCCC CCC{};
2010Corrected,
PDiag(diag::warn_undef_interface_suggest) << ClassName,
2013 Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
2019 if(SuperClassname) {
2024 if(PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
2025 Diag(SuperClassLoc, diag::err_redefinition_different_kind)
2029SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
2033 Diag(SuperClassLoc, diag::err_undef_superclass)
2034<< SuperClassname << ClassName;
2038 Diag(SuperClassLoc, diag::err_conflicting_super_class)
2053ClassName,
nullptr,
2054 nullptr, ClassLoc,
true);
2077ClassLoc, AtClassImplLoc, SuperClassLoc);
2090 Diag(ClassLoc, diag::err_dup_implementation_class) << ClassName;
2092diag::note_previous_definition);
2106 Diag(ClassLoc, diag::err_objc_runtime_visible_subclass)
2119DeclsInGroup.reserve(Decls.size() + 1);
2121 for(
unsignedi = 0, e = Decls.size(); i != e; ++i) {
2122 Decl*Dcl = Decls[i];
2127DeclsInGroup.push_back(Dcl);
2130DeclsInGroup.push_back(ObjCImpDecl);
2138assert(ImpDecl &&
"missing implementation decl");
2149 for(
unsignedi = 0, e = numIvars; i != e; ++i) {
2166assert(ivars &&
"missing @implementation ivars");
2170 for(
unsignedi = 0; i < numIvars; i++) {
2174 Diag(ImplIvar->
getLocation(), diag::err_duplicate_ivar_declaration);
2175 Diag(ClsIvar->getLocation(), diag::note_previous_definition);
2182 Diag(ImplIvar->
getLocation(), diag::err_duplicate_ivar_declaration);
2183 Diag(ClsExtIvar->getLocation(), diag::note_previous_definition);
2200 for(; numIvars > 0 && IVI != IVE; ++IVI) {
2203assert (ImplIvar &&
"missing implementation ivar");
2204assert (ClsIvar &&
"missing class ivar");
2215diag::err_conflicting_ivar_bitwidth)
2218diag::note_previous_definition);
2230 Diag(ivars[j]->getLocation(), diag::err_inconsistent_ivar_count);
2231 else if(IVI != IVE)
2232 Diag(IVI->getLocation(), diag::err_inconsistent_ivar_count);
2260std::string FixItStr;
2261llvm::raw_string_ostream Out(FixItStr);
2263Out <<
" {\n}\n\n";
2272S.
Diag(MethodLoc, diag::note_method_declared_at) << method;
2348(y &
~Decl::OBJC_TQ_CSNullability);
2354 boolIsProtocolMethodDecl,
2355 boolIsOverridingMode,
2357 if(IsProtocolMethodDecl &&
2363? diag::warn_conflicting_overriding_ret_type_modifiers
2364: diag::warn_conflicting_ret_type_modifiers))
2367S.
Diag(MethodDecl->
getLocation(), diag::note_previous_declaration)
2373 if(Warn && IsOverridingMode &&
2381diag::warn_conflicting_nullability_attr_overriding_ret_types)
2388S.
Diag(MethodDecl->
getLocation(), diag::note_previous_declaration);
2398IsOverridingMode ? diag::warn_conflicting_overriding_ret_types
2399: diag::warn_conflicting_ret_types;
2415IsOverridingMode ? diag::warn_non_covariant_overriding_ret_types
2416: diag::warn_non_covariant_ret_types;
2425? diag::note_previous_declaration
2426: diag::note_previous_definition)
2436 boolIsProtocolMethodDecl,
2437 boolIsOverridingMode,
2439 if(IsProtocolMethodDecl &&
2443 if(IsOverridingMode)
2445diag::warn_conflicting_overriding_param_modifiers)
2449diag::warn_conflicting_param_modifiers)
2461 if(Warn && IsOverridingMode &&
2465diag::warn_conflicting_nullability_attr_overriding_param_types)
2480IsOverridingMode ? diag::warn_conflicting_overriding_param_types
2481: diag::warn_conflicting_param_types;
2497IsOverridingMode ? diag::warn_non_contravariant_overriding_param_types
2498: diag::warn_non_contravariant_param_types;
2504<< MethodImpl->
getDeclName() << IfaceTy << ImplTy;
2506(IsOverridingMode ? diag::note_previous_declaration
2507: diag::note_previous_definition))
2518 if(implFamily == declFamily)
return false;
2530 unsignederrorID = diag::err_arc_lost_method_convention;
2531 unsignednoteID = diag::note_arc_lost_method_convention;
2534family = implFamily;
2535errorID = diag::err_arc_gained_method_convention;
2536noteID = diag::note_arc_gained_method_convention;
2540 enumFamilySelector {
2541F_alloc, F_copy, F_mutableCopy = F_copy, F_init, F_new
2543FamilySelector familySelector = FamilySelector();
2546 case OMF_None: llvm_unreachable(
"logic error, no method convention");
2560 case OMF_init: familySelector = F_init;
break;
2561 case OMF_alloc: familySelector = F_alloc;
break;
2562 case OMF_copy: familySelector = F_copy;
break;
2564 case OMF_new: familySelector = F_new;
break;
2567 enumReasonSelector { R_NonObjectReturn, R_UnrelatedReturn };
2568ReasonSelector reasonSelector;
2573reasonSelector = R_UnrelatedReturn;
2575reasonSelector = R_NonObjectReturn;
2579S.
Diag(
decl->getLocation(), noteID) <<
int(familySelector) <<
int(reasonSelector);
2586 boolIsProtocolMethodDecl) {
2592IsProtocolMethodDecl,
false,
true);
2597IM != EM && IF != EF; ++IM, ++IF) {
2599IsProtocolMethodDecl,
false,
true);
2604diag::warn_conflicting_variadic);
2611 boolIsProtocolMethodDecl) {
2619IM != EM && IF != EF; ++IM, ++IF) {
2621IsProtocolMethodDecl,
true,
true);
2626diag::warn_conflicting_overriding_variadic);
2635 boolIsProtocolMethodDecl) {
2645 if(MethodDecl->
hasAttr<UnavailableAttr>() ||
2646MethodDecl->
hasAttr<DeprecatedAttr>())
2650IsProtocolMethodDecl,
false,
false);
2655IM != EM && IF != EF; ++IM, ++IF) {
2657*IF, IsProtocolMethodDecl,
false,
false);
2669diag::warn_category_method_impl_match);
2686 if(PDecl->
hasAttr<ObjCExplicitProtocolImplAttr>())
2688 for(
const auto*PI : PDecl->
protocols())
2714: dyn_cast<ObjCInterfaceDecl>(CDecl);
2715assert (IDecl &&
"CheckProtocolMethodDefs - IDecl is null");
2731 if(PDecl->
hasAttr<ObjCExplicitProtocolImplAttr>()) {
2732 if(!ProtocolsExplictImpl) {
2736 if(ProtocolsExplictImpl->contains(PDecl->
getIdentifier()))
2754 if(InsMap.count(fISelector))
2773 if(method->getImplementationControl() !=
2775!method->isPropertyAccessor() &&
2776!InsMap.count(method->getSelector()) &&
2778method->getSelector(),
true,
2791method->getSelector(),
true,
2793 if(
C|| MethodInClass->isPropertyAccessor())
2795 unsigned DIAG= diag::warn_unimplemented_protocol_method;
2803 if(method->getImplementationControl() !=
2805!ClsMap.count(method->getSelector()) &&
2807method->getSelector(),
false,
2809 true,
nullptr))) {
2817 unsigned DIAG= diag::warn_unimplemented_protocol_method;
2826ProtocolsExplictImpl);
2836 boolWarnCategoryMethodImpl) {
2840 if(!InsMapSeen.insert(I->getSelector()).second)
2842 if(!I->isPropertyAccessor() &&
2843!InsMap.count(I->getSelector())) {
2846diag::warn_undef_method_impl);
2852 "Expected to find the method through lookup as well");
2854 if(ImpMethodDecl) {
2858 if(!WarnCategoryMethodImpl)
2860isa<ObjCProtocolDecl>(CDecl));
2861 else if(!I->isPropertyAccessor())
2870 if(!ClsMapSeen.insert(I->getSelector()).second)
2872 if(!I->isPropertyAccessor() &&
2873!ClsMap.count(I->getSelector())) {
2876diag::warn_undef_method_impl);
2881 "Expected to find the method through lookup as well");
2883 if(ImpMethodDecl) {
2887 if(!WarnCategoryMethodImpl)
2889isa<ObjCProtocolDecl>(CDecl));
2890 else if(!I->isPropertyAccessor())
2899 for(
auto*PI : PD->protocols())
2901IMPDecl, PI, IncompleteImpl,
false,
2902WarnCategoryMethodImpl);
2909 if(!WarnCategoryMethodImpl) {
2910 for(
auto*Cat : I->visible_categories())
2912IMPDecl, Cat, IncompleteImpl,
2913ImmediateClass && Cat->IsClassExtension(),
2914WarnCategoryMethodImpl);
2917 for(
auto*Ext : I->visible_extensions())
2919IMPDecl, Ext, IncompleteImpl,
false,
2920WarnCategoryMethodImpl);
2924 for(
auto*PI : I->all_referenced_protocols())
2926IMPDecl, PI, IncompleteImpl,
false,
2927WarnCategoryMethodImpl);
2931 if(!WarnCategoryMethodImpl && I->getSuperClass())
2934I->getSuperClass(), IncompleteImpl,
false);
2958 if(SuperIDecl && SuperIDecl->
lookupMethod(Sel,
true))
2965 if(SuperIDecl && SuperIDecl->
lookupMethod(Sel,
false))
2969 if(InsMap.empty() && ClsMap.empty())
2973 boolIncompleteImpl =
false;
2976IncompleteImpl,
false,
2982 boolIncompleteImpl) {
2987InsMap.insert(I->getSelector());
2995 const auto*
P= PImpl->getPropertyDecl();
2996 if(!
P)
continue;
2998InsMap.insert(
P->getGetterName());
2999 if(!
P->getSetterName().isNull())
3000InsMap.insert(
P->getSetterName());
3007 boolSynthesizeProperties =
getLangOpts().ObjCDefaultSynthProperties &&
3009!IDecl->isObjCRequiresPropertyDefs();
3018ClsMap.insert(I->getSelector());
3025IncompleteImpl,
true);
3030dyn_cast<ObjCCategoryImplDecl>(IMPDecl))
3041 for(
auto*PI : I->all_referenced_protocols())
3043ClsMap, I, ExplicitImplProtocols);
3047 if(!
C->IsClassExtension()) {
3048 for(
auto*
P:
C->protocols())
3050ClsMap, CDecl, ExplicitImplProtocols);
3055llvm_unreachable(
"invalid ObjCContainerDecl type.");
3064 for(
unsignedi = 0; i != NumElts; ++i) {
3069 if(PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
3079 Diag(AtClassLoc, diag::err_redefinition_different_kind) << IdentList[i];
3087 Diag(AtClassLoc, diag::warn_forward_class_redefinition)
3097= dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
3100 if(PrevIDecl && PrevIDecl->
getIdentifier() != ClassName) {
3119 if(PrevIDecl && TypeParams) {
3123 SemaRef, PrevTypeParams, TypeParams,
3124TypeParamListContext::ForwardDeclaration)) {
3125TypeParams =
nullptr;
3129 Diag(IdentLocs[i], diag::err_objc_parameterized_forward_class)
3132 Diag(Def->getLocation(), diag::note_defined_here)
3135TypeParams =
nullptr;
3141PrevIDecl, IdentLocs[i]);
3149DeclsInGroup.push_back(IDecl);
3157 const Type*left,
const Type*right);
3167 if(left == right)
return true;
3191 if(isa<VectorType>(left))
returnisa<VectorType>(right);
3192 if(isa<VectorType>(right))
return false;
3215 return(leftSK == rightSK);
3221assert(lt && rt && lt != rt);
3223 if(!isa<RecordType>(lt) || !isa<RecordType>(rt))
return false;
3224 RecordDecl*left = cast<RecordType>(lt)->getDecl();
3225 RecordDecl*right = cast<RecordType>(rt)->getDecl();
3231 if((isa<CXXRecordDecl>(left) && !cast<CXXRecordDecl>(left)->isPOD()) ||
3232(isa<CXXRecordDecl>(right) && !cast<CXXRecordDecl>(right)->isPOD()))
3247 for(; li != le && ri != re; ++li, ++ri) {
3248 if(!
matchTypes(Context, strategy, li->getType(), ri->getType()))
3251 return(li == le && ri == re);
3273(left->
hasAttr<NSReturnsRetainedAttr>()
3274!= right->
hasAttr<NSReturnsRetainedAttr>() ||
3275left->
hasAttr<NSConsumesSelfAttr>()
3276!= right->
hasAttr<NSConsumesSelfAttr>()))
3283 for(; li != le && ri != re; ++li, ++ri) {
3284assert(ri != right->
param_end() &&
"Param mismatch");
3291lparm->
hasAttr<NSConsumedAttr>() != rparm->hasAttr<NSConsumedAttr>())
3299 auto*MethodProtocol = dyn_cast<ObjCProtocolDecl>(Method->
getDeclContext());
3300 auto*MethodInListProtocol =
3304 if((MethodProtocol && !MethodInListProtocol) ||
3305(!MethodProtocol && MethodInListProtocol))
3308 if(MethodProtocol && MethodInListProtocol)
3314 returnMethodInterface == MethodInListInterface;
3323 if(!CD->IsClassExtension() && List->getBits() < 2)
3324List->setBits(List->getBits() + 1);
3327 if(List->getMethod() ==
nullptr) {
3328List->setMethod(Method);
3329List->setNext(
nullptr);
3337 for(; List;
Previous= List, List = List->getNext()) {
3354 if(!SameDeclaration ||
3360List->setHasMoreThanOneDecl(
true);
3365!ListWithSameDeclaration && !List->getMethod()->isDeprecated())
3366ListWithSameDeclaration = List;
3369!ListWithSameDeclaration &&
3371ListWithSameDeclaration = List;
3385List->setHasMoreThanOneDecl(
true);
3392List->setMethod(Method);
3398List->setMethod(Method);
3409 if(ListWithSameDeclaration) {
3410 auto*List =
new(Mem)
ObjCMethodList(*ListWithSameDeclaration);
3412ListWithSameDeclaration->
setMethod(Method);
3413ListWithSameDeclaration->
setNext(List);
3433voidSemaObjC::AddMethodToGlobalPool(
ObjCMethodDecl*Method,
boolimpl,
3483assert(BoundInterface &&
"unexpected object type!");
3487 auto*MethodProtocol = dyn_cast<ObjCProtocolDecl>(Method->
getDeclContext());
3488 if(MethodProtocol) {
3498 returnMethodInterface == BoundInterface ||
3499MethodInterface->isSuperClassOf(BoundInterface) ||
3500BoundInterface->isSuperClassOf(MethodInterface);
3502llvm_unreachable(
"unknown method context");
3509 boolInstanceFirst,
boolCheckTheOther,
const ObjCObjectType*TypeBound) {
3513GlobalMethodPool::iterator Pos =
MethodPool.find(Sel);
3521 if(M->getMethod() && M->getMethod()->isUnconditionallyVisible()) {
3523Methods.push_back(M->getMethod());
3527 if(!Methods.empty())
3528 returnMethods.size() > 1;
3537 if(M->getMethod() && M->getMethod()->isUnconditionallyVisible()) {
3539Methods.push_back(M->getMethod());
3542 returnMethods.size() > 1;
3550FilteredMethods.push_back(BestMethod);
3552 for(
auto*M : Methods)
3553 if(M != BestMethod && !M->
hasAttr<UnavailableAttr>())
3554FilteredMethods.push_back(M);
3556 if(FilteredMethods.size() > 1)
3560GlobalMethodPool::iterator Pos =
MethodPool.find(Sel);
3571 boolreceiverIdOrClass,
3576GlobalMethodPool::iterator Pos =
MethodPool.find(Sel);
3581 ObjCMethodList&MethList = instance ? Pos->second.first : Pos->second.second;
3584 if(M->getMethod() && M->getMethod()->isUnconditionallyVisible())
3585 returnM->getMethod();
3592 boolreceiverIdOrClass) {
3594 boolissueDiagnostic =
false, issueError =
false;
3598 boolstrictSelectorMatch =
3599receiverIdOrClass &&
3602 if(strictSelectorMatch) {
3603 for(
unsignedI = 1, N = Methods.size(); I != N; ++I) {
3605issueDiagnostic =
true;
3614 if(!strictSelectorMatch ||
3615(issueDiagnostic &&
getLangOpts().ObjCAutoRefCount))
3616 for(
unsignedI = 1, N = Methods.size(); I != N; ++I) {
3620issueDiagnostic =
true;
3627 if(issueDiagnostic) {
3629 Diag(R.
getBegin(), diag::err_arc_multiple_method_decl) << Sel << R;
3630 else if(strictSelectorMatch)
3631 Diag(R.getBegin(), diag::warn_strict_multiple_method_decl) << Sel << R;
3633 Diag(R.getBegin(), diag::warn_multiple_method_decl) << Sel << R;
3635 Diag(Methods[0]->getBeginLoc(),
3636issueError ? diag::note_possibility : diag::note_using)
3637<< Methods[0]->getSourceRange();
3638 for(
unsignedI = 1, N = Methods.size(); I != N; ++I) {
3639 Diag(Methods[I]->getBeginLoc(), diag::note_also_found)
3640<< Methods[I]->getSourceRange();
3646GlobalMethodPool::iterator Pos =
MethodPool.find(Sel);
3650 auto&Methods = Pos->second;
3652Method = Method->getNext())
3653 if(Method->getMethod() &&
3656 returnMethod->getMethod();
3659Method = Method->getNext())
3660 if(Method->getMethod() &&
3663 returnMethod->getMethod();
3671 const unsignedMaxEditDistance = 1;
3672 unsignedBestEditDistance = MaxEditDistance + 1;
3675 unsignedMinPossibleEditDistance =
abs((
int)MethodName.size() - (
int)Typo.size());
3676 if(MinPossibleEditDistance > 0 &&
3677Typo.size() / MinPossibleEditDistance < 1)
3679 unsignedEditDistance = Typo.edit_distance(MethodName,
true, MaxEditDistance);
3680 if(EditDistance > MaxEditDistance)
3682 if(EditDistance == BestEditDistance)
3683BestMethod.push_back(Method);
3684 else if(EditDistance < BestEditDistance) {
3686BestMethod.push_back(Method);
3692 if(ObjectType.
isNull())
3698 false) !=
nullptr;
3705 boolObjectIsId =
true, ObjectIsClass =
true;
3706 if(ObjectType.
isNull())
3707ObjectIsId = ObjectIsClass =
false;
3712ObjectType =
QualType(ObjCPtr->getInterfaceType(), 0);
3713ObjectIsId = ObjectIsClass =
false;
3716ObjectIsClass =
false;
3718ObjectIsId =
false;
3722 for(GlobalMethodPool::iterator
b=
MethodPool.begin(),
3726 if(M->getMethod() &&
3727(M->getMethod()->getSelector().getNumArgs() == NumArgs) &&
3728(M->getMethod()->getSelector() != Sel)) {
3730Methods.push_back(M->getMethod());
3731 else if(!ObjectIsClass &&
3733 SemaRef, M->getMethod()->getSelector(), ObjectType))
3734Methods.push_back(M->getMethod());
3738 if(M->getMethod() &&
3739(M->getMethod()->getSelector().getNumArgs() == NumArgs) &&
3740(M->getMethod()->getSelector() != Sel)) {
3742Methods.push_back(M->getMethod());
3743 else if(!ObjectIsId &&
3745 SemaRef, M->getMethod()->getSelector(), ObjectType))
3746Methods.push_back(M->getMethod());
3751 for(
unsignedi = 0, e = Methods.size(); i < e; i++) {
3755 return(SelectedMethods.size() == 1) ? SelectedMethods[0] :
nullptr;
3765 for(
auto*Ivar : ID->ivars()) {
3766 if(Ivar->isInvalidDecl())
3771 Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
3773Ivar->setInvalidDecl();
3783 for(
autoivar = ID->getClassInterface()->all_declared_ivar_begin();
3784ivar; ivar = ivar->getNextIvar()) {
3785 if(ivar->isInvalidDecl())
continue;
3788S.
Diag(ivar->getLocation(), diag::err_arc_weak_disabled);
3790S.
Diag(ivar->getLocation(), diag::err_arc_weak_no_runtime);
3802 for(
autoivar = ID->all_declared_ivar_begin(); ivar;
3803ivar = ivar->getNextIvar()) {
3804 if(ivar->isInvalidDecl())
3810S.
Diag(ivar->getLocation(), diag::err_flexible_array_arc_retainable);
3811ivar->setInvalidDecl();
3818 caseDecl::ObjCInterface:
3820 caseDecl::ObjCProtocol:
3822 caseDecl::ObjCCategory:
3826 caseDecl::ObjCImplementation:
3828 caseDecl::ObjCCategoryImpl:
3840 return(RecordTy && RecordTy->getDecl()->hasFlexibleArrayMember());
3847 if((IntfDecl = dyn_cast<ObjCInterfaceDecl>(OCD))) {
3848Ivars = IntfDecl->
ivars();
3849}
else if(
auto*ImplDecl = dyn_cast<ObjCImplementationDecl>(OCD)) {
3850IntfDecl = ImplDecl->getClassInterface();
3851Ivars = ImplDecl->
ivars();
3852}
else if(
auto*CategoryDecl = dyn_cast<ObjCCategoryDecl>(OCD)) {
3853 if(CategoryDecl->IsClassExtension()) {
3854IntfDecl = CategoryDecl->getClassInterface();
3855Ivars = CategoryDecl->
ivars();
3860 if(!isa<ObjCInterfaceDecl>(OCD)) {
3861 for(
auto*ivar : Ivars) {
3863S.
Diag(ivar->getLocation(), diag::warn_variable_sized_ivar_visibility)
3864<< ivar->getDeclName() << ivar->getType();
3876 if(ivar->isInvalidDecl() || !ivar->getNextIvar())
3879 boolIsInvalidIvar =
false;
3881S.
Diag(ivar->getLocation(), diag::err_flexible_array_not_at_end)
3882<< ivar->getDeclName() << IvarTy
3884IsInvalidIvar =
true;
3886 if(RecordTy->getDecl()->hasFlexibleArrayMember()) {
3887S.
Diag(ivar->getLocation(),
3888diag::err_objc_variable_sized_type_not_at_end)
3889<< ivar->getDeclName() << IvarTy;
3890IsInvalidIvar =
true;
3893 if(IsInvalidIvar) {
3894S.
Diag(ivar->getNextIvar()->getLocation(),
3895diag::note_next_ivar_declaration)
3896<< ivar->getNextIvar()->getSynthesize();
3897ivar->setInvalidDecl();
3905(Ivars.begin() == Ivars.end()) ?
nullptr: *Ivars.begin();
3908 while(SuperClass && SuperClass->
ivar_empty())
3912std::advance(IvarIter, SuperClass->
ivar_size() - 1);
3916diag::warn_superclass_variable_sized_type_not_at_end)
3931 constllvm::iterator_range<ObjCProtocolList::iterator> &Protocols) {
3932 for(
auto*PI : Protocols)
3943 for(
auto*MD : PDecl->
methods()) {
3944 if(!MD->isPropertyAccessor()) {
3945 if(
const auto*CMD =
3946IDecl->getMethod(MD->getSelector(), MD->isInstanceMethod())) {
3947 if(CMD->isDirectMethod())
3948DirectMembers.push_back(CMD);
3953 if(
const auto*CPD = IDecl->FindPropertyVisibleInPrimaryClass(
3954PD->getIdentifier(),
3955PD->isClassProperty()
3958 if(CPD->isDirectProperty())
3959DirectMembers.push_back(CPD);
3962 if(!DirectMembers.empty()) {
3963S.
Diag(CDecl->
getLocation(), diag::err_objc_direct_protocol_conformance)
3965 for(
const auto*MD : DirectMembers)
3966S.
Diag(MD->getLocation(), diag::note_direct_member_here);
3983assert(AtEnd.
isValid() &&
"Invalid location for '@end'");
3986 Decl*ClassDecl = OCD;
3988 boolisInterfaceDeclKind =
3989isa<ObjCInterfaceDecl>(ClassDecl) || isa<ObjCCategoryDecl>(ClassDecl)
3990|| isa<ObjCProtocolDecl>(ClassDecl);
3991 boolcheckIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
3998 for(
auto*PropImpl : OID->property_impls()) {
3999 if(
auto*Getter = PropImpl->getGetterMethodDecl())
4000 if(Getter->isSynthesizedAccessorStub())
4001OID->addDecl(Getter);
4002 if(
auto*Setter = PropImpl->getSetterMethodDecl())
4003 if(Setter->isSynthesizedAccessorStub())
4004OID->addDecl(Setter);
4009llvm::DenseMap<Selector, const ObjCMethodDecl*> InsMap;
4010llvm::DenseMap<Selector, const ObjCMethodDecl*> ClsMap;
4012 for(
unsignedi = 0, e = allMethods.size(); i != e; i++ ) {
4014cast_or_null<ObjCMethodDecl>(allMethods[i]);
4016 if(!Method)
continue;
4022 if((isInterfaceDeclKind && PrevMethod && !
match)
4023|| (checkIdenticalMethods &&
match)) {
4046 if((isInterfaceDeclKind && PrevMethod && !
match)
4047|| (checkIdenticalMethods &&
match)) {
4066 if(isa<ObjCInterfaceDecl>(ClassDecl)) {
4073 if(
C->IsClassExtension()) {
4082 if(CDecl->getIdentifier())
4086 for(
auto*I : CDecl->properties())
4088CDecl->setAtEndRange(AtEnd);
4091IC->setAtEndRange(AtEnd);
4098 for(
const auto*Ext : IDecl->visible_extensions()) {
4099 for(
const auto*
Property: Ext->instance_properties()) {
4102= IC->FindPropertyImplDecl(
Property->getIdentifier(),
4104 if(PIDecl->getPropertyImplementation()
4108 for(
const auto*Ext : IDecl->visible_extensions()) {
4110Ext->getInstanceMethod(
Property->getGetterName()))
4111GetterMethod->setPropertyAccessor(
true);
4114= Ext->getInstanceMethod(
Property->getSetterName()))
4115SetterMethod->setPropertyAccessor(
true);
4123 if(IDecl->hasDesignatedInitializers())
4128 boolHasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
4129 if(IDecl->getSuperClass() ==
nullptr) {
4132 if(!HasRootClassAttr) {
4135 Diag(DeclLoc, diag::warn_objc_root_class_missing)
4136<< IDecl->getIdentifier();
4144 Diag(SuperClassLoc, diag::note_objc_needs_superclass)
4147 Diag(SuperClassLoc, diag::note_objc_needs_superclass);
4150}
else if(HasRootClassAttr) {
4152 Diag(IDecl->getLocation(), diag::err_objc_root_class_subclass);
4160 if(IDecl->hasAttr<ObjCSubclassingRestrictedAttr>() &&
4161Super->hasAttr<ObjCSubclassingRestrictedAttr>()) {
4162 Diag(IC->getLocation(), diag::err_restricted_superclass_mismatch);
4163 Diag(Super->getLocation(), diag::note_class_declared);
4167 if(IDecl->hasAttr<ObjCClassStubAttr>())
4168 Diag(IC->getLocation(), diag::err_implementation_of_class_stub);
4171 while(IDecl->getSuperClass()) {
4173IDecl = IDecl->getSuperClass();
4179dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
4180CatImplClass->setAtEndRange(AtEnd);
4186= IDecl->FindCategoryDeclaration(CatImplClass->getIdentifier())) {
4190}
else if(
const auto*IntfDecl = dyn_cast<ObjCInterfaceDecl>(ClassDecl)) {
4192 if(!IntfDecl->hasAttr<ObjCSubclassingRestrictedAttr>() &&
4193Super->hasAttr<ObjCSubclassingRestrictedAttr>()) {
4194 Diag(IntfDecl->getLocation(), diag::err_restricted_superclass_mismatch);
4195 Diag(Super->getLocation(), diag::note_class_declared);
4199 if(IntfDecl->hasAttr<ObjCClassStubAttr>() &&
4200!IntfDecl->hasAttr<ObjCSubclassingRestrictedAttr>())
4201 Diag(IntfDecl->getLocation(), diag::err_class_stub_subclassing_mismatch);
4204 if(isInterfaceDeclKind) {
4206 for(
unsignedi = 0, e = allTUVars.size(); i != e; i++) {
4209 if(
VarDecl*VDecl = dyn_cast<VarDecl>(*I)) {
4210 if(!VDecl->hasExternalStorage())
4211 Diag(VDecl->getLocation(), diag::err_objc_var_decl_inclass);
4217 for(
unsignedi = 0, e = allTUVars.size(); i != e; i++) {
4220(*I)->setTopLevelDeclInObjCContainer();
4249 if(ResultObjectType->isObjCIdType() ||
4250ResultObjectType->isObjCQualifiedIdType())
4255= ResultObjectType->getInterfaceDecl()) {
4261 if(ResultClass->isSuperClassOf(CurrentClass))
4277classOverrideSearch {
4289SemaObjC::GlobalMethodPool::iterator it =
4310dyn_cast<ObjCCategoryDecl>(container)) {
4311searchFromContainer(container);
4315searchFromContainer(container);
4319 typedef decltype(Overridden)::iterator iterator;
4320iterator begin()
const{
returnOverridden.begin(); }
4321iterator end()
const{
returnOverridden.end(); }
4328#define OBJCCONTAINER(type, base) \ 4330 searchFrom(cast<type##Decl>(container)); \ 4332#define ABSTRACT_DECL(expansion) 4333#define DECL(type, base) \ 4335#include "clang/AST/DeclNodes.inc" 4336llvm_unreachable(
"not an ObjC container!");
4396 for(
const auto*Proto : protocols)
4408Overridden.insert(meth);
4418searchFromContainer(container);
4426 const auto*
attr= overridden->
getAttr<ObjCDirectAttr>();
4427 Diag(method->
getLocation(), diag::err_objc_override_direct_method);
4428 Diag(
attr->getLocation(), diag::note_previous_declaration);
4430 const auto*
attr= method->
getAttr<ObjCDirectAttr>();
4431 Diag(
attr->getLocation(), diag::err_objc_direct_on_override)
4443 autoIsMethodInCurrentClass = [CurrentClass](
const ObjCMethodDecl*M) {
4445 returnM->getClassInterface()->getCanonicalDecl() ==
4449OverrideSearch overrides(
SemaRef, ObjCMethod);
4455 boolhasOverriddenMethodsInBaseOrProtocol =
false;
4457 if(!hasOverriddenMethodsInBaseOrProtocol) {
4458 if(isa<ObjCProtocolDecl>(overridden->getDeclContext()) ||
4459!IsMethodInCurrentClass(overridden) || overridden->isOverriding()) {
4461hasOverriddenMethodsInBaseOrProtocol =
true;
4470GlobalMethodPool::iterator It =
4475 unsignedCategCount = List.getBits();
4476 if(CategCount > 0) {
4479 if(CategCount > 1 ||
4480!isa<ObjCCategoryImplDecl>(overridden->getDeclContext())) {
4481OverrideSearch overrides(
SemaRef, overridden);
4483 if(isa<ObjCProtocolDecl>(SuperOverridden->getDeclContext()) ||
4484!IsMethodInCurrentClass(SuperOverridden)) {
4486hasOverriddenMethodsInBaseOrProtocol =
true;
4487overridden->setOverriding(
true);
4504 if(ObjCMethod->
isImplicit() && overridden->isImplicit())
4511isa<ObjCProtocolDecl>(overridden->getDeclContext()));
4513 if(CurrentClass && overridden->
getDeclContext() != CurrentClass &&
4514isa<ObjCInterfaceDecl>(overridden->getDeclContext()) &&
4519PrevE = overridden->param_end();
4520 for(; ParamI !=
E&& PrevI != PrevE; ++ParamI, ++PrevI) {
4521assert(PrevI != overridden->param_end() &&
"Param mismatch");
4527 Diag((*ParamI)->getLocation(), diag::ext_typecheck_base_super)
4529 Diag(overridden->getLocation(), diag::note_previous_declaration);
4536ObjCMethod->
setOverriding(hasOverriddenMethodsInBaseOrProtocol);
4546 boolprevUsesCSKeyword) {
4548 autonullability =
type->getNullability();
4552 if(nullability.has_value() == prevNullability.has_value()) {
4558 if(*nullability == *prevNullability)
4562S.
Diag(loc, diag::err_nullability_conflicting)
4583 if(prevMethod->
hasAttr<ObjCRequiresSuperAttr>() &&
4584!method->
hasAttr<ObjCRequiresSuperAttr>()) {
4587ObjCRequiresSuperAttr::CreateImplicit(S.
Context,
4604 unsignednumPrevParams = prevMethod->
param_size();
4605 for(
unsignedi = 0, n = std::min(numParams, numPrevParams); i != n; ++i) {
4616param->
setType(newParamType);
4625llvm::Triple::x86 &&
4626 "x86-specific check invoked for a different target");
4630 if(
P->getType()->isVectorType()) {
4631 Loc=
P->getBeginLoc();
4647VersionTuple AcceptedInVersion;
4648 if(Triple.getOS() == llvm::Triple::IOS)
4649AcceptedInVersion = VersionTuple(
9);
4650 else if(Triple.isMacOSX())
4651AcceptedInVersion = VersionTuple(
10,
11);
4657SemaRef.
Diag(
Loc, diag::err_objc_method_unsupported_param_ret_type)
4660<< (Triple.isMacOSX() ?
"macOS 10.11":
"iOS 9");
4665CD->
hasAttr<ObjCDirectMembersAttr>()) {
4676 booldiagnosed =
false;
4679 if(diagnosed || IMD->isImplicit())
4682S.
Diag(Method->
getLocation(), diag::err_objc_direct_duplicate_decl)
4685S.
Diag(IMD->getLocation(), diag::note_previous_declaration);
4703 if(
auto*IMD = IDecl->
getMethod(Sel, isInstance))
4706 if(Impl != ImpDecl)
4711 if(
auto*IMD = Cat->getMethod(Sel, isInstance))
4713 else if(
autoCatImpl = Cat->getImplementation())
4714 if(CatImpl != ImpDecl)
4715 if(
auto*IMD = Cat->getMethod(Sel, isInstance))
4722 boolMethodDefinition) {
4727 if(!ArgInfo.
Type) {
4739 if(S->isDeclScope(PrevDecl)) {
4741(MethodDefinition ? diag::warn_method_param_redefinition
4742: diag::warn_method_param_declaration))
4763 if(Param->
hasAttr<BlocksAttr>()) {
4782 boolisVariadic,
boolMethodDefinition) {
4786 Diag(MethodLoc, diag::err_missing_method_context);
4793 boolHasRelatedResultType =
false;
4801 QualTypebareResultType = resultDeclType;
4806 Diag(MethodLoc, diag::warn_missing_method_return_type)
4811Context, MethodLoc, EndLoc, Sel, resultDeclType, ReturnTInfo,
4815MethodDeclKind == tok::objc_optional
4818HasRelatedResultType);
4821 for(
unsignedI = 0; I < Sel.
getNumArgs(); ++I) {
4825Params.push_back(Param);
4828 for(
unsignedi = 0, e = CNumArgs; i != e; ++i) {
4829 ParmVarDecl*Param = cast<ParmVarDecl>(CParamInfo[i].Param);
4838Params.push_back(Param);
4851 if(
ObjCImplDecl*ImpDecl = dyn_cast<ObjCImplDecl>(ClassDecl)) {
4852 if(MethodType == tok::minus) {
4853PrevMethod = ImpDecl->getInstanceMethod(Sel);
4854ImpDecl->addInstanceMethod(ObjCMethod);
4856PrevMethod = ImpDecl->getClassMethod(Sel);
4857ImpDecl->addClassMethod(ObjCMethod);
4866 if(
auto*Setter = PropertyImpl->getSetterMethodDecl())
4867 if(Setter->getSelector() == Sel &&
4869assert(Setter->isSynthesizedAccessorStub() &&
"autosynth stub expected");
4870PropertyImpl->setSetterMethodDecl(ObjCMethod);
4872 if(
auto*Getter = PropertyImpl->getGetterMethodDecl())
4873 if(Getter->getSelector() == Sel &&
4875assert(Getter->isSynthesizedAccessorStub() &&
"autosynth stub expected");
4876PropertyImpl->setGetterMethodDecl(ObjCMethod);
4890 const auto*
attr= CanonicalMD->
getAttr<ObjCDirectAttr>();
4892ObjCDirectAttr::CreateImplicit(Context,
attr->getLocation()));
4899 if(
auto*IMD = IDecl->lookupMethod(ObjCMethod->
getSelector(),
4919 if(IDecl == IMD->getClassInterface()) {
4920 autodiagContainerMismatch = [&] {
4921 int decl= 0, impl = 0;
4923 if(
auto*Cat = dyn_cast<ObjCCategoryDecl>(IMD->getDeclContext()))
4924 decl= Cat->IsClassExtension() ? 1 : 2;
4926 if(isa<ObjCCategoryImplDecl>(ImpDecl))
4927impl = 1 + (
decl!= 0);
4930diag::err_objc_direct_impl_decl_mismatch)
4932 Diag(IMD->getLocation(), diag::note_previous_declaration);
4936 const auto*
attr= ObjCMethod->
getAttr<ObjCDirectAttr>();
4938diagContainerMismatch();
4939}
else if(!IMD->isDirectMethod()) {
4940 Diag(
attr->getLocation(), diag::err_objc_direct_missing_on_decl);
4941 Diag(IMD->getLocation(), diag::note_previous_declaration);
4943}
else if(IMD->isDirectMethod()) {
4944 const auto*
attr= IMD->getAttr<ObjCDirectAttr>();
4946diagContainerMismatch();
4949ObjCDirectAttr::CreateImplicit(Context,
attr->getLocation()));
4955 if(isa<ObjCCategoryImplDecl>(ImpDecl) && IMD->isOverriding() &&
4968 for(
auto*
C: IDecl->visible_categories())
4969 for(
auto&
P:
C->protocols())
4970 if(
auto*IMD =
P->lookupMethod(ObjCMethod->
getSelector(),
4973IMD->parameters().size() &&
4974 "Methods have different number of parameters");
4975 autoOI = IMD->param_begin(), OE = IMD->param_end();
4977 for(; OI != OE; ++OI, ++NI)
4982 if(!isa<ObjCProtocolDecl>(ClassDecl)) {
4987IDecl = cast<ObjCCategoryDecl>(ClassDecl)->getClassInterface();
4995cast<DeclContext>(ClassDecl)->addDecl(ObjCMethod);
5011 if(!CurrentClass) {
5013CurrentClass = Cat->getClassInterface();
5014 else if(
ObjCImplDecl*Impl = dyn_cast<ObjCImplDecl>(ClassDecl))
5015CurrentClass = Impl->getClassInterface();
5017= dyn_cast<ObjCCategoryImplDecl>(ClassDecl))
5018CurrentClass = CatImpl->getClassInterface();
5026 boolARCError =
false;
5034 boolInferRelatedResultType =
false;
5060 if(InferRelatedResultType &&
5065 if(MethodDefinition &&
5071 if(
const auto*
attr= ObjCMethod->
getAttr<AvailabilityAttr>()) {
5074 Diag(
attr->getLocation(), diag::warn_availability_on_static_initializer)
5076ObjCMethod->
dropAttr<AvailabilityAttr>();
5096 if(isa<TranslationUnitDecl>(
5100 Diag(
D->
getLocation(), diag::err_objc_decls_may_only_appear_in_global_scope);
5115 Diag(DeclStart, diag::err_undef_interface) << ClassName;
5119 Diag(DeclStart, diag::err_atdef_nonfragile_interface);
5127 for(
unsignedi = 0; i < Ivars.size(); i++) {
5133ID->getIdentifier(), ID->getType(),
5135Decls.push_back(FD);
5140 D!= Decls.end(); ++
D) {
5161 Diag(IdLoc, diag::err_arg_with_address_space);
5173 Diag(IdLoc, diag::err_illegal_qualifiers_on_catch_parm);
5178 Diag(IdLoc, diag::err_catch_param_not_objc_type);
5181 Diag(IdLoc, diag::err_catch_param_not_objc_type);
5212 if(
DeclSpec::TSCSTSCS =
D.getDeclSpec().getThreadStorageClassSpec())
5213 Diag(
D.getDeclSpec().getThreadStorageClassSpecLoc(),
5214diag::err_invalid_thread)
5216 D.getMutableDeclSpec().ClearStorageClassSpecs();
5230 D.getIdentifierLoc(),
5232 D.isInvalidType());
5235 if(
D.getCXXScopeSpec().isSet()) {
5236 Diag(
D.getIdentifierLoc(), diag::err_qualified_objc_catch_parm)
5237<<
D.getCXXScopeSpec().getRange();
5243 if(
D.getIdentifier())
5248 if(New->
hasAttr<BlocksAttr>())
5262Ivars.push_back(Iv);
5272 for(
unsignedI = 0, N = Sels.size(); I != N; ++I)
5283 SelectorSel = SelectorAndLocation.first;
5286 Diag(
Loc, diag::warn_unimplemented_selector) << Sel;
5309IV->getIdentifier());
5324 boolInvokedSelfMethod;
5328: S(S), Method(Method), IvarD(IvarD), AccessedIvar(
false),
5329InvokedSelfMethod(
false) {
5334 if(
E->getDecl() == IvarD) {
5335AccessedIvar =
true;
5344InvokedSelfMethod =
true;
5353 if(S->hasUnrecoverableErrorOccurred())
5357 unsigned DIAG= diag::warn_unused_property_backing_ivar;
5367 if(CurMethod->isSynthesizedAccessorStub())
5370UnusedBackingIvarChecker Checker(
SemaRef, CurMethod, IV);
5371Checker.TraverseStmt(CurMethod->getBody());
5372 if(Checker.AccessedIvar)
5379 if(!IV->
isReferenced() || !Checker.InvokedSelfMethod) {
5400 if(!
T.isConstQualified()) {
5404NameLoc, diag::err_arc_array_param_no_ownership,
T,
false));
5406 Diag(NameLoc, diag::err_arc_array_param_no_ownership)
5420 boolDoTypoCorrection) {
5426 if(!IDecl && DoTypoCorrection) {
5451 unsignedkind = -1U;
5453 if(var->hasAttr<BlocksAttr>())
5455 else if(!var->hasLocalStorage())
5457}
else if(isa<ObjCIvarDecl>(
decl)) {
5459}
else if(isa<FieldDecl>(
decl)) {
5464 Diag(
decl->getLocation(), diag::err_arc_autoreleasing_var) << kind;
5468 if(!
type->isObjCLifetimeType())
5471lifetime =
type->getObjCARCImplicitLifetime();
5479var->getTLSKind()) {
5480 Diag(var->getLocation(), diag::err_arc_thread_ownership)
5503 for(
unsignedi = 0; i < ivars.size(); i++) {
5505 if(Field->isInvalidDecl())
5515InitSeq.Perform(
SemaRef, InitEntity, InitKind, {});
5519 if(!MemberInit.get() || MemberInit.isInvalid())
5525AllToInit.push_back(
Member);
5530->getAs<RecordType>()) {
5531 CXXRecordDecl*RD = cast<CXXRecordDecl>(RecordTy->getDecl());
5536 PDiag(diag::err_access_dtor_ivar)
5550 switch(ivarVisibility) {
5552llvm_unreachable(
"Unknown visitibility kind");
5553 casetok::objc_private:
5555 casetok::objc_public:
5557 casetok::objc_protected:
5559 casetok::objc_package:
5572 Loc=
D.getIdentifierLoc();
5586 D.setInvalidType();
5593 Diag(
Loc, diag::err_ivar_reference_type);
5594 D.setInvalidType();
5600TInfo,
T,
Loc, diag::err_typecheck_ivar_variable_size))
5601 D.setInvalidType();
5615dyn_cast<ObjCImplementationDecl>(EnclosingDecl)) {
5619EnclosingContext = IMPDecl->getClassInterface();
5620assert(EnclosingContext &&
"Implementation has no class interface!");
5622EnclosingContext = EnclosingDecl;
5624 if(
ObjCCategoryDecl*CDecl = dyn_cast<ObjCCategoryDecl>(EnclosingDecl)) {
5626 Diag(
Loc, diag::err_misplaced_ivar) << CDecl->IsClassExtension();
5630EnclosingContext = EnclosingDecl;
5636II,
T, TInfo, ac, BitWidth);
5644RedeclarationKind::ForVisibleRedeclaration);
5646!isa<TagDecl>(PrevDecl)) {
5647 Diag(
Loc, diag::err_duplicate_member) << II;
5656 if(
D.isInvalidType())
5663 if(
D.getDeclSpec().isModulePrivateSpecified())
5674isa<ObjCInterfaceDecl>(EnclosingDecl))
5675 Diag(
Loc, diag::warn_ivars_in_interface);
Defines the clang::ASTContext interface.
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, SHOWINSYSHEADER, SHOWINSYSMACRO, DEFERRABLE, CATEGORY)
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
llvm::MachO::Record Record
static bool IsVariableSizedType(QualType T)
static void DiagnoseVariableSizedIvars(Sema &S, ObjCContainerDecl *OCD)
static bool HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param)
HasExplicitOwnershipAttr - returns true when pointer to ObjC pointer has explicit ownership attribute...
static void checkObjCDirectMethodClashes(Sema &S, ObjCInterfaceDecl *IDecl, ObjCMethodDecl *Method, ObjCImplDecl *ImpDecl=nullptr)
static bool CheckMethodOverrideParam(Sema &S, ObjCMethodDecl *MethodImpl, ObjCMethodDecl *MethodDecl, ParmVarDecl *ImplVar, ParmVarDecl *IfaceVar, bool IsProtocolMethodDecl, bool IsOverridingMode, bool Warn)
static SourceRange getTypeRange(TypeSourceInfo *TSI)
std::unique_ptr< ProtocolNameSet > LazyProtocolNameSet
static bool CheckMethodOverrideReturn(Sema &S, ObjCMethodDecl *MethodImpl, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl, bool IsOverridingMode, bool Warn)
static void DiagnoseCategoryDirectMembersProtocolConformance(Sema &S, ObjCProtocolDecl *PDecl, ObjCCategoryDecl *CDecl)
static bool checkTypeParamListConsistency(Sema &S, ObjCTypeParamList *prevTypeParams, ObjCTypeParamList *newTypeParams, TypeParamListContext newContext)
Check consistency between two Objective-C type parameter lists, e.g., between a category/extension an...
static void HelperSelectorsForTypoCorrection(SmallVectorImpl< const ObjCMethodDecl * > &BestMethod, StringRef Typo, const ObjCMethodDecl *Method)
static bool objcModifiersConflict(Decl::ObjCDeclQualifier x, Decl::ObjCDeclQualifier y)
Determine whether two set of Objective-C declaration qualifiers conflict.
static bool shouldWarnUndefinedMethod(const ObjCMethodDecl *M)
static bool FilterMethodsByTypeBound(ObjCMethodDecl *Method, const ObjCObjectType *TypeBound)
Return true if the given method is wthin the type bound.
static void DiagnoseObjCImplementedDeprecations(Sema &S, const NamedDecl *ND, SourceLocation ImplLoc)
static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl, ProtocolNameSet &PNS)
static bool matchTypes(ASTContext &Context, SemaObjC::MethodMatchStrategy strategy, QualType leftQT, QualType rightQT)
static void DiagnoseRetainableFlexibleArrayMember(Sema &S, ObjCInterfaceDecl *ID)
Diagnose attempts to use flexible array member with retainable object type.
static void mergeInterfaceMethodToImpl(Sema &S, ObjCMethodDecl *method, ObjCMethodDecl *prevMethod)
Merge information from the declaration of a method in the @interface (or a category/extension) into t...
static bool HelperIsMethodInObjCType(Sema &S, Selector Sel, QualType ObjectType)
static SemaObjC::ResultTypeCompatibilityKind CheckRelatedResultTypeCompatibility(Sema &S, ObjCMethodDecl *Method, ObjCInterfaceDecl *CurrentClass)
Check whether the declared result type of the given Objective-C method declaration is compatible with...
static ObjCIvarDecl::AccessControl TranslateIvarVisibility(tok::ObjCKeywordKind ivarVisibility)
TranslateIvarVisibility - Translate visibility from a token ID to an AST enum value.
static void CheckProtocolMethodDefs(Sema &S, ObjCImplDecl *Impl, ObjCProtocolDecl *PDecl, bool &IncompleteImpl, const SemaObjC::SelectorSet &InsMap, const SemaObjC::SelectorSet &ClsMap, ObjCContainerDecl *CDecl, LazyProtocolNameSet &ProtocolsExplictImpl)
CheckProtocolMethodDefs - This routine checks unimplemented methods Declared in protocol,...
static void WarnUndefinedMethod(Sema &S, ObjCImplDecl *Impl, ObjCMethodDecl *method, bool &IncompleteImpl, unsigned DiagID, NamedDecl *NeededFor=nullptr)
static bool NestedProtocolHasNoDefinition(ObjCProtocolDecl *PDecl, ObjCProtocolDecl *&UndefinedProtocol)
static bool isObjCTypeSubstitutable(ASTContext &Context, const ObjCObjectPointerType *A, const ObjCObjectPointerType *B, bool rejectId)
Determines if type B can be substituted for type A.
llvm::DenseSet< IdentifierInfo * > ProtocolNameSet
FIXME: Type hierarchies in Objective-C can be deep.
static QualType mergeTypeNullabilityForRedecl(Sema &S, SourceLocation loc, QualType type, bool usesCSKeyword, SourceLocation prevLoc, QualType prevType, bool prevUsesCSKeyword)
Merge type nullability from for a redeclaration of the same entity, producing the updated type of the...
static bool diagnoseNoescape(const ParmVarDecl *NewD, const ParmVarDecl *OldD, Sema &S)
Issue a warning if the parameter of the overridden method is non-escaping but the parameter of the ov...
static bool isAcceptableMethodMismatch(ObjCMethodDecl *chosen, ObjCMethodDecl *other)
Determines if this is an "acceptable" loose mismatch in the global method pool.
static void mergeObjCDirectMembers(Sema &S, Decl *CD, ObjCMethodDecl *Method)
static void DiagnoseWeakIvars(Sema &S, ObjCImplementationDecl *ID)
Diagnose attempts to define ARC-__weak ivars when __weak is disabled.
static void checkObjCMethodX86VectorTypes(Sema &SemaRef, const ObjCMethodDecl *Method)
Verify that the method parameters/return value have types that are supported by the x86 target.
static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl, ObjCMethodDecl *decl)
In ARC, check whether the conventional meanings of the two methods match.
static bool isMethodContextSameForKindofLookup(ObjCMethodDecl *Method, ObjCMethodDecl *MethodInList)
static bool tryMatchRecordTypes(ASTContext &Context, SemaObjC::MethodMatchStrategy strategy, const Type *left, const Type *right)
static Decl::ObjCDeclQualifier CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal)
CvtQTToAstBitMask - utility routine to produce an AST bitmask for objective-c's type qualifier from t...
static void diagnoseUseOfProtocols(Sema &TheSema, ObjCContainerDecl *CD, ObjCProtocolDecl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs)
This file declares semantic analysis for Objective-C.
Defines the SourceManager interface.
__DEVICE__ long long abs(long long __n)
virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D)
Handle the specified top-level declaration that occurred inside and ObjC container.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
TranslationUnitDecl * getTranslationUnitDecl() const
bool AnyObjCImplementation()
Return true if there is at least one @implementation in the TU.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
void adjustObjCTypeParamBoundType(const ObjCTypeParamDecl *Orig, ObjCTypeParamDecl *New) const
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
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
const LangOptions & getLangOpts() const
SelectorTable & Selectors
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
const clang::PrintingPolicy & getPrintingPolicy() const
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 getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
const TargetInfo & getTargetInfo() const
QualType getLifetimeQualifiedType(QualType type, Qualifiers::ObjCLifetime lifetime)
Return a type with the given lifetime qualifier.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
bool hasSameNullabilityTypeQualifier(QualType SubT, QualType SuperT, bool IsParam) const
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it.
The result of parsing/analyzing an expression, statement etc.
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
Type source information for an attributed type.
static std::optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
Represents a C++ base or member initializer.
Represents a C++ destructor within a class.
Represents a C++ struct/union/class.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isFileContext() const
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
bool isObjCContainer() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
Decl::Kind getDeclKind() const
Simple template class for restricting typo correction candidates to ones having a single Decl* of the...
Captures information about "declaration specifiers".
static const TST TST_typename
SourceLocation getStorageClassSpecLoc() const
SCS getStorageClassSpec() const
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
void SetRangeEnd(SourceLocation Loc)
void SetRangeStart(SourceLocation Loc)
SCS
storage-class-specifier
bool isInlineSpecified() const
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
SourceLocation getInlineSpecLoc() const
Decl - This represents one declaration (or definition), e.g.
SourceLocation getEndLoc() const LLVM_READONLY
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isUnavailable(std::string *Message=nullptr) const
Determine whether this declaration is marked 'unavailable'.
AvailabilityResult getAvailability(std::string *Message=nullptr, VersionTuple EnclosingVersion=VersionTuple(), StringRef *RealizedPlatform=nullptr) const
Determine the availability of the given declaration.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
void setTopLevelDeclInObjCContainer(bool V=true)
bool isReferenced() const
Whether any declaration of this entity was referenced.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
@ OBJC_TQ_CSNullability
The nullability qualifier is set when the nullability of the result or parameter was expressed via a ...
bool isInvalidDecl() const
SourceLocation getLocation() const
bool isDeprecated(std::string *Message=nullptr) const
Determine whether this declaration is marked 'deprecated'.
void setImplicit(bool I=true)
DeclContext * getDeclContext()
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
void setLexicalDeclContext(DeclContext *DC)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
Recursive AST visitor that supports extension via dynamic dispatch.
This represents one expression.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getBitWidthValue() const
Computes the bit width of this field, if this is a bit field.
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
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.
One of these records is kept for each identifier that is lexed.
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
void AddDecl(NamedDecl *D)
AddDecl - Link the decl to its shadowed decl chain.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateDefault(SourceLocation InitLoc)
Create a default 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 InitializeMember(FieldDecl *Member, const InitializedEntity *Parent=nullptr, bool Implicit=false)
Create the initialization entity for a member subobject.
clang::ObjCRuntime ObjCRuntime
Represents the results of name lookup.
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.
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
void setModulePrivate()
Specify that this declaration was marked as being private to the module in which it was defined.
static ObjCAtDefsFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW)
ObjCCategoryDecl - Represents a category declaration.
static ObjCCategoryDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, const IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList, SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCCategoryImplDecl * getImplementation() const
ObjCInterfaceDecl * getClassInterface()
bool IsClassExtension() const
const ObjCProtocolList & getReferencedProtocols() const
void setImplementation(ObjCCategoryImplDecl *ImplD)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCCategoryDecl * getCategoryDecl() const
static ObjCCategoryImplDecl * Create(ASTContext &C, DeclContext *DC, const IdentifierInfo *Id, ObjCInterfaceDecl *classInterface, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation CategoryNameLoc)
ObjCCompatibleAliasDecl - Represents alias of a class.
static ObjCCompatibleAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl *aliasedClass)
ObjCContainerDecl - Represents a container for method declarations.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
method_range methods() const
SourceRange getAtEndRange() const
instmeth_range instance_methods() const
ObjCIvarDecl * getIvarDecl(IdentifierInfo *Id) const
getIvarDecl - This method looks up an ivar in this ContextDecl.
void setAtEndRange(SourceRange atEnd)
ObjCMethodDecl * getClassMethod(Selector Sel, bool AllowHidden=false) const
prop_range properties() const
classmeth_range class_methods() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
Captures information about "declaration specifiers" specific to Objective-C.
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
ObjCDeclQualifier getObjCDeclQualifier() const
propimpl_range property_impls() const
const ObjCInterfaceDecl * getClassInterface() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
static ObjCImplementationDecl * Create(ASTContext &C, DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation superLoc=SourceLocation(), SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
void setIvarInitializers(ASTContext &C, CXXCtorInitializer **initializers, unsigned numInitializers)
const ObjCInterfaceDecl * getSuperClass() const
Represents an ObjC class declaration.
void mergeClassExtensionProtocolList(ObjCProtocolDecl *const *List, unsigned Num, ASTContext &C)
mergeClassExtensionProtocolList - Merge class extension's protocol list into the protocol list for th...
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
ObjCInterfaceDecl * lookupInheritedClass(const IdentifierInfo *ICName)
lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super class whose name is passe...
ivar_iterator ivar_end() const
llvm::iterator_range< specific_decl_iterator< ObjCIvarDecl > > ivar_range
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
unsigned ivar_size() const
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
bool hasDefinition() const
Determine whether this class has been defined.
all_protocol_range all_referenced_protocols() const
visible_extensions_range visible_extensions() const
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node.
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
ObjCCategoryDecl * FindCategoryDeclaration(const IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
ivar_iterator ivar_begin() const
void setImplementation(ObjCImplementationDecl *ImplD)
known_categories_range known_categories() const
void setSuperClass(TypeSourceInfo *superClass)
const ObjCProtocolList & getReferencedProtocols() const
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,...
ObjCImplementationDecl * getImplementation() const
void setEndOfDefinitionLoc(SourceLocation LE)
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
visible_categories_range visible_categories() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getSuperClass() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
void startDuplicateDefinitionForComparison()
Starts the definition without sharing it with other redeclarations.
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.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getNextIvar()
static ObjCIvarDecl * Create(ASTContext &C, ObjCContainerDecl *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, AccessControl ac, Expr *BW=nullptr, bool synthesized=false)
ObjCIvarRefExpr - A reference to an ObjC instance variable.
ObjCList - This is a simple template class used to hold various lists of decls etc,...
void set(T *const *InList, unsigned Elts, ASTContext &Ctx)
An expression that sends a message to the given Objective-C object or class.
@ Instance
The receiver is an object instance.
ObjCMethodDecl - Represents an instance or class method declaration.
bool isDesignatedInitializerForTheInterface(const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the method selector resolves to a designated initializer in the class's interface.
ImplicitParamDecl * getSelfDecl() const
void setObjCDeclQualifier(ObjCDeclQualifier QV)
void setDefined(bool isDefined)
ObjCDeclQualifier getObjCDeclQualifier() const
ArrayRef< ParmVarDecl * > parameters() const
unsigned param_size() const
bool isPropertyAccessor() const
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool 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.
param_const_iterator param_end() const
param_const_iterator param_begin() const
ObjCMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs={})
Sets the method's parameters and selector source locations.
void setAsRedeclaration(const ObjCMethodDecl *PrevMethod)
void setRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
bool isSynthesizedAccessorStub() const
SourceLocation getSelectorLoc(unsigned Index) const
SourceRange getReturnTypeSourceRange() const
void setOverriding(bool IsOver)
const ParmVarDecl *const * param_const_iterator
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
ImplicitParamDecl * getCmdDecl() const
bool isInstanceMethod() const
void setReturnType(QualType T)
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implicit parameters.
QualType getReturnType() const
ParmVarDecl *const * param_iterator
ObjCImplementationControl getImplementationControl() const
bool isClassMethod() const
ObjCInterfaceDecl * getClassInterface()
Wraps an ObjCPointerType with source location information.
void setStarLoc(SourceLocation Loc)
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.
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.
ObjCIvarDecl * getPropertyIvarDecl() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents an Objective-C protocol declaration.
void startDuplicateDefinitionForComparison()
Starts the definition without sharing it with other redeclarations.
bool hasDefinition() const
Determine whether this protocol has a definition.
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
static ObjCProtocolDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
const ObjCProtocolList & getReferencedProtocols() const
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
void startDefinition()
Starts the definition of this Objective-C protocol.
protocol_range protocols() const
A list of Objective-C protocols, along with the source locations at which they were referenced.
The basic abstraction for the target Objective-C runtime.
bool isNeXTFamily() const
Is this runtime basically of the NeXT family of runtimes?
bool isNonFragile() const
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI?
bool isFragile() const
The inverse of isNonFragile(): does this runtime follow the set of implied behaviors for a "fragile" ...
Represents the declaration of an Objective-C type parameter.
static ObjCTypeParamDecl * Create(ASTContext &ctx, DeclContext *dc, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, SourceLocation nameLoc, IdentifierInfo *name, SourceLocation colonLoc, TypeSourceInfo *boundInfo)
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
void setVariance(ObjCTypeParamVariance variance)
Set the variance of this type parameter.
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
SourceRange getSourceRange() const
unsigned size() const
Determine the number of type parameters in this list.
ObjCTypeParamDecl * back() const
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
SourceLocation getLAngleLoc() const
Represents a parameter to a function.
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
ObjCDeclQualifier getObjCDeclQualifier() const
void setObjCMethodScopeInfo(unsigned parameterIndex)
static const ParsedAttributesView & none()
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
The collection of all-type qualifiers we support.
void removeCVRQualifiers(unsigned mask)
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
std::string getAsString() const
Represents a struct/union/class.
field_iterator field_end() const
field_iterator field_begin() const
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.
Selector getSelector(unsigned NumArgs, const IdentifierInfo **IIV)
Can create any sort of selector.
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
std::string getAsString() const
Derive the full selector name (e.g.
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
bool isUnarySelector() const
unsigned getNumArgs() const
A generic diagnostic builder for errors which may or may not be deferred.
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
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
ObjCInterfaceDecl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
void updateOutOfDateSelector(Selector Sel)
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
ObjCImplementationDecl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, const IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
ObjCContainerKind getObjCContainerKind() const
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.
ParmVarDecl * ActOnMethodParmDeclaration(Scope *S, ObjCArgInfo &ArgInfo, int ParamIndex, bool MethodDefinition)
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
ObjCContainerDecl * getObjCDeclContext() const
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
void ActOnObjCContainerFinishDefinition()
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
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.
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
ObjCCategoryDecl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, const IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ObjCCategoryImplDecl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, const IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
bool inferObjCARCLifetime(ValueDecl *decl)
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ParmVarDecl **ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Find the protocol with the given name, if any.
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, const IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
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.
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void DiagnoseUseOfUnimplementedSelectors()
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods={}, ArrayRef< DeclGroupPtrTy > allTUVars={})
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
@ OCK_CategoryImplementation
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
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.
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
LookupNameKind
Describes the kind of name lookup to perform.
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
@ LookupAnyName
Look up any declaration with any name.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function.
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
ExprResult VerifyBitField(SourceLocation FieldLoc, const IdentifierInfo *FieldName, QualType FieldTy, bool IsMsStruct, Expr *BitWidth)
VerifyBitField - verifies that a bit field expression is an ICE and has the correct width,...
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
ASTContext & getASTContext() const
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
void PushFunctionScope()
Enter a new function scope.
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
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...
bool tryToFixVariablyModifiedVarType(TypeSourceInfo *&TInfo, QualType &T, SourceLocation Loc, unsigned FailedFoldDiagID)
Attempt to fold a variable-sized type to a constant-sized type, returning true if we were successful.
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
DeclContext * getCurLexicalContext() const
sema::FunctionScopeInfo * getCurFunction() const
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, const IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
void applyFunctionAttributesBeforeParsingBody(Decl *FD)
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
SourceManager & getSourceManager() const
TypeResult ActOnTypeName(Declarator &D)
ExternalSemaSource * getExternalSource() const
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.
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
CheckParmsForFunctionDef - Check that the parameters of the given function are appropriate for the de...
RedeclarationKind forRedeclarationInCurContext() const
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
IntrusiveRefCntPtr< ExternalSemaSource > ExternalSource
Source of additional semantic information.
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
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...
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
DiagnosticsEngine & Diags
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D.
llvm::BumpPtrAllocator BumpAlloc
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
void ProcessAPINotes(Decl *D)
Map any API notes provided for this declaration to attributes on the declaration.
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)
IdentifierResolver IdResolver
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.
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
SourceLocation getBeginLoc() const LLVM_READONLY
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
StringRef getPlatformName() const
Retrieve the name of the platform as it is used in the availability attribute.
VersionTuple getPlatformMinVersion() const
Retrieve the minimum desired version of the platform, to which the program should be compiled.
Represents a declaration of a type.
SourceLocation getBeginLoc() const LLVM_READONLY
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
SourceLocation getEndLoc() const
Get the end source location.
SourceLocation getBeginLoc() const
Get the begin source location.
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 isIncompleteArrayType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
bool isScalarType() const
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
bool containsErrors() const
Whether this type is an error type.
bool isObjCIdType() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isObjCObjectType() const
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
Qualifiers::ObjCLifetime getObjCARCImplicitLifetime() const
Return the implicit lifetime for this type, which must not be dependent.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isObjCObjectPointerType() const
bool isVectorType() const
bool isObjCQualifiedClassType() const
bool isObjCClassType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
bool isObjCIndependentClassType() const
Base class for declarations which introduce a typedef-name.
TypeSourceInfo * getTypeSourceInfo() const
QualType getUnderlyingType() const
Simple class containing the result of Sema::CorrectTypo.
DeclClass * getCorrectionDeclAs() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
Represents a variable declaration or definition.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
void setExceptionVariable(bool EV)
static DelayedDiagnostic makeForbiddenType(SourceLocation loc, unsigned diagnostic, QualType type, unsigned argument)
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.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
The JSON file list parser is used to communicate input to InstallAPI.
ThreadStorageClassSpecifier
Thread storage-class-specifier.
ObjCMethodFamily
A family of Objective-C methods.
@ OMF_None
No particular method family.
@ Property
The type of a property.
Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
@ Class
The "class" keyword.
AvailabilityResult
Captures the result of checking the availability of a declaration.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword.
const FunctionProtoType * T
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
std::pair< IdentifierInfo *, SourceLocation > IdentifierLocPair
A simple pair of identifier info and location.
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
Visibility
Describes the different kinds of visibility that a declaration may have.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc)
Return a DeclaratorChunk for a pointer.
a linked list of methods with the same selector name but different signatures.
ObjCMethodDecl * getMethod() const
void setMethod(ObjCMethodDecl *M)
void setNext(ObjCMethodList *L)
bool hasMoreThanOneDecl() const
ObjCMethodList * getNext() const
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
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