diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-16 00:20:21 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-07-16 00:20:21 +0000 |
commit | 5bd5affe2dd2c7de071970ae89f0c97965188d20 (patch) | |
tree | e5f330281753d0ca92c0f41f21716b15417a787d /clang/lib/Edit/RewriteObjCFoundationAPI.cpp | |
parent | aa0307021d035967af75ddb71d2b79bf604f69a6 (diff) | |
download | bcm5719-llvm-5bd5affe2dd2c7de071970ae89f0c97965188d20.tar.gz bcm5719-llvm-5bd5affe2dd2c7de071970ae89f0c97965188d20.zip |
ObjC migrator: build conforming interface
declaration (not yet used). wip.
llvm-svn: 186369
Diffstat (limited to 'clang/lib/Edit/RewriteObjCFoundationAPI.cpp')
-rw-r--r-- | clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp index 8d24003d942..fd9c16ee6a0 100644 --- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp +++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp @@ -402,6 +402,38 @@ bool edit::rewriteToObjCProperty(const ObjCMethodDecl *Getter, return true; } +bool edit::rewriteToObjCInterfaceDecl(const ObjCInterfaceDecl *IDecl, + llvm::SmallVectorImpl<ObjCProtocolDecl*> &ConformingProtocols, + const NSAPI &NS, Commit &commit) { + const ObjCList<ObjCProtocolDecl> &Protocols = IDecl->getReferencedProtocols(); + + // ASTContext &Context = NS.getASTContext(); + std::string ClassString = "@interface "; + ClassString += IDecl->getNameAsString(); + + if (IDecl->getSuperClass()) { + ClassString += " : "; + ClassString += IDecl->getSuperClass()->getNameAsString(); + } + if (Protocols.empty()) + ClassString += '<'; + + for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(), + E = Protocols.end(); I != E; ++I) { + ClassString += (I == Protocols.begin() ? '<' : ','); + ClassString += (*I)->getNameAsString(); + } + if (!Protocols.empty()) + ClassString += ','; + for (unsigned i = 0, e = ConformingProtocols.size(); i != e; i++) { + ClassString += ConformingProtocols[i]->getNameAsString(); + if (i != (e-1)) + ClassString += ','; + } + ClassString += "> "; + return true; +} + /// \brief Returns true if the immediate message arguments of \c Msg should not /// be rewritten because it will interfere with the rewrite of the parent /// message expression. e.g. |