本文整理汇总了C++中ObjCMethodDecl::hasAttrs方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjCMethodDecl::hasAttrs方法的具体用法?C++ ObjCMethodDecl::hasAttrs怎么用?C++ ObjCMethodDecl::hasAttrs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjCMethodDecl
的用法示例。
在下文中一共展示了ObjCMethodDecl::hasAttrs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: migrateObjCInterfaceDecl
void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
ObjCInterfaceDecl *D) {
for (ObjCContainerDecl::method_iterator M = D->meth_begin(), MEnd = D->meth_end();
M != MEnd; ++M) {
ObjCMethodDecl *Method = (*M);
if (Method->isPropertyAccessor() || Method->param_size() != 0)
continue;
// Is this method candidate to be a getter?
QualType GRT = Method->getResultType();
if (GRT->isVoidType())
continue;
// FIXME. Don't know what todo with attributes, skip for now.
if (Method->hasAttrs())
continue;
Selector GetterSelector = Method->getSelector();
IdentifierInfo *getterName = GetterSelector.getIdentifierInfoForSlot(0);
Selector SetterSelector =
SelectorTable::constructSetterSelector(PP.getIdentifierTable(),
PP.getSelectorTable(),
getterName);
if (ObjCMethodDecl *SetterMethod = D->lookupMethod(SetterSelector, true)) {
// Is this a valid setter, matching the target getter?
QualType SRT = SetterMethod->getResultType();
if (!SRT->isVoidType())
continue;
const ParmVarDecl *argDecl = *SetterMethod->param_begin();
QualType ArgType = argDecl->getType();
if (!Ctx.hasSameUnqualifiedType(ArgType, GRT) ||
SetterMethod->hasAttrs())
continue;
edit::Commit commit(*Editor);
rewriteToObjCProperty(Method, SetterMethod, *NSAPIObj, commit);
Editor->commit(commit);
}
}
}