From: Fariborz Jahanian Date: Wed, 14 Nov 2007 00:42:16 +0000 (+0000) Subject: Rewrite of forward protocol declaration. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d175ddfdbefff8646982dfd4afc5bdf6edbc9e67;p=clang 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 9e17a6ef8c..cd1e994bbf 100644 --- a/Driver/RewriteTest.cpp +++ b/Driver/RewriteTest.cpp @@ -91,6 +91,7 @@ namespace { 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 @@ void RewriteTest::HandleTopLevelDecl(Decl *D) { RewriteCategoryDecl(CD); } else if (ObjcProtocolDecl *PD = dyn_cast(D)) { RewriteProtocolDecl(PD); + } else if (ObjcForwardProtocolDecl *FP = + dyn_cast(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 @@ void RewriteTest::RewriteProtocolDecl(ObjcProtocolDecl *PDecl) { 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;