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

Fariborz Jahanian fjahanian at apple.com
Mon Nov 26 12:59:57 PST 2007


Author: fjahanian
Date: Mon Nov 26 14:59:57 2007
New Revision: 44335

URL: http://llvm.org/viewvc/llvm-project?rev=44335&view=rev
Log:
Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).

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=44335&r1=44334&r2=44335&view=diff

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Mon Nov 26 14:59:57 2007
@@ -1318,8 +1318,6 @@
   // If no ivars and no root or if its root, directly or indirectly,
   // have no ivars (thus not synthesized) then no need to synthesize this class.
   if (NumIvars <= 0 && (!RCDecl || !ObjcSynthesizedStructs.count(RCDecl))) {
-    //FIXME: This does not replace @interface class-name with the 
-    //Result text. Could be a bug in ReplaceText API.
     endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
     Rewrite.ReplaceText(LocStart, endBuf-startBuf, 
                         Result.c_str(), Result.size());
@@ -1756,8 +1754,12 @@
   int NumIvars = IDecl->getImplDeclNumIvars() > 0 
                    ? IDecl->getImplDeclNumIvars() 
                    : (CDecl ? CDecl->getNumInstanceVariables() : 0);
-  
-  SynthesizeObjcInternalStruct(CDecl, Result);
+  // Explictly declared @interface's are already synthesized.
+  if (CDecl->ImplicitInterfaceDecl()) {
+    // FIXME: Implementation of a class with no @interface (legacy) doese not 
+    // produce correct synthesis as yet.
+    SynthesizeObjcInternalStruct(CDecl, Result);
+  }
   
   if (NumIvars > 0) {
     static bool objc_ivar = false;





More information about the cfe-commits mailing list