]> granicus.if.org Git - clang/commitdiff
Rewrite for properties.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 7 Nov 2007 00:09:37 +0000 (00:09 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 7 Nov 2007 00:09:37 +0000 (00:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43791 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteTest.cpp

index e79d830e01bfdd846a1f2e0af9c974402db0a8f0..fa4a369f1772601e1e9bf2b5f8066f9fe92fdebb 100644 (file)
@@ -80,6 +80,7 @@ namespace {
     void RewriteCategoryDecl(ObjcCategoryDecl *Dcl);
     void RewriteProtocolDecl(ObjcProtocolDecl *Dcl);
     void RewriteMethods(int nMethods, ObjcMethodDecl **Methods);
+    void RewriteProperties(int nProperties, ObjcPropertyDecl **Properties);
     void RewriteFunctionDecl(FunctionDecl *FD);
     void RewriteObjcQualifiedInterfaceTypes(
         const FunctionTypeProto *proto, FunctionDecl *FD);
@@ -311,6 +312,18 @@ void RewriteTest::RewriteMethods(int nMethods, ObjcMethodDecl **Methods) {
   }
 }
 
+void RewriteTest::RewriteProperties(int nProperties, ObjcPropertyDecl **Properties) 
+{
+  for (int i = 0; i < nProperties; i++) {
+    ObjcPropertyDecl *Property = Properties[i];
+    SourceLocation Loc = Property->getLocation();
+    
+    Rewrite.ReplaceText(Loc, 0, "// ", 3);
+    
+    // FIXME: handle properties that are declared across multiple lines.
+  }
+}
+
 void RewriteTest::RewriteCategoryDecl(ObjcCategoryDecl *CatDecl) {
   SourceLocation LocStart = CatDecl->getLocStart();
   
@@ -363,7 +376,8 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) {
     
   Rewrite.ReplaceText(LocStart, endBuf-startBuf, 
                       ResultStr.c_str(), ResultStr.size());
-  
+  RewriteProperties(ClassDecl->getNumPropertyDecl(),
+                    ClassDecl->getPropertyDecl());
   RewriteMethods(ClassDecl->getNumInstanceMethods(),
                  ClassDecl->getInstanceMethods());
   RewriteMethods(ClassDecl->getNumClassMethods(),