From 92463274e647e007aa70efb4872b02057b63d8cc Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 18 Jul 2013 20:11:45 +0000 Subject: ObjectiveC migration. migration to NS_ENUM/SN_OPTION - wip. llvm-svn: 186604 --- clang/lib/Edit/RewriteObjCFoundationAPI.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'clang/lib/Edit') diff --git a/clang/lib/Edit/RewriteObjCFoundationAPI.cpp b/clang/lib/Edit/RewriteObjCFoundationAPI.cpp index 30a9f522b2f..68dcd6b7c60 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. -- cgit v1.2.3