diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-13 00:04:20 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-13 00:04:20 +0000 |
commit | 9eabf45fcebb73fdfe43f9a3e6711c6d01bcd80e (patch) | |
tree | fc3a915ac43d70068ea4428855293db006f60eb9 /clang | |
parent | f2826aacf96fc8fd7bc1d2856308f2ee33ddb8f4 (diff) | |
download | bcm5719-llvm-9eabf45fcebb73fdfe43f9a3e6711c6d01bcd80e.tar.gz bcm5719-llvm-9eabf45fcebb73fdfe43f9a3e6711c6d01bcd80e.zip |
ObjC migrator: More knobs for migrating
conforming protocols to each class. wip.
llvm-svn: 186231
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/ARCMigrate/ObjCMT.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index b170e08bb99..d80c6a11137 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/lib/ARCMigrate/ObjCMT.cpp @@ -235,6 +235,13 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx, } } +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::migrateProtocolConformance(ASTContext &Ctx, // 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 { |