[cfe-commits] r44095 - /cfe/trunk/Driver/RewriteTest.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Nov 13 16:42:16 PST 2007


Author: fjahanian
Date: Tue Nov 13 18:42:16 2007
New Revision: 44095

URL: http://llvm.org/viewvc/llvm-project?rev=44095&view=rev
Log:
Rewrite of forward protocol declaration.

Modified:
    cfe/trunk/Driver/RewriteTest.cpp

Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44095&r1=44094&r2=44095&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Tue Nov 13 18:42:16 2007
@@ -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;





More information about the cfe-commits mailing list