aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-07-18 20:11:45 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-07-18 20:11:45 +0000
commit92463274e647e007aa70efb4872b02057b63d8cc (patch)
tree869e0c7cf1b49ad5e2e39827453d72fe4619f233 /clang/lib/Edit/RewriteObjCFoundationAPI.cpp
parent61b23b7edce7d558beca44fd8ebc82407f9ff2ce (diff)
downloadllvm-92463274e647e007aa70efb4872b02057b63d8cc.zip
llvm-92463274e647e007aa70efb4872b02057b63d8cc.tar.gz
llvm-92463274e647e007aa70efb4872b02057b63d8cc.tar.bz2
ObjectiveC migration. migration to NS_ENUM/SN_OPTION
- wip. llvm-svn: 186604
Diffstat (limited to 'clang/lib/Edit/RewriteObjCFoundationAPI.cpp')
-rw-r--r--clang/lib/Edit/RewriteObjCFoundationAPI.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
index 30a9f52..68dcd6b 100644
--- a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
+++ b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp
@@ -434,6 +434,19 @@ bool edit::rewriteToObjCInterfaceDecl(const ObjCInterfaceDecl *IDecl,
return true;
}
+bool edit::rewriteToNSEnumDecl(const EnumDecl *EnumDcl,
+ const TypedefDecl *TypedefDcl,
+ const NSAPI &NS, Commit &commit) {
+ std::string ClassString = "typedef NS_ENUM(NSInteger, ";
+ ClassString += TypedefDcl->getIdentifier()->getName();
+ ClassString += ')';
+ SourceRange R(EnumDcl->getLocStart(), EnumDcl->getLocStart());
+ commit.replace(R, ClassString);
+ commit.remove(SourceRange(TypedefDcl->getLocStart(), TypedefDcl->getLocEnd()));
+ 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.