ObjectiveC migration. Add couple of routine
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 12 Aug 2013 23:17:13 +0000 (23:17 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 12 Aug 2013 23:17:13 +0000 (23:17 +0000)
, currently unused, for future cf-annotation work.

llvm-svn: 188224

clang/lib/ARCMigrate/ObjCMT.cpp

index 46d538e6327e61661ff9b688760f873029a286e0..b521b560263397e2fb3c2d181115f61be674bafd 100644 (file)
@@ -24,6 +24,7 @@
 #include "clang/Lex/PPConditionalDirectiveRecord.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Rewrite/Core/Rewriter.h"
+#include "clang/AST/Attr.h"
 #include "llvm/ADT/SmallString.h"
 
 using namespace clang;
@@ -44,7 +45,10 @@ class ObjCMigrateASTConsumer : public ASTConsumer {
   void migrateFactoryMethod(ASTContext &Ctx, ObjCContainerDecl *CDecl,
                             ObjCMethodDecl *OM,
                             ObjCInstanceTypeFamily OIT_Family = OIT_None);
-
+  
+  void migrateFunctionDeclAnnotation(ASTContext &Ctx, FunctionDecl *FuncDecl);
+  
+  void migrateObjCMethodDeclAnnotation(ASTContext &Ctx, ObjCMethodDecl *MethodDecl);
 public:
   std::string MigrateDir;
   bool MigrateLiterals;
@@ -739,6 +743,24 @@ void ObjCMigrateASTConsumer::migrateFactoryMethod(ASTContext &Ctx,
   ReplaceWithInstancetype(*this, OM);
 }
 
+void ObjCMigrateASTConsumer::migrateFunctionDeclAnnotation(
+                                                ASTContext &Ctx,
+                                                FunctionDecl *FuncDecl) {
+  if (FuncDecl->hasAttr<CFAuditedTransferAttr>() ||
+      FuncDecl->getAttr<CFReturnsRetainedAttr>() ||
+      FuncDecl->getAttr<CFReturnsNotRetainedAttr>())
+    return;
+}
+
+void ObjCMigrateASTConsumer::migrateObjCMethodDeclAnnotation(
+                                            ASTContext &Ctx,
+                                            ObjCMethodDecl *MethodDecl) {
+  if (MethodDecl->hasAttr<CFAuditedTransferAttr>() ||
+      MethodDecl->getAttr<CFReturnsRetainedAttr>() ||
+      MethodDecl->getAttr<CFReturnsNotRetainedAttr>())
+    return;
+}
+
 namespace {
 
 class RewritesReceiver : public edit::EditsReceiver {