r186231 - ObjC migrator: More knobs for migrating
Fariborz Jahanian
fjahanian at apple.com
Fri Jul 12 17:04:20 PDT 2013
Author: fjahanian
Date: Fri Jul 12 19:04:20 2013
New Revision: 186231
URL: http://llvm.org/viewvc/llvm-project?rev=186231&view=rev
Log:
ObjC migrator: More knobs for migrating
conforming protocols to each class. wip.
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=186231&r1=186230&r2=186231&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Fri Jul 12 19:04:20 2013
@@ -235,6 +235,13 @@ void ObjCMigrateASTConsumer::migrateObjC
}
}
+static bool
+ClassImplementsAllMethodsAndProprties(ASTContext &Ctx,
+ const ObjCImplementationDecl *ImpDecl,
+ ObjCProtocolDecl *Protocol) {
+ return false;
+}
+
void ObjCMigrateASTConsumer::migrateProtocolConformance(ASTContext &Ctx,
const ObjCImplementationDecl *ImpDecl) {
const ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface();
@@ -244,16 +251,25 @@ void ObjCMigrateASTConsumer::migrateProt
// and make them explicit.
llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ExplicitProtocols;
Ctx.CollectInheritedProtocols(IDecl, ExplicitProtocols);
- llvm::SmallPtrSet<ObjCProtocolDecl *, 8> PotentialImplicitProtocols;
+ llvm::SmallVector<ObjCProtocolDecl *, 8> PotentialImplicitProtocols;
- for (llvm::SmallPtrSet<ObjCProtocolDecl*,32>::iterator I =
+ for (llvm::SmallPtrSet<ObjCProtocolDecl*, 32>::iterator I =
ObjCProtocolDecls.begin(),
E = ObjCProtocolDecls.end(); I != E; ++I)
if (!ExplicitProtocols.count(*I))
- PotentialImplicitProtocols.insert(*I);
+ PotentialImplicitProtocols.push_back(*I);
if (PotentialImplicitProtocols.empty())
return;
+
+ // go through list of non-optional methods and properties in each protocol
+ // in the PotentialImplicitProtocols list. If class implements every one of the
+ // methods and properties, then this class conforms to this protocol.
+ llvm::SmallVector<ObjCProtocolDecl*, 8> ConformingProtocols;
+ for (unsigned i = 0, e = PotentialImplicitProtocols.size(); i != e; i++)
+ if (ClassImplementsAllMethodsAndProprties(Ctx, ImpDecl,
+ PotentialImplicitProtocols[i]))
+ ConformingProtocols.push_back(PotentialImplicitProtocols[i]);
}
namespace {
More information about the cfe-commits
mailing list