本文整理汇总了C++中ObjCMethodDecl::isImplicit方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjCMethodDecl::isImplicit方法的具体用法?C++ ObjCMethodDecl::isImplicit怎么用?C++ ObjCMethodDecl::isImplicit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjCMethodDecl
的用法示例。
在下文中一共展示了ObjCMethodDecl::isImplicit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
static bool
ClassImplementsAllMethodsAndProperties(ASTContext &Ctx,
const ObjCImplementationDecl *ImpDecl,
const ObjCInterfaceDecl *IDecl,
ObjCProtocolDecl *Protocol) {
// In auto-synthesis, protocol properties are not synthesized. So,
// a conforming protocol must have its required properties declared
// in class interface.
bool HasAtleastOneRequiredProperty = false;
if (const ObjCProtocolDecl *PDecl = Protocol->getDefinition())
for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(),
E = PDecl->prop_end(); P != E; ++P) {
ObjCPropertyDecl *Property = *P;
if (Property->getPropertyImplementation() == ObjCPropertyDecl::Optional)
continue;
HasAtleastOneRequiredProperty = true;
DeclContext::lookup_const_result R = IDecl->lookup(Property->getDeclName());
if (R.size() == 0) {
// Relax the rule and look into class's implementation for a synthesize
// or dynamic declaration. Class is implementing a property coming from
// another protocol. This still makes the target protocol as conforming.
if (!ImpDecl->FindPropertyImplDecl(
Property->getDeclName().getAsIdentifierInfo()))
return false;
}
else if (ObjCPropertyDecl *ClassProperty = dyn_cast<ObjCPropertyDecl>(R[0])) {
if ((ClassProperty->getPropertyAttributes()
!= Property->getPropertyAttributes()) ||
!Ctx.hasSameType(ClassProperty->getType(), Property->getType()))
return false;
}
else
return false;
}
// At this point, all required properties in this protocol conform to those
// declared in the class.
// Check that class implements the required methods of the protocol too.
bool HasAtleastOneRequiredMethod = false;
if (const ObjCProtocolDecl *PDecl = Protocol->getDefinition()) {
if (PDecl->meth_begin() == PDecl->meth_end())
return HasAtleastOneRequiredProperty;
for (ObjCContainerDecl::method_iterator M = PDecl->meth_begin(),
MEnd = PDecl->meth_end(); M != MEnd; ++M) {
ObjCMethodDecl *MD = (*M);
if (MD->isImplicit())
continue;
if (MD->getImplementationControl() == ObjCMethodDecl::Optional)
continue;
DeclContext::lookup_const_result R = ImpDecl->lookup(MD->getDeclName());
if (R.size() == 0)
return false;
bool match = false;
HasAtleastOneRequiredMethod = true;
for (unsigned I = 0, N = R.size(); I != N; ++I)
if (ObjCMethodDecl *ImpMD = dyn_cast<ObjCMethodDecl>(R[0]))
if (Ctx.ObjCMethodsAreEqual(MD, ImpMD)) {
match = true;
break;
}
if (!match)
return false;
}
}
if (HasAtleastOneRequiredProperty || HasAtleastOneRequiredMethod)
return true;
return false;
}