28 #include "llvm/ADT/DenseMap.h"
29 #include "llvm/ADT/DenseSet.h"
32 using namespace clang;
62 assert(resultClass &&
"unexpected object type!");
67 if (receiverTypeIfCall.
isNull() &&
77 if (receiverTypeIfCall.
isNull())
84 if (!receiverClass)
return false;
87 assert(receiverClass &&
"method not associated with a class!");
103 UnavailableAttr::IR_ARCInitReturnsUnrelated, loc));
108 Diag(loc, diag::err_arc_init_method_unrelated_result_type);
130 CurrentClass = Cat->getClassInterface();
131 else if (
ObjCImplDecl *Impl = dyn_cast<ObjCImplDecl>(DC))
132 CurrentClass = Impl->getClassInterface();
134 = dyn_cast<ObjCCategoryImplDecl>(DC))
135 CurrentClass = CatImpl->getClassInterface();
140 diag::warn_related_result_type_compatibility_class)
146 diag::warn_related_result_type_compatibility_protocol)
153 diag::note_related_result_type_family)
158 diag::note_related_result_type_overridden);
161 if ((NewMethod->
hasAttr<NSReturnsRetainedAttr>() !=
162 Overridden->
hasAttr<NSReturnsRetainedAttr>())) {
164 diag::err_nsreturns_retained_attribute_mismatch) << 1;
168 if ((NewMethod->
hasAttr<NSReturnsNotRetainedAttr>() !=
169 Overridden->
hasAttr<NSReturnsNotRetainedAttr>())) {
171 diag::err_nsreturns_retained_attribute_mismatch) << 0;
179 ni != ne && oi != oe; ++ni, ++oi) {
182 if (newDecl->
hasAttr<NSConsumedAttr>() !=
183 oldDecl->
hasAttr<NSConsumedAttr>()) {
185 diag::err_nsconsumed_attribute_mismatch);
233 if (method->
hasAttr<NSReturnsRetainedAttr>())
241 if (method->
hasAttr<NSReturnsRetainedAttr>() ||
242 method->
hasAttr<NSReturnsNotRetainedAttr>() ||
243 method->
hasAttr<NSReturnsAutoreleasedAttr>())
257 S.
Diag(ImplLoc, diag::warn_deprecated_def) << select;
327 for (
auto *Param : MDecl->
params()) {
328 if (!Param->isInvalidDecl() &&
331 Diag(Param->getLocation(), diag::warn_arc_strong_pointer_objc_pointer) <<
334 if (Param->getIdentifier())
377 ImplDeclOfMethodDecl = OID->getImplementation();
378 else if (
ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl)) {
379 if (CD->IsClassExtension()) {
381 ImplDeclOfMethodDecl = OID->getImplementation();
383 ImplDeclOfMethodDecl = CD->getImplementation();
387 if (!ImplDeclOfMethodDecl || ImplDeclOfMethodDecl != ImplDeclOfMethodDef)
389 dyn_cast<NamedDecl>(IMD),
397 IC->getSuperClass() !=
nullptr;
398 }
else if (IC->hasDesignatedInitializers()) {
424 (SuperMethod && SuperMethod->
hasAttr<ObjCRequiresSuperAttr>());
437 ObjCInterfaceValidatorCCC() : CurrentIDecl(nullptr) {}
439 : CurrentIDecl(IDecl) {}
441 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
455 unsigned NumProtoRefs,
460 for (
unsigned i = 0; i < NumProtoRefs; ++i) {
485 nullptr, llvm::make_unique<ObjCInterfaceValidatorCCC>(IDecl),
488 << SuperName << ClassName);
494 Diag(SuperLoc, diag::err_recursive_superclass)
495 << SuperName << ClassName <<
SourceRange(AtInterfaceLoc, ClassLoc);
499 dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
503 if (SuperClassDecl) {
508 if (PrevDecl && !SuperClassDecl) {
512 dyn_cast_or_null<TypedefNameDecl>(PrevDecl)) {
513 QualType T = TDecl->getUnderlyingType();
533 if (!SuperClassDecl) {
534 Diag(SuperLoc, diag::err_redefinition_different_kind) << SuperName;
539 if (!dyn_cast_or_null<TypedefNameDecl>(PrevDecl)) {
541 Diag(SuperLoc, diag::err_undef_superclass)
542 << SuperName << ClassName <<
SourceRange(AtInterfaceLoc, ClassLoc);
545 diag::err_forward_superclass,
548 SourceRange(AtInterfaceLoc, ClassLoc))) {
549 SuperClassDecl =
nullptr;
554 if (SuperClassType.isNull()) {
555 assert(!SuperClassDecl &&
"Failed to set SuperClassType?");
561 if (!SuperTypeArgs.empty()) {
569 SuperTypeArgsRange.
getEnd(),
581 if (!SuperClassTInfo) {
601 if (parsedTypeBound) {
612 diag::err_objc_type_param_bound_missing_pointer)
613 << typeBound << paramName
632 diag::err_objc_type_param_bound_nonobject)
633 << typeBound << paramName;
636 typeBoundInfo =
nullptr;
645 bool diagnosed =
false;
649 rangeToRemove = attr.getLocalSourceRange();
650 if (attr.getTypePtr()->getImmediateNullability()) {
651 Diag(attr.getLocStart(),
652 diag::err_objc_type_param_bound_explicit_nullability)
653 << paramName << typeBound
663 diag::err_objc_type_param_bound_qualified)
673 if (!quals.
empty()) {
683 if (!typeBoundInfo) {
690 index, paramLoc, paramName, colonLoc,
701 reinterpret_cast<ObjCTypeParamDecl * const *>(typeParamsIn.data()),
702 typeParamsIn.size());
708 llvm::SmallDenseMap<IdentifierInfo *, ObjCTypeParamDecl *> knownParams;
709 for (
auto typeParam : typeParams) {
710 auto known = knownParams.find(typeParam->getIdentifier());
711 if (known != knownParams.end()) {
712 Diag(typeParam->getLocation(), diag::err_objc_type_param_redecl)
713 << typeParam->getIdentifier()
716 typeParam->setInvalidDecl();
718 knownParams.insert(std::make_pair(typeParam->getIdentifier(), typeParam));
730 for (
auto typeParam : *typeParamList) {
731 if (!typeParam->isInvalidDecl()) {
757 if (prevTypeParams->
size() != newTypeParams->
size()) {
759 if (newTypeParams->
size() > prevTypeParams->
size()) {
760 diagLoc = newTypeParams->
begin()[prevTypeParams->
size()]->getLocation();
765 S.
Diag(diagLoc, diag::err_objc_type_param_arity_mismatch)
766 <<
static_cast<unsigned>(newContext)
767 << (newTypeParams->
size() > prevTypeParams->
size())
768 << prevTypeParams->
size()
769 << newTypeParams->
size();
775 for (
unsigned i = 0, n = prevTypeParams->
size(); i != n; ++i) {
782 newContext != TypeParamListContext::Definition) {
801 auto diag = S.
Diag(diagLoc,
802 diag::err_objc_type_param_variance_conflict)
803 <<
static_cast<unsigned>(newTypeParam->
getVariance())
805 <<
static_cast<unsigned>(prevTypeParam->
getVariance())
814 StringRef newVarianceStr
821 (newVarianceStr +
" ").str());
848 S.
Diag(newBoundRange.
getBegin(), diag::err_objc_type_param_bound_conflict)
873 if (newContext == TypeParamListContext::ForwardDeclaration ||
874 newContext == TypeParamListContext::Definition) {
882 diag::err_objc_type_param_bound_missing)
885 << (newContext == TypeParamListContext::ForwardDeclaration)
907 Decl *
const *ProtoRefs,
unsigned NumProtoRefs,
910 assert(ClassName &&
"Missing class identifier");
916 if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
917 Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
948 TypeParamListContext::Definition)) {
949 typeParamList =
nullptr;
952 Diag(ClassLoc, diag::err_objc_parameterized_forward_class_first)
954 Diag(prevTypeParamList->getLAngleLoc(), diag::note_previous_decl)
959 for (
auto typeParam : *prevTypeParamList) {
960 clonedTypeParams.push_back(
964 typeParam->getVariance(),
966 typeParam->getIndex(),
968 typeParam->getIdentifier(),
983 typeParamList, PrevIDecl, ClassLoc);
987 Diag(AtInterfaceLoc, diag::err_duplicate_class_def)
989 Diag(Def->getLocation(), diag::note_previous_definition);
1008 ClassName, ClassLoc,
1009 SuperName, SuperLoc, SuperTypeArgs,
1010 SuperTypeArgsRange);
1018 NumProtoRefs, ProtoLocs);
1041 if (
const TypedefNameDecl *TDecl = dyn_cast_or_null<TypedefNameDecl>(IDecl)) {
1042 QualType T = TDecl->getUnderlyingType();
1045 ProtocolRefs.append(OPT->qual_begin(), OPT->qual_end());
1060 Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
1068 dyn_cast_or_null<TypedefNameDecl>(CDeclU)) {
1069 QualType T = TDecl->getUnderlyingType();
1072 ClassName = IDecl->getIdentifier();
1080 Diag(ClassLocation, diag::warn_undef_interface) << ClassName;
1103 E = PList.
end();
I !=
E; ++
I) {
1106 if (PDecl->getIdentifier() == PName) {
1107 Diag(Ploc, diag::err_protocol_has_circular_dependency);
1108 Diag(PrevLoc, diag::note_previous_definition);
1112 if (!PDecl->hasDefinition())
1116 PDecl->getLocation(), PDecl->getReferencedProtocols()))
1127 Decl *
const *ProtoRefs,
1128 unsigned NumProtoRefs,
1134 assert(ProtocolName &&
"Missing protocol identifier");
1140 Diag(ProtocolLoc, diag::warn_duplicate_protocol_def) << ProtocolName;
1141 Diag(Def->getLocation(), diag::note_previous_definition);
1148 ProtocolLoc, AtProtoInterfaceLoc,
1150 PDecl->startDefinition();
1158 ProtocolName, ProtocolLoc, PrevDecl->
getLocation(), PList);
1163 ProtocolLoc, AtProtoInterfaceLoc,
1177 if (!err && NumProtoRefs ) {
1180 NumProtoRefs, ProtoLocs);
1192 UndefinedProtocol = PDecl;
1198 UndefinedProtocol = PI;
1225 Diag(Pair.second, diag::err_undeclared_protocol) << Pair.first;
1234 if (!ForObjCContainer) {
1243 if (WarnOnDeclarations &&
1245 Diag(Pair.second, diag::warn_undef_protocolref) << Pair.first;
1246 Diag(UndefinedProtocol->
getLocation(), diag::note_protocol_decl_undefined)
1247 << UndefinedProtocol;
1249 Protocols.push_back(PDecl);
1260 ObjCTypeArgOrProtocolValidatorCCC(
ASTContext &context,
1262 :
Context(context), LookupKind(lookupKind) { }
1264 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
1284 if (
type->isObjCObjectPointerType() ||
1285 type->isBlockPointerType() ||
1286 type->isDependentType() ||
1287 type->isObjCObjectType())
1319 bool warnOnIncompleteProtocols) {
1322 unsigned numProtocolsResolved = 0;
1323 auto resolvedAsProtocols = [&] {
1324 assert(numProtocolsResolved == identifiers.size() &&
"Unresolved protocols");
1331 bool allAreTypeNames =
false;
1335 baseClass = objcObjectType->getInterface();
1337 if (
auto typeParams = baseClass->getTypeParamList()) {
1338 if (typeParams->size() == numProtocolsResolved) {
1340 allAreTypeNames =
true;
1347 for (
unsigned i = 0, n = protocols.size(); i != n; ++i) {
1352 if (!warnOnIncompleteProtocols) {
1364 if (warnOnIncompleteProtocols &&
1366 Diag(identifierLocs[i], diag::warn_undef_protocolref)
1375 if (allAreTypeNames) {
1378 if (isa<ObjCInterfaceDecl>(
decl)) {
1380 firstClassNameLoc = identifierLocs[i];
1381 }
else if (!isa<TypeDecl>(
decl)) {
1383 allAreTypeNames =
false;
1386 allAreTypeNames =
false;
1395 if (allAreTypeNames && firstClassNameLoc.
isValid()) {
1396 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> knownProtocols;
1398 bool allProtocolsDeclared =
true;
1399 for (
auto proto : protocols) {
1400 if (knownProtocols.count(static_cast<ObjCProtocolDecl *>(proto)) == 0) {
1401 allProtocolsDeclared =
false;
1406 if (allProtocolsDeclared) {
1407 Diag(firstClassNameLoc, diag::warn_objc_redundant_qualified_class_type)
1408 << baseClass->getDeclName() <<
SourceRange(lAngleLoc, rAngleLoc)
1414 protocolLAngleLoc = lAngleLoc;
1415 protocolRAngleLoc = rAngleLoc;
1416 assert(protocols.size() == identifierLocs.size());
1420 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1422 protocols.push_back(proto);
1424 ++numProtocolsResolved;
1428 if (numProtocolsResolved == identifiers.size())
1429 return resolvedAsProtocols();
1435 typedef llvm::PointerUnion<TypeDecl *, ObjCInterfaceDecl *> TypeOrClassDecl;
1437 unsigned numTypeDeclsResolved = 0;
1438 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1442 typeDecls.push_back(TypeOrClassDecl());
1446 if (
auto typeDecl = dyn_cast<TypeDecl>(decl)) {
1447 typeDecls.push_back(typeDecl);
1448 ++numTypeDeclsResolved;
1452 if (
auto objcClass = dyn_cast<ObjCInterfaceDecl>(decl)) {
1453 typeDecls.push_back(objcClass);
1454 ++numTypeDeclsResolved;
1458 typeDecls.push_back(TypeOrClassDecl());
1465 auto resolveTypeReference = [&](TypeOrClassDecl typeDecl,
SourceLocation loc)
1469 const char* prevSpec;
1472 if (
auto *actualTypeDecl = typeDecl.dyn_cast<
TypeDecl *>())
1501 Diag(loc, diag::err_objc_type_arg_missing_star)
1512 auto resolvedAsTypeDecls = [&] {
1516 assert(numTypeDeclsResolved == identifiers.size() &&
"Unresolved type decl");
1518 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1520 TypeResult type = resolveTypeReference(typeDecls[i], identifierLocs[i]);
1526 typeArgs.push_back(type.
get());
1529 typeArgsLAngleLoc = lAngleLoc;
1530 typeArgsRAngleLoc = rAngleLoc;
1535 if (numTypeDeclsResolved == identifiers.size())
1536 return resolvedAsTypeDecls();
1542 for (
unsigned i = 0, n = identifiers.size(); i != n; ++i) {
1545 if (protocols[i] || typeDecls[i]) {
1551 if (protocols[i] && typeDecls[i])
1573 Diag(identifierLocs[i], diag::err_objc_type_args_and_protocols)
1574 << (protocols[i] !=
nullptr)
1588 llvm::make_unique<ObjCTypeArgOrProtocolValidatorCCC>(
Context,
1595 PDiag(diag::err_undeclared_protocol_suggest)
1598 protocols[i] = proto;
1599 ++numProtocolsResolved;
1606 PDiag(diag::err_unknown_typename_suggest)
1609 typeDecls[i] = typeDecl;
1610 ++numTypeDeclsResolved;
1617 PDiag(diag::err_unknown_type_or_class_name_suggest)
1618 << identifiers[i] <<
true);
1620 typeDecls[i] = objcClass;
1621 ++numTypeDeclsResolved;
1627 Diag(identifierLocs[i],
1628 (lookupKind ==
LookupAnyName ? diag::err_objc_type_arg_missing
1630 : diag::err_unknown_typename))
1639 if (numProtocolsResolved == identifiers.size())
1640 return resolvedAsProtocols();
1643 assert(numTypeDeclsResolved == identifiers.size() &&
"Not all types?");
1644 return resolvedAsTypeDecls();
1655 llvm::DenseMap<Selector, const ObjCMethodDecl*> MethodMap;
1656 for (
auto *MD : ID->
methods())
1657 MethodMap[MD->getSelector()] = MD;
1659 if (MethodMap.empty())
1661 for (
const auto *Method : CAT->
methods()) {
1662 const ObjCMethodDecl *&PrevMethod = MethodMap[Method->getSelector()];
1666 Diag(Method->getLocation(), diag::err_duplicate_method_decl)
1667 << Method->getDeclName();
1685 IdentPair.second, AtProtocolLoc,
1697 DeclsInGroup.push_back(PDecl);
1709 Decl *
const *ProtoRefs,
1710 unsigned NumProtoRefs,
1720 diag::err_category_forward_interface,
1721 CategoryName ==
nullptr)) {
1726 ClassLoc, CategoryLoc, CategoryName,
1727 IDecl, typeParamList);
1732 Diag(ClassLoc, diag::err_undef_interface) << ClassName;
1737 Diag(ClassLoc, diag::err_class_extension_after_impl) << ClassName;
1739 diag::note_implementation_declared);
1747 Diag(CategoryLoc, diag::warn_dup_category_def)
1748 << ClassName << CategoryName;
1749 Diag(
Previous->getLocation(), diag::note_previous_definition);
1754 if (typeParamList) {
1759 : TypeParamListContext::Extension))
1760 typeParamList =
nullptr;
1763 diag::err_objc_parameterized_category_nonclass)
1764 << (CategoryName !=
nullptr)
1768 typeParamList =
nullptr;
1773 ClassLoc, CategoryLoc, CategoryName, IDecl,
1780 NumProtoRefs, ProtoLocs);
1817 ClassLoc, AtCatImplLoc, CatLoc);
1820 Diag(ClassLoc, diag::err_undef_interface) << ClassName;
1823 diag::err_undef_interface)) {
1837 Diag(ClassLoc, diag::err_dup_implementation_category) << ClassName
1840 diag::note_previous_definition);
1847 dyn_cast<NamedDecl>(IDecl),
1866 if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
1867 Diag(ClassLoc, diag::err_redefinition_different_kind) << ClassName;
1869 }
else if ((IDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl))) {
1873 diag::warn_undef_interface);
1879 nullptr, llvm::make_unique<ObjCInterfaceValidatorCCC>(),
CTK_NonError);
1885 PDiag(diag::warn_undef_interface_suggest) << ClassName,
1888 Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
1894 if (SuperClassname) {
1898 if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
1899 Diag(SuperClassLoc, diag::err_redefinition_different_kind)
1903 SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
1907 Diag(SuperClassLoc, diag::err_undef_superclass)
1908 << SuperClassname << ClassName;
1912 Diag(SuperClassLoc, diag::err_conflicting_super_class)
1950 ClassLoc, AtClassImplLoc, SuperClassLoc);
1958 Diag(ClassLoc, diag::err_dup_implementation_class) << ClassName;
1960 diag::note_previous_definition);
1968 dyn_cast<NamedDecl>(IDecl),
1977 DeclsInGroup.reserve(Decls.size() + 1);
1979 for (
unsigned i = 0, e = Decls.size(); i != e; ++i) {
1980 Decl *Dcl = Decls[i];
1985 DeclsInGroup.push_back(Dcl);
1988 DeclsInGroup.push_back(ObjCImpDecl);
1996 assert(ImpDecl &&
"missing implementation decl");
2006 for (
unsigned i = 0, e = numIvars; i != e; ++i) {
2018 assert(ivars &&
"missing @implementation ivars");
2022 for (
unsigned i = 0; i < numIvars; i++) {
2027 Diag(ClsIvar->getLocation(), diag::note_previous_definition);
2035 Diag(ClsExtIvar->getLocation(), diag::note_previous_definition);
2052 for (; numIvars > 0 && IVI != IVE; ++IVI) {
2055 assert (ImplIvar &&
"missing implementation ivar");
2056 assert (ClsIvar &&
"missing class ivar");
2068 diag::err_conflicting_ivar_bitwidth) << ImplIvar->
getIdentifier();
2070 diag::note_previous_definition);
2082 Diag(ivars[j]->getLocation(), diag::err_inconsistent_ivar_count);
2083 else if (IVI != IVE)
2084 Diag(IVI->getLocation(), diag::err_inconsistent_ivar_count);
2089 bool &IncompleteImpl,
2119 S.
Diag(MethodLoc, diag::note_method_declared_at) << method;
2197 (y & ~
Decl::OBJC_TQ_CSNullability);
2203 bool IsProtocolMethodDecl,
2204 bool IsOverridingMode,
2206 if (IsProtocolMethodDecl &&
2212 ? diag::warn_conflicting_overriding_ret_type_modifiers
2213 : diag::warn_conflicting_ret_type_modifiers))
2222 if (Warn && IsOverridingMode &&
2227 auto nullabilityMethodImpl =
2229 auto nullabilityMethodDecl =
2232 diag::warn_conflicting_nullability_attr_overriding_ret_types)
2234 nullabilityMethodImpl,
2238 nullabilityMethodDecl,
2251 IsOverridingMode ? diag::warn_conflicting_overriding_ret_types
2252 : diag::warn_conflicting_ret_types;
2268 IsOverridingMode ? diag::warn_non_covariant_overriding_ret_types
2269 : diag::warn_non_covariant_ret_types;
2278 ? diag::note_previous_declaration
2279 : diag::note_previous_definition)
2289 bool IsProtocolMethodDecl,
2290 bool IsOverridingMode,
2292 if (IsProtocolMethodDecl &&
2296 if (IsOverridingMode)
2298 diag::warn_conflicting_overriding_param_modifiers)
2302 diag::warn_conflicting_param_modifiers)
2314 if (Warn && IsOverridingMode &&
2318 diag::warn_conflicting_nullability_attr_overriding_param_types)
2335 IsOverridingMode ? diag::warn_conflicting_overriding_param_types
2336 : diag::warn_conflicting_param_types;
2352 IsOverridingMode ? diag::warn_non_contravariant_overriding_param_types
2353 : diag::warn_non_contravariant_param_types;
2359 << MethodImpl->
getDeclName() << IfaceTy << ImplTy;
2361 (IsOverridingMode ? diag::note_previous_declaration
2362 : diag::note_previous_definition))
2373 if (implFamily == declFamily)
return false;
2385 unsigned errorID = diag::err_arc_lost_method_convention;
2386 unsigned noteID = diag::note_arc_lost_method_convention;
2389 family = implFamily;
2390 errorID = diag::err_arc_gained_method_convention;
2391 noteID = diag::note_arc_gained_method_convention;
2395 enum FamilySelector {
2396 F_alloc, F_copy, F_mutableCopy = F_copy, F_init, F_new
2398 FamilySelector familySelector = FamilySelector();
2401 case OMF_None: llvm_unreachable(
"logic error, no method convention");
2415 case OMF_init: familySelector = F_init;
break;
2416 case OMF_alloc: familySelector = F_alloc;
break;
2417 case OMF_copy: familySelector = F_copy;
break;
2419 case OMF_new: familySelector = F_new;
break;
2422 enum ReasonSelector { R_NonObjectReturn, R_UnrelatedReturn };
2423 ReasonSelector reasonSelector;
2428 reasonSelector = R_UnrelatedReturn;
2430 reasonSelector = R_NonObjectReturn;
2433 S.
Diag(impl->
getLocation(), errorID) <<
int(familySelector) << int(reasonSelector);
2434 S.
Diag(decl->
getLocation(), noteID) <<
int(familySelector) << int(reasonSelector);
2441 bool IsProtocolMethodDecl) {
2447 IsProtocolMethodDecl,
false,
2453 IM != EM && IF != EF; ++IM, ++IF) {
2455 IsProtocolMethodDecl,
false,
true);
2460 diag::warn_conflicting_variadic);
2467 bool IsProtocolMethodDecl) {
2470 IsProtocolMethodDecl,
true,
2476 IM != EM && IF != EF; ++IM, ++IF) {
2478 IsProtocolMethodDecl,
true,
true);
2483 diag::warn_conflicting_overriding_variadic);
2492 bool IsProtocolMethodDecl) {
2500 if (MethodDecl->
hasAttr<UnavailableAttr>() ||
2501 MethodDecl->
hasAttr<DeprecatedAttr>())
2505 IsProtocolMethodDecl,
false,
false);
2510 IM != EM && IF != EF; ++IM, ++IF) {
2513 IsProtocolMethodDecl,
false,
false);
2525 diag::warn_category_method_impl_match);
2542 if (PDecl->
hasAttr<ObjCExplicitProtocolImplAttr>())
2544 for (
const auto *PI : PDecl->
protocols())
2567 bool& IncompleteImpl,
2575 assert (IDecl &&
"CheckProtocolMethodDefs - IDecl is null");
2591 if (PDecl->
hasAttr<ObjCExplicitProtocolImplAttr>()) {
2592 if (!ProtocolsExplictImpl) {
2597 ProtocolsExplictImpl->end())
2615 if (InsMap.count(fISelector))
2635 !method->isPropertyAccessor() &&
2636 !InsMap.count(method->getSelector()) &&
2652 IDecl->lookupMethod(method->getSelector(),
2656 if (C || MethodInClass->isPropertyAccessor())
2658 unsigned DIAG = diag::warn_unimplemented_protocol_method;
2668 !ClsMap.count(method->getSelector()) &&
2675 if (C && IDecl->lookupMethod(method->getSelector(),
2681 unsigned DIAG = diag::warn_unimplemented_protocol_method;
2690 CDecl, ProtocolsExplictImpl);
2702 bool &IncompleteImpl,
2703 bool ImmediateClass,
2704 bool WarnCategoryMethodImpl) {
2708 if (!InsMapSeen.insert(
I->getSelector()).second)
2710 if (!
I->isPropertyAccessor() &&
2711 !InsMap.count(
I->getSelector())) {
2714 diag::warn_undef_method_impl);
2720 "Expected to find the method through lookup as well");
2722 if (ImpMethodDecl) {
2723 if (!WarnCategoryMethodImpl)
2725 isa<ObjCProtocolDecl>(CDecl));
2726 else if (!
I->isPropertyAccessor())
2735 if (!ClsMapSeen.insert(
I->getSelector()).second)
2737 if (!ClsMap.count(
I->getSelector())) {
2740 diag::warn_undef_method_impl);
2745 "Expected to find the method through lookup as well");
2746 if (!WarnCategoryMethodImpl)
2748 isa<ObjCProtocolDecl>(CDecl));
2751 isa<ObjCProtocolDecl>(CDecl));
2758 for (
auto *PI : PD->protocols())
2760 IMPDecl, PI, IncompleteImpl,
false,
2761 WarnCategoryMethodImpl);
2768 if (!WarnCategoryMethodImpl) {
2769 for (
auto *Cat :
I->visible_categories())
2771 IMPDecl, Cat, IncompleteImpl,
2772 ImmediateClass && Cat->IsClassExtension(),
2773 WarnCategoryMethodImpl);
2776 for (
auto *Ext :
I->visible_extensions())
2778 IMPDecl, Ext, IncompleteImpl,
false,
2779 WarnCategoryMethodImpl);
2783 for (
auto *PI :
I->all_referenced_protocols())
2785 IMPDecl, PI, IncompleteImpl,
false,
2786 WarnCategoryMethodImpl);
2790 if (!WarnCategoryMethodImpl &&
I->getSuperClass())
2793 I->getSuperClass(), IncompleteImpl,
false);
2824 if (SuperIDecl && SuperIDecl->
lookupMethod(Sel,
false))
2828 if (InsMap.empty() && ClsMap.empty())
2832 bool IncompleteImpl =
false;
2835 IncompleteImpl,
false,
2841 bool IncompleteImpl) {
2846 InsMap.insert(
I->getSelector());
2854 const auto *
P = PImpl->getPropertyDecl();
2857 InsMap.insert(
P->getGetterName());
2858 if (!
P->getSetterName().isNull())
2859 InsMap.insert(
P->getSetterName());
2866 bool SynthesizeProperties =
LangOpts.ObjCDefaultSynthProperties &&
2868 !IDecl->isObjCRequiresPropertyDefs();
2877 ClsMap.insert(
I->getSelector());
2884 IncompleteImpl,
true);
2889 dyn_cast<ObjCCategoryImplDecl>(IMPDecl))
2900 for (
auto *PI :
I->all_referenced_protocols())
2902 InsMap, ClsMap,
I, ExplicitImplProtocols);
2906 if (!
C->IsClassExtension()) {
2907 for (
auto *
P :
C->protocols())
2909 IncompleteImpl, InsMap, ClsMap, CDecl,
2910 ExplicitImplProtocols);
2915 llvm_unreachable(
"invalid ObjCContainerDecl type.");
2925 for (
unsigned i = 0; i != NumElts; ++i) {
2930 if (PrevDecl && !isa<ObjCInterfaceDecl>(PrevDecl)) {
2940 Diag(AtClassLoc, diag::err_redefinition_different_kind) << IdentList[i];
2948 Diag(AtClassLoc, diag::warn_forward_class_redefinition)
2958 = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
2980 if (PrevIDecl && TypeParams) {
2984 *
this, PrevTypeParams, TypeParams,
2985 TypeParamListContext::ForwardDeclaration)) {
2986 TypeParams =
nullptr;
2990 Diag(IdentLocs[i], diag::err_objc_parameterized_forward_class)
2993 Diag(Def->getLocation(), diag::note_defined_here)
2996 TypeParams =
nullptr;
3002 ClassName, TypeParams, PrevIDecl,
3008 DeclsInGroup.push_back(IDecl);
3016 const Type *left,
const Type *right);
3025 if (left == right)
return true;
3048 if (isa<VectorType>(left))
return isa<VectorType>(right);
3049 if (isa<VectorType>(right))
return false;
3072 return (leftSK == rightSK);
3078 assert(lt && rt && lt != rt);
3080 if (!isa<RecordType>(lt) || !isa<RecordType>(rt))
return false;
3081 RecordDecl *left = cast<RecordType>(lt)->getDecl();
3082 RecordDecl *right = cast<RecordType>(rt)->getDecl();
3088 if ((isa<CXXRecordDecl>(left) && !cast<CXXRecordDecl>(left)->isPOD()) ||
3089 (isa<CXXRecordDecl>(right) && !cast<CXXRecordDecl>(right)->isPOD()))
3104 for (; li != le && ri != re; ++li, ++ri) {
3105 if (!
matchTypes(Context, strategy, li->getType(), ri->getType()))
3108 return (li == le && ri == re);
3126 (left->
hasAttr<NSReturnsRetainedAttr>()
3127 != right->
hasAttr<NSReturnsRetainedAttr>() ||
3128 left->
hasAttr<NSConsumesSelfAttr>()
3129 != right->
hasAttr<NSConsumesSelfAttr>()))
3136 for (; li != le && ri != re; ++li, ++ri) {
3137 assert(ri != right->
param_end() &&
"Param mismatch");
3144 lparm->hasAttr<NSConsumedAttr>() != rparm->hasAttr<NSConsumedAttr>())
3156 if (!CD->IsClassExtension() && List->
getBits() < 2)
3169 for (; List; Previous = List, List = List->
getNext()) {
3193 List->setHasMoreThanOneDecl(
true);
3200 List->setMethod(Method);
3206 List->setMethod(Method);
3221 assert(ExternalSource &&
"We need an external AST source");
3225 void Sema::AddMethodToGlobalPool(
ObjCMethodDecl *Method,
bool impl,
3241 ObjCMethodList &Entry = instance ? Pos->second.first : Pos->second.second;
3273 ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
3275 if (M->getMethod() && !M->getMethod()->isHidden())
3276 Methods.push_back(M->getMethod());
3277 return Methods.size() > 1;
3282 bool receiverIdOrClass) {
3293 Methods.push_back(BestMethod);
3296 if (!M->isHidden() && M != BestMethod && !M->
hasAttr<UnavailableAttr>())
3297 Methods.push_back(M);
3298 if (Methods.size() > 1)
3305 bool receiverIdOrClass,
3315 ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
3318 if (M->getMethod() && !M->getMethod()->isHidden())
3319 return M->getMethod();
3326 bool receiverIdOrClass) {
3328 bool issueDiagnostic =
false, issueError =
false;
3332 bool strictSelectorMatch =
3333 receiverIdOrClass &&
3335 if (strictSelectorMatch) {
3336 for (
unsigned I = 1, N = Methods.size();
I != N; ++
I) {
3338 issueDiagnostic =
true;
3347 if (!strictSelectorMatch ||
3348 (issueDiagnostic &&
getLangOpts().ObjCAutoRefCount))
3349 for (
unsigned I = 1, N = Methods.size();
I != N; ++
I) {
3353 issueDiagnostic =
true;
3360 if (issueDiagnostic) {
3362 Diag(R.
getBegin(), diag::err_arc_multiple_method_decl) << Sel << R;
3363 else if (strictSelectorMatch)
3364 Diag(R.
getBegin(), diag::warn_strict_multiple_method_decl) << Sel << R;
3366 Diag(R.
getBegin(), diag::warn_multiple_method_decl) << Sel << R;
3368 Diag(Methods[0]->getLocStart(),
3369 issueError ? diag::note_possibility : diag::note_using)
3370 << Methods[0]->getSourceRange();
3371 for (
unsigned I = 1, N = Methods.size();
I != N; ++
I) {
3372 Diag(Methods[
I]->getLocStart(), diag::note_also_found)
3373 << Methods[
I]->getSourceRange();
3385 Method = Method->getNext())
3386 if (Method->getMethod() &&
3389 return Method->getMethod();
3392 Method = Method->getNext())
3393 if (Method->getMethod() &&
3396 return Method->getMethod();
3408 unsigned MinPossibleEditDistance = abs((
int)MethodName.size() - (int)Typo.size());
3409 if (MinPossibleEditDistance > 0 &&
3410 Typo.size() / MinPossibleEditDistance < 1)
3412 unsigned EditDistance = Typo.edit_distance(MethodName,
true, MaxEditDistance);
3413 if (EditDistance > MaxEditDistance)
3415 if (EditDistance == BestEditDistance)
3416 BestMethod.push_back(Method);
3417 else if (EditDistance < BestEditDistance) {
3419 BestMethod.push_back(Method);
3438 bool ObjectIsId =
true, ObjectIsClass =
true;
3440 ObjectIsId = ObjectIsClass =
false;
3445 ObjectType =
QualType(ObjCPtr->getInterfaceType(), 0);
3446 ObjectIsId = ObjectIsClass =
false;
3449 ObjectIsClass =
false;
3459 if (M->getMethod() &&
3460 (M->getMethod()->getSelector().getNumArgs() ==
NumArgs) &&
3461 (M->getMethod()->getSelector() != Sel)) {
3463 Methods.push_back(M->getMethod());
3464 else if (!ObjectIsClass &&
3467 Methods.push_back(M->getMethod());
3471 if (M->getMethod() &&
3472 (M->getMethod()->getSelector().getNumArgs() ==
NumArgs) &&
3473 (M->getMethod()->getSelector() != Sel)) {
3475 Methods.push_back(M->getMethod());
3476 else if (!ObjectIsId &&
3479 Methods.push_back(M->getMethod());
3484 for (
unsigned i = 0, e = Methods.size(); i < e; i++) {
3488 return (SelectedMethods.size() == 1) ? SelectedMethods[0] :
nullptr;
3498 for (
auto *Ivar : ID->
ivars()) {
3499 if (Ivar->isInvalidDecl())
3504 Diag(Ivar->getLocation(), diag::err_duplicate_member) << II;
3506 Ivar->setInvalidDecl();
3518 if (ivar->isInvalidDecl())
continue;
3521 S.
Diag(ivar->getLocation(), diag::err_arc_weak_disabled);
3523 S.
Diag(ivar->getLocation(), diag::err_arc_weak_no_runtime);
3531 case Decl::ObjCInterface:
3533 case Decl::ObjCProtocol:
3535 case Decl::ObjCCategory:
3536 if (cast<ObjCCategoryDecl>(
CurContext)->IsClassExtension())
3539 case Decl::ObjCImplementation:
3541 case Decl::ObjCCategoryImpl:
3555 assert(AtEnd.
isValid() &&
"Invalid location for '@end'");
3558 Decl *ClassDecl = cast<Decl>(OCD);
3560 bool isInterfaceDeclKind =
3561 isa<ObjCInterfaceDecl>(ClassDecl) || isa<ObjCCategoryDecl>(ClassDecl)
3562 || isa<ObjCProtocolDecl>(ClassDecl);
3563 bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
3566 llvm::DenseMap<Selector, const ObjCMethodDecl*> InsMap;
3567 llvm::DenseMap<Selector, const ObjCMethodDecl*> ClsMap;
3569 for (
unsigned i = 0, e = allMethods.size(); i != e; i++ ) {
3571 cast_or_null<ObjCMethodDecl>(allMethods[i]);
3573 if (!Method)
continue;
3579 if ((isInterfaceDeclKind && PrevMethod && !match)
3580 || (checkIdenticalMethods && match)) {
3603 if ((isInterfaceDeclKind && PrevMethod && !match)
3604 || (checkIdenticalMethods && match)) {
3623 if (isa<ObjCInterfaceDecl>(ClassDecl)) {
3630 if (
C->IsClassExtension()) {
3636 if (CDecl->getIdentifier())
3640 for (
auto *
I : CDecl->properties())
3642 CDecl->setAtEndRange(AtEnd);
3645 IC->setAtEndRange(AtEnd);
3652 for (
const auto *Ext : IDecl->visible_extensions()) {
3653 for (
const auto *
Property : Ext->properties()) {
3656 = IC->FindPropertyImplDecl(
Property->getIdentifier()))
3657 if (PIDecl->getPropertyImplementation()
3661 for (
const auto *Ext : IDecl->visible_extensions()) {
3663 = Ext->getInstanceMethod(
Property->getGetterName()))
3664 GetterMethod->setPropertyAccessor(
true);
3667 = Ext->getInstanceMethod(
Property->getSetterName()))
3668 SetterMethod->setPropertyAccessor(
true);
3676 if (IDecl->hasDesignatedInitializers())
3680 bool HasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
3681 if (IDecl->getSuperClass() ==
nullptr) {
3684 if (!HasRootClassAttr) {
3687 Diag(DeclLoc, diag::warn_objc_root_class_missing)
3688 << IDecl->getIdentifier();
3695 if (NSObjectDecl && NSObjectDecl->getDefinition()) {
3696 Diag(SuperClassLoc, diag::note_objc_needs_superclass)
3699 Diag(SuperClassLoc, diag::note_objc_needs_superclass);
3702 }
else if (HasRootClassAttr) {
3704 Diag(IDecl->getLocation(), diag::err_objc_root_class_subclass);
3708 while (IDecl->getSuperClass()) {
3710 IDecl = IDecl->getSuperClass();
3716 dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
3717 CatImplClass->setAtEndRange(AtEnd);
3723 = IDecl->FindCategoryDeclaration(CatImplClass->getIdentifier())) {
3728 if (isInterfaceDeclKind) {
3730 for (
unsigned i = 0, e = allTUVars.size(); i != e; i++) {
3733 if (
VarDecl *VDecl = dyn_cast<VarDecl>(*
I)) {
3734 if (!VDecl->hasExternalStorage())
3735 Diag(VDecl->getLocation(), diag::err_objc_var_decl_inclass);
3741 for (
unsigned i = 0, e = allTUVars.size(); i != e; i++) {
3744 (*I)->setTopLevelDeclInObjCContainer();
3773 if (ResultObjectType->isObjCIdType() ||
3774 ResultObjectType->isObjCQualifiedIdType())
3779 = ResultObjectType->getInterfaceDecl()) {
3785 if (ResultClass->isSuperClassOf(CurrentClass))
3801 class OverrideSearch {
3805 llvm::SmallPtrSet<ObjCMethodDecl*, 4> Overridden;
3834 searchFromContainer(container);
3836 searchFromContainer(Interface);
3838 searchFromContainer(container);
3851 #define OBJCCONTAINER(type, base) \
3853 searchFrom(cast<type##Decl>(container)); \
3855 #define ABSTRACT_DECL(expansion)
3856 #define DECL(type, base) \
3858 #include "clang/AST/DeclNodes.inc"
3859 llvm_unreachable(
"not an ObjC container!");
3932 Overridden.insert(meth);
3942 searchFromContainer(container);
3951 OverrideSearch overrides(*
this, ObjCMethod);
3957 bool hasOverriddenMethodsInBaseOrProtocol =
false;
3958 for (OverrideSearch::iterator
3959 i = overrides.begin(), e = overrides.end(); i != e; ++i) {
3962 if (!hasOverriddenMethodsInBaseOrProtocol) {
3966 hasOverriddenMethodsInBaseOrProtocol =
true;
3981 unsigned CategCount = List.
getBits();
3982 if (CategCount > 0) {
3985 if (CategCount > 1 ||
3987 OverrideSearch overrides(*
this, overridden);
3988 for (OverrideSearch::iterator
3989 OI= overrides.begin(), OE= overrides.end(); OI!=OE; ++OI) {
3993 hasOverriddenMethodsInBaseOrProtocol =
true;
4020 if (CurrentClass && overridden->
getDeclContext() != CurrentClass &&
4027 for (; ParamI !=
E && PrevI != PrevE; ++ParamI, ++PrevI) {
4028 assert(PrevI != overridden->
param_end() &&
"Param mismatch");
4034 Diag((*ParamI)->getLocation(), diag::ext_typecheck_base_super)
4043 ObjCMethod->
setOverriding(hasOverriddenMethodsInBaseOrProtocol);
4053 bool prevUsesCSKeyword) {
4059 if (nullability.hasValue() == prevNullability.hasValue()) {
4065 if (*nullability == *prevNullability)
4069 S.
Diag(loc, diag::err_nullability_conflicting)
4092 if (prevMethod->
hasAttr<ObjCRequiresSuperAttr>() &&
4093 !method->
hasAttr<ObjCRequiresSuperAttr>()) {
4096 ObjCRequiresSuperAttr::CreateImplicit(S.
Context,
4113 unsigned numPrevParams = prevMethod->
param_size();
4114 for (
unsigned i = 0, n = std::min(numParams, numPrevParams); i != n; ++i) {
4141 bool isVariadic,
bool MethodDefinition) {
4144 Diag(MethodLoc, diag::error_missing_method_context);
4148 Decl *ClassDecl = cast<Decl>(OCD);
4151 bool HasRelatedResultType =
false;
4159 QualType bareResultType = resultDeclType;
4164 Diag(MethodLoc, diag::warn_missing_method_return_type)
4170 MethodType == tok::minus, isVariadic,
4175 HasRelatedResultType);
4179 for (
unsigned i = 0, e = Sel.
getNumArgs(); i != e; ++i) {
4183 if (!ArgInfo[i].
Type) {
4196 Diag(ArgInfo[i].NameLoc,
4197 (MethodDefinition ? diag::warn_method_param_redefinition
4198 : diag::warn_method_param_declaration))
4201 diag::note_previous_declaration);
4210 ArgInfo[i].NameLoc, ArgInfo[i].Name,
4221 if (Param->
hasAttr<BlocksAttr>()) {
4228 Params.push_back(Param);
4231 for (
unsigned i = 0, e = CNumArgs; i != e; ++i) {
4234 if (ArgType.isNull())
4241 Params.push_back(Param);
4253 if (
ObjCImplDecl *ImpDecl = dyn_cast<ObjCImplDecl>(ClassDecl)) {
4254 if (MethodType == tok::minus) {
4255 PrevMethod = ImpDecl->getInstanceMethod(Sel);
4256 ImpDecl->addInstanceMethod(ObjCMethod);
4258 PrevMethod = ImpDecl->getClassMethod(Sel);
4259 ImpDecl->addClassMethod(ObjCMethod);
4265 if (
auto *IMD = IDecl->lookupMethod(ObjCMethod->
getSelector(),
4270 if (isa<ObjCCategoryImplDecl>(ImpDecl) && IMD->isOverriding() &&
4278 cast<DeclContext>(ClassDecl)->addDecl(ObjCMethod);
4294 if (!CurrentClass) {
4296 CurrentClass = Cat->getClassInterface();
4297 else if (
ObjCImplDecl *Impl = dyn_cast<ObjCImplDecl>(ClassDecl))
4298 CurrentClass = Impl->getClassInterface();
4300 = dyn_cast<ObjCCategoryImplDecl>(ClassDecl))
4301 CurrentClass = CatImpl->getClassInterface();
4309 bool ARCError =
false;
4316 LangOpts.ObjCInferRelatedResultType) {
4317 bool InferRelatedResultType =
false;
4343 if (InferRelatedResultType &&
4364 Diag(D->
getLocation(), diag::err_objc_decls_may_only_appear_in_global_scope);
4378 Diag(DeclStart, diag::err_undef_interface) << ClassName;
4382 Diag(DeclStart, diag::err_atdef_nonfragile_interface);
4390 for (
unsigned i = 0; i < Ivars.size(); i++) {
4398 Decls.push_back(FD);
4403 D != Decls.end(); ++D) {
4407 else if (
RecordDecl *Record = dyn_cast<RecordDecl>(TagD))
4408 Record->addDecl(FD);
4423 Diag(IdLoc, diag::err_arg_with_address_space);
4435 Diag(IdLoc ,diag::err_catch_param_not_objc_type);
4438 Diag(IdLoc, diag::err_illegal_qualifiers_on_catch_parm);
4468 diag::err_invalid_thread)
4502 if (New->
hasAttr<BlocksAttr>())
4515 Ivars.push_back(Iv);
4521 if (ExternalSource) {
4524 for (
unsigned I = 0, N = Sels.size();
I != N; ++
I)
4535 Selector Sel = SelectorAndLocation.first;
4538 Diag(Loc, diag::warn_unimplemented_selector) << Sel;
4561 IV->getIdentifier());
4570 class UnusedBackingIvarChecker :
4577 bool InvokedSelfMethod;
4581 : S(S), Method(Method), IvarD(IvarD),
4582 AccessedIvar(
false), InvokedSelfMethod(
false) {
4588 AccessedIvar =
true;
4597 InvokedSelfMethod =
true;
4610 unsigned DIAG = diag::warn_unused_property_backing_ivar;
4620 UnusedBackingIvarChecker Checker(*
this, CurMethod, IV);
4621 Checker.TraverseStmt(CurMethod->getBody());
4622 if (Checker.AccessedIvar)
4629 if (!IV->
isReferenced() || !Checker.InvokedSelfMethod) {
4630 Diag(Loc, DIAG) << IV;
SourceLocation getThreadStorageClassSpecLoc() const
unsigned getAddressSpace() const
Return the address space of this type.
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...
param_const_iterator param_begin() const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl * > Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations.
bool hasDefinition() const
Determine whether this class has been defined.
Defines the clang::ASTContext interface.
SourceLocation getEnd() const
static bool tryMatchRecordTypes(ASTContext &Context, Sema::MethodMatchStrategy strategy, const Type *left, const Type *right)
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
static Selector GetNullarySelector(StringRef name, ASTContext &Ctx)
Utility function for constructing a nullary selector.
void setImplicit(bool I=true)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
The receiver is an object instance.
void setEndOfDefinitionLoc(SourceLocation LE)
protocol_range protocols() const
Smart pointer class that efficiently represents Objective-C method names.
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isObjCContainer() const
ImplementationControl getImplementationControl() const
Simple class containing the result of Sema::CorrectTypo.
void setStarLoc(SourceLocation Loc)
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.
ObjCInterfaceDecl * getClassInterface()
ObjCInterfaceDecl * getClassInterface()
DeclContext * getCurLexicalContext() const
void setOverriding(bool isOverriding)
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
bool isBitField() const
Determines whether this field is a bitfield.
static QualType getObjectType(APValue::LValueBase B)
Retrieves the "underlying object type" of the given expression, as used by __builtin_object_size.
bool isUnavailable(std::string *Message=nullptr) const
Determine whether this declaration is marked 'unavailable'.
llvm::DenseSet< IdentifierInfo * > ProtocolNameSet
FIXME: Type hierarchies in Objective-C can be deep.
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc...
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
const LangOptions & getLangOpts() const
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Look up the name of an Objective-C protocol.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
static bool CheckMethodOverrideParam(Sema &S, ObjCMethodDecl *MethodImpl, ObjCMethodDecl *MethodDecl, ParmVarDecl *ImplVar, ParmVarDecl *IfaceVar, bool IsProtocolMethodDecl, bool IsOverridingMode, bool Warn)
Defines the SourceManager interface.
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
bool isRecordType() const
QualType getUnderlyingType() const
void setHasMoreThanOneDecl(bool B)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Decl - This represents one declaration (or definition), e.g.
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
Captures information about "declaration specifiers" specific to Objective-C.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function...
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
static ObjCProtocolDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, SourceLocation nameLoc, SourceLocation atStartLoc, ObjCProtocolDecl *PrevDecl)
static bool NestedProtocolHasNoDefinition(ObjCProtocolDecl *PDecl, ObjCProtocolDecl *&UndefinedProtocol)
SCS getStorageClassSpec() const
std::string getAsString() const
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, AttributeList *attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
The base class of the type hierarchy.
bool isObjCQualifiedClassType() const
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
virtual void ReadMethodPool(Selector Sel)
Load the contents of the global method pool for a given selector.
std::pair< IdentifierInfo *, SourceLocation > IdentifierLocPair
A simple pair of identifier info and location.
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
ObjCDeclQualifier getObjCDeclQualifier() const
A container of type source information.
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed...
SourceLocation getLocEnd() const LLVM_READONLY
static void HelperSelectorsForTypoCorrection(SmallVectorImpl< const ObjCMethodDecl * > &BestMethod, StringRef Typo, const ObjCMethodDecl *Method)
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implict parameters. ...
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
ObjCMethodDecl * getMethod(Selector Sel, bool isInstance, bool AllowHidden=false) const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group, bool TypeMayContainAuto=true)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
VarDecl - An instance of this class is created to represent a variable declaration or definition...
void setImplementation(ObjCCategoryImplDecl *ImplD)
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Information about one declarator, including the parsed type information and the identifier.
DiagnosticsEngine & Diags
SourceLocation getLocStart() const LLVM_READONLY
std::string getAsString() const
field_iterator field_begin() const
static void WarnUndefinedMethod(Sema &S, SourceLocation ImpLoc, ObjCMethodDecl *method, bool &IncompleteImpl, unsigned DiagID, NamedDecl *NeededFor=nullptr)
ObjCMethodDecl - Represents an instance or class method declaration.
SourceRange getReturnTypeSourceRange() const
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
unsigned param_size() const
unsigned size() const
Determine the number of type parameters in this list.
ParmVarDecl - Represents a parameter to a function.
static void DiagnoseObjCImplementedDeprecations(Sema &S, NamedDecl *ND, SourceLocation ImplLoc, int select)
The collection of all-type qualifiers we support.
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=None, ArrayRef< DeclGroupPtrTy > allTUVars=None)
Base wrapper for a particular "section" of type source info.
RecordDecl - Represents a struct/union/class.
One of these records is kept for each identifier that is lexed.
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
bool isScalarType() const
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
Represents a class type in Objective C.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &attrs, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
ObjCMethodFamily
A family of Objective-C methods.
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
ObjCIvarDecl * getIvarDecl(IdentifierInfo *Id) const
getIvarDecl - This method looks up an ivar in this ContextDecl.
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
void set(T *const *InList, unsigned Elts, ASTContext &Ctx)
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
ImplicitParamDecl * getCmdDecl() const
all_protocol_range all_referenced_protocols() const
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized, ivars in super class and then collects all ivars, including those synthesized for current class.
bool isReferenced() const
Whether any declaration of this entity was referenced.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
void setSuperClass(TypeSourceInfo *superClass)
ObjCMethodDecl * getClassMethod(Selector Sel, bool AllowHidden=false) const
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
method_range methods() const
void ClearStorageClassSpecs()
void setReturnType(QualType T)
void startDefinition()
Starts the definition of this Objective-C protocol.
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...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator, which is not a function declaration or definition and therefore is not permitted to have default arguments.
std::pair< NullabilityKind, bool > DiagNullabilityKind
A nullability kind paired with a bit indicating whether it used a context-sensitive keyword...
llvm::BumpPtrAllocator BumpAlloc
SourceLocation getBeginLoc() const
Get the begin source location.
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
bool IsClassExtension() const
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...
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 setMethod(ObjCMethodDecl *M)
SourceLocation getSelectorLoc(unsigned Index) const
Represents the results of name lookup.
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics...
ObjCContainerDecl - Represents a container for method declarations.
const LangOptions & getLangOpts() const
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
static ObjCCategoryDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation AtLoc, SourceLocation ClassNameLoc, SourceLocation CategoryNameLoc, IdentifierInfo *Id, ObjCInterfaceDecl *IDecl, ObjCTypeParamList *typeParamList, SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
SCS
storage-class-specifier
Decl * ActOnObjCContainerStartDefinition(Decl *IDecl)
void RemoveDecl(NamedDecl *D)
RemoveDecl - Unlink the decl from its shadowed decl chain.
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
TypeDecl - Represents a declaration of a type.
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
static ObjCAtDefsFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, Expr *BW)
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
void setExceptionVariable(bool EV)
bool isDesignatedInitializerForTheInterface(const ObjCMethodDecl **InitMethod=nullptr) const
Returns true if the method selector resolves to a designated initializer in the class's interface...
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
Scope - A scope is a transient data structure that is used while parsing the program.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
static bool CheckMethodOverrideReturn(Sema &S, ObjCMethodDecl *MethodImpl, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl, bool IsOverridingMode, bool Warn)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
Decl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, AttributeList *AttrList)
void setAsRedeclaration(const ObjCMethodDecl *PrevMethod)
bool hasUnrecoverableErrorOccurred() const
Represents an Objective-C protocol declaration.
bool isObjCIndependentClassType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, SHOWINSYSHEADER, CATEGORY)
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
A class that does preorder depth-first traversal on the entire Clang AST and visits each node...
Represents an ObjC class declaration.
propimpl_range property_impls() const
ObjCMethodDecl * getMethod() const
detail::InMemoryDirectory::const_iterator I
virtual void ReadReferencedSelectors(SmallVectorImpl< std::pair< Selector, SourceLocation > > &Sels)
Read the set of referenced selectors known to the external Sema source.
known_categories_range known_categories() const
const LangOptions & LangOpts
bool hasExplicitBound() const
Whether this type parameter has an explicitly-written type bound, e.g., "T : NSView".
void ProcessDeclAttributeList(Scope *S, Decl *D, const AttributeList *AL, bool IncludeCXX11Attributes=true)
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
SourceRange getRange() const
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
ObjCProtocolDecl *const * iterator
field_iterator field_end() const
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
static Decl::ObjCDeclQualifier CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal)
CvtQTToAstBitMask - utility routine to produce an AST bitmask for objective-c's type qualifier from t...
static const Decl * getDefinition(const Decl *D)
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
static bool isAcceptableMethodMismatch(ObjCMethodDecl *chosen, ObjCMethodDecl *other)
Determines if this is an "acceptable" loose mismatch in the global method pool.
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
const ParmVarDecl *const * param_const_iterator
AvailabilityResult getAvailability(std::string *Message=nullptr) const
Determine the availability of the given declaration.
Sema - This implements semantic analysis and AST building for C.
SourceLocation getLocStart() const LLVM_READONLY
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
std::string CurrentModule
The name of the current module.
llvm::SmallPtrSet< Selector, 8 > SelectorSet
bool inferObjCARCLifetime(ValueDecl *decl)
void SetRangeStart(SourceLocation Loc)
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
ObjCDeclQualifier getObjCDeclQualifier() const
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
bool AnyObjCImplementation()
Return true if there is at least one @implementation in the TU.
ID
Defines the set of possible language-specific address spaces.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isUnarySelector() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
bool isNeXTFamily() const
Is this runtime basically of the NeXT family of runtimes?
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
Type source information for an attributed type.
LookupNameKind
Describes the kind of name lookup to perform.
static ObjCMethodDecl * Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, Selector SelInfo, QualType T, TypeSourceInfo *ReturnTInfo, DeclContext *contextDecl, bool isInstance=true, bool isVariadic=false, bool isPropertyAccessor=false, bool isImplicitlyDeclared=false, bool isDefined=false, ImplementationControl impControl=None, bool HasRelatedResultType=false)
bool isDeclScope(Decl *D)
isDeclScope - Return true if this is the scope that the specified decl is declared in...
unsigned getNumArgs() const
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
bool isObjCClassType() const
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool instance)
Returns instance or factory methods in global method pool for given selector.
This file defines the classes used to store parsed information about declaration-specifiers and decla...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
Expr * getBitWidth() const
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
void setAtEndRange(SourceRange atEnd)
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared, in the method definition's AST.
static ObjCTypeParamDecl * Create(ASTContext &ctx, DeclContext *dc, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, SourceLocation nameLoc, IdentifierInfo *name, SourceLocation colonLoc, TypeSourceInfo *boundInfo)
DeclContext * getDeclContext()
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...
ParmVarDecl *const * param_iterator
ImplicitParamDecl * getSelfDecl() const
void setDefined(bool isDefined)
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
bool isObjCIdType() const
ObjCTypeParamDecl * back() const
void setImplementation(ObjCImplementationDecl *ImplD)
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
void mergeClassExtensionProtocolList(ObjCProtocolDecl *const *List, unsigned Num, ASTContext &C)
mergeClassExtensionProtocolList - Merge class extension's protocol list into the protocol list for th...
Decl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc)
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
static void DiagnoseWeakIvars(Sema &S, ObjCImplementationDecl *ID)
Diagnose attempts to define ARC-__weak ivars when __weak is disabled.
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
QualType getObjCIdType() const
Represents the Objective-CC id type.
An expression that sends a message to the given Objective-C object or class.
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it...
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getStorageClassSpecLoc() const
void removeCVRQualifiers(unsigned mask)
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
TypeSourceInfo * getTypeSourceInfo() const
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
const clang::PrintingPolicy & getPrintingPolicy() const
ivar_iterator ivar_begin() const
bool hasObjCLifetime() const
ObjCCategoryDecl * getCategoryDecl() const
param_const_iterator param_end() const
SourceLocation getEndLoc() const
Get the end source location.
bool isClassMethod() const
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
static ObjCCompatibleAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, ObjCInterfaceDecl *aliasedClass)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
bool isNonFragile() const
Does this runtime follow the set of implied behaviors for a "non-fragile" ABI?
SelectorTable & Selectors
ActionResult - This structure is used while parsing/acting on expressions, stmts, etc...
static void findProtocolsWithExplicitImpls(const ObjCProtocolDecl *PDecl, ProtocolNameSet &PNS)
Encodes a location in the source.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
void setTopLevelDeclInObjCContainer(bool V=true)
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
const TemplateArgument * iterator
unsigned getBitWidthValue(const ASTContext &Ctx) const
Interfaces are the core concept in Objective-C for object oriented design.
ivar_iterator ivar_end() const
bool isValid() const
Return true if this is a valid SourceLocation object.
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...
void setObjCDeclQualifier(ObjCDeclQualifier QV)
The nullability qualifier is set when the nullability of the result or parameter was expressed via a ...
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
static bool objcModifiersConflict(Decl::ObjCDeclQualifier x, Decl::ObjCDeclQualifier y)
Determine whether two set of Objective-C declaration qualifiers conflict.
bool ObjCWarnForNoDesignatedInitChain
This starts true for a method marked as designated initializer and will be set to false if there is a...
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method, and set any properties that should be inherited.
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
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...
std::unique_ptr< ProtocolNameSet > LazyProtocolNameSet
void DiagnoseUseOfUnimplementedSelectors()
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
static bool isObjCTypeSubstitutable(ASTContext &Context, const ObjCObjectPointerType *A, const ObjCObjectPointerType *B, bool rejectId)
Determines if type B can be substituted for type A.
ObjCInterfaceDecl * lookupInheritedClass(const IdentifierInfo *ICName)
lookupInheritedClass - This method returns ObjCInterfaceDecl * of the super class whose name is passe...
ObjCCategoryDecl - Represents a category declaration.
const ObjCInterfaceDecl * getClassInterface() const
bool isPropertyAccessor() const
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Look up any declaration with any name.
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
Represents one property declaration in an Objective-C interface.
std::string getAsString() const
Derive the full selector name (e.g.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
SourceLocation getBegin() const
QualType getReturnType() const
const T * castAs() const
Member-template castAs<specific type>.
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
bool isFileContext() const
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...
sema::FunctionScopeInfo * getCurFunction() const
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
static bool HelperIsMethodInObjCType(Sema &S, Selector Sel, QualType ObjectType)
SourceLocation getLAngleLoc() const
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass)
QualType getType() const
Return the type wrapped by this type source info.
QualType getObjCInstanceType()
Retrieve the Objective-C "instancetype" type, if already known; otherwise, returns a NULL type;...
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl, ObjCMethodDecl *decl)
In ARC, check whether the conventional meanings of the two methods match.
Expr * getInstanceReceiver()
Returns the object expression (receiver) for an instance message, or null for a message that is not a...
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
ObjCIvarDecl * getNextIvar()
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
ObjCDeclQualifier getObjCDeclQualifier() const
TypeLoc findExplicitQualifierLoc() const
Find a type with the location of an explicit type qualifier.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
Base class for declarations which introduce a typedef-name.
Represents a template argument.
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
const ObjCProtocolList & getReferencedProtocols() const
instmeth_range instance_methods() const
TSCS getThreadStorageClassSpec() const
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
ObjCCategoryImplDecl * getImplementation() const
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
ObjCContainerKind getObjCContainerKind() const
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
ObjCIvarDecl * getPropertyIvarDecl() const
ObjCMethodDecl * getInstanceMethod(Selector Sel, bool AllowHidden=false) const
SourceLocation getLocStart() const LLVM_READONLY
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
bool isInvalidDecl() const
bool ObjCIsSecondaryInit
True when this is an initializer method not marked as a designated initializer within a class that ha...
Decl * 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, AttributeList *AttrList)
TypeParamListContext
The context in which an Objective-C type parameter list occurs, for use in diagnostics.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
Represents the declaration of an Objective-C type parameter.
static void CheckProtocolMethodDefs(Sema &S, SourceLocation ImpLoc, ObjCProtocolDecl *PDecl, bool &IncompleteImpl, const Sema::SelectorSet &InsMap, const Sema::SelectorSet &ClsMap, ObjCContainerDecl *CDecl, LazyProtocolNameSet &ProtocolsExplictImpl)
CheckProtocolMethodDefs - This routine checks unimplemented methods Declared in protocol, and those referenced by it.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
bool hasDefinition() const
Determine whether this protocol has a definition.
static ObjCImplementationDecl * Create(ASTContext &C, DeclContext *DC, ObjCInterfaceDecl *classInterface, ObjCInterfaceDecl *superDecl, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation superLoc=SourceLocation(), SourceLocation IvarLBraceLoc=SourceLocation(), SourceLocation IvarRBraceLoc=SourceLocation())
Selector getSelector() const
bool ObjCWarnForNoInitDelegation
This starts true for a secondary initializer method and will be set to false if there is an invocatio...
detail::InMemoryDirectory::const_iterator E
static bool matchTypes(ASTContext &Context, Sema::MethodMatchStrategy strategy, QualType leftQT, QualType rightQT)
ObjCMethodFamily getMethodFamily() const
Derive the conventional family of this method.
IdentifierResolver IdResolver
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
DeclClass * getCorrectionDeclAs() const
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
Represents a pointer to an Objective C object.
bool hasMoreThanOneDecl() const
static bool HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param)
HasExplicitOwnershipAttr - returns true when pointer to ObjC pointer has explicit ownership attribute...
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
bool isObjCObjectType() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
ObjCMethodDecl * lookupMethod(Selector Sel, bool isInstance, bool shallowCategoryLookup=false, bool followSuper=true, const ObjCCategoryDecl *C=nullptr) const
lookupMethod - This method returns an instance/class method by looking in the class, its categories, and its super classes (using a linear search).
SourceManager & getSourceManager() const
void setNext(ObjCMethodList *L)
const T * getAs() const
Member-template getAs<specific type>'.
ExternalSemaSource * getExternalSource() const
Decl::Kind getDeclKind() const
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
void AddDecl(NamedDecl *D)
AddDecl - Link the decl to its shadowed decl chain.
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...
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
static __inline__ uint32_t uint32_t y
bool isObjCQualifiedIdType() const
static const TST TST_typename
Base for LValueReferenceType and RValueReferenceType.
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D)
Handle the specified top-level declaration that occurred inside and ObjC container.
Simple template class for restricting typo correction candidates to ones having a single Decl* of the...
A list of Objective-C protocols, along with the source locations at which they were referenced...
const ObjCProtocolList & getReferencedProtocols() const
Wraps an ObjCPointerType with source location information.
ObjCImplementationDecl * getImplementation() const
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.
void addDecl(Decl *D)
Add the declaration D into this context.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
static Sema::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 QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
ObjCIvarRefExpr - A reference to an ObjC instance variable.
SourceManager & getSourceManager()
void setObjCMethodScopeInfo(unsigned parameterIndex)
IdentifierInfo * getIdentifier() const
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
Reading or writing from this object requires a barrier call.
classmeth_range class_methods() const
No particular method family.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
ThreadStorageClassSpecifier
Thread storage-class-specifier.
Captures information about "declaration specifiers".
SourceLocation getIdentifierLoc() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D...
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
bool isObjCObjectPointerType() const
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
void SetRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false...
ObjCIvarDecl - Represents an ObjC instance variable.
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool CheckParmsForFunctionDef(ParmVarDecl *const *Param, ParmVarDecl *const *ParamEnd, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string...
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, AttributeList *AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc)
Return a DeclaratorChunk for a pointer.
a linked list of methods with the same selector name but different signatures.
ObjCInterfaceDecl * getSuperClass() const
std::pair< ObjCMethodList, ObjCMethodList > GlobalMethods
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
bool isSet() const
Deprecated.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
void ActOnObjCContainerFinishDefinition()
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed...
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
void setLexicalDeclContext(DeclContext *DC)
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, std::unique_ptr< 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...
static SourceRange getTypeRange(TypeSourceInfo *TSI)
NamedDecl - This represents a decl with a name.
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
bool isInvalidType() const
SourceRange getSourceRange() const
static ObjCCategoryImplDecl * Create(ASTContext &C, DeclContext *DC, IdentifierInfo *Id, ObjCInterfaceDecl *classInterface, SourceLocation nameLoc, SourceLocation atStartLoc, SourceLocation CategoryNameLoc)
void setVariance(ObjCTypeParamVariance variance)
Set the variance of this type parameter.
void setTypeSourceInfo(TypeSourceInfo *newType)
ObjCMethodList * getNext() const
bool hasSameNullabilityTypeQualifier(QualType SubT, QualType SuperT, bool IsParam) const
Decl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
TypeSourceInfo * getTypeSourceInfo() const
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
static void diagnoseUseOfProtocols(Sema &TheSema, ObjCContainerDecl *CD, ObjCProtocolDecl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs)
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
void SetRangeEnd(SourceLocation Loc)
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
void setType(QualType newType)
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
ParsedAttributes - A collection of parsed attributes.
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
The parameter is invariant: must match exactly.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
visible_extensions_range visible_extensions() const
void PushFunctionScope()
Enter a new function scope.
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...
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isDeprecated(std::string *Message=nullptr) const
Determine whether this declaration is marked 'deprecated'.
ObjCCompatibleAliasDecl - Represents alias of a class.
Helper class that creates diagnostics with optional template instantiation stacks.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
AttributeList - Represents a syntactic attribute.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
const ObjCProtocolList & getReferencedProtocols() const
bool isHidden() const
Determine whether this declaration is hidden from name lookup.
Decl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc)
const ObjCInterfaceDecl * getSuperClass() const