Rewrite of forward protocol declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44095 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 9e17a6e..cd1e994 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -91,6 +91,7 @@
     void RewriteObjcMethodDecl(ObjcMethodDecl *MDecl, std::string &ResultStr);
     void RewriteCategoryDecl(ObjcCategoryDecl *Dcl);
     void RewriteProtocolDecl(ObjcProtocolDecl *Dcl);
+    void RewriteForwardProtocolDecl(ObjcForwardProtocolDecl *Dcl);
     void RewriteMethodDeclarations(int nMethods, ObjcMethodDecl **Methods);
     void RewriteProperties(int nProperties, ObjcPropertyDecl **Properties);
     void RewriteFunctionDecl(FunctionDecl *FD);
@@ -173,6 +174,9 @@
     RewriteCategoryDecl(CD);
   } else if (ObjcProtocolDecl *PD = dyn_cast<ObjcProtocolDecl>(D)) {
     RewriteProtocolDecl(PD);
+  } else if (ObjcForwardProtocolDecl *FP = 
+             dyn_cast<ObjcForwardProtocolDecl>(D)){
+    RewriteForwardProtocolDecl(FP);
   }
   // If we have a decl in the main file, see if we should rewrite it.
   if (SM->getDecomposedFileLoc(Loc).first == MainFileID)
@@ -380,6 +384,12 @@
   Rewrite.ReplaceText(PDecl->getAtEndLoc(), 0, "// ", 3);
 }
 
+void RewriteTest::RewriteForwardProtocolDecl(ObjcForwardProtocolDecl *PDecl) {
+  SourceLocation LocStart = PDecl->getLocation();
+  // FIXME: handle forward protocol that are declared across multiple lines.
+  Rewrite.ReplaceText(LocStart, 0, "// ", 3);
+}
+
 void RewriteTest::RewriteObjcMethodDecl(ObjcMethodDecl *OMD, 
                                         std::string &ResultStr) {
   static bool includeObjc = false;