[cfe-commits] r150937 - /cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp

Fariborz Jahanian fjahanian at apple.com
Sun Feb 19 11:00:05 PST 2012


Author: fjahanian
Date: Sun Feb 19 13:00:05 2012
New Revision: 150937

URL: http://llvm.org/viewvc/llvm-project?rev=150937&view=rev
Log:
objective-c modern translator: comment out private ivars
declared in class extension and implementation.


Modified:
    cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp

Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=150937&r1=150936&r2=150937&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Sun Feb 19 13:00:05 2012
@@ -935,6 +935,13 @@
   // FIXME: handle category headers that are declared across multiple lines.
   ReplaceText(LocStart, 0, "// ");
 
+  for (ObjCCategoryDecl::ivar_iterator
+       I = CatDecl->ivar_begin(), E = CatDecl->ivar_end(); I != E; ++I) {
+    ObjCIvarDecl *Ivar = (*I);
+    SourceLocation LocStart = Ivar->getLocStart();
+    ReplaceText(LocStart, 0, "// ");
+  } 
+
   for (ObjCCategoryDecl::prop_iterator I = CatDecl->prop_begin(),
        E = CatDecl->prop_end(); I != E; ++I)
     RewriteProperty(*I);
@@ -1144,7 +1151,17 @@
   ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OID);
   ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(OID);
 
-  InsertText(IMD ? IMD->getLocStart() : CID->getLocStart(), "// ");
+  if (IMD) {
+    InsertText(IMD->getLocStart(), "// ");
+      for (ObjCImplementationDecl::ivar_iterator
+           I = IMD->ivar_begin(), E = IMD->ivar_end(); I != E; ++I) {
+        ObjCIvarDecl *Ivar = (*I);
+        SourceLocation LocStart = Ivar->getLocStart();
+        ReplaceText(LocStart, 0, "// ");
+    }
+  }
+  else
+    InsertText(CID->getLocStart(), "// ");
 
   for (ObjCCategoryImplDecl::instmeth_iterator
        I = IMD ? IMD->instmeth_begin() : CID->instmeth_begin(),





More information about the cfe-commits mailing list