[cfe-commits] r43494 - in /cfe/trunk: Driver/RewriteTest.cpp Parse/ParseObjc.cpp Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj

Steve Naroff snaroff at apple.com
Mon Oct 29 20:43:14 PDT 2007


Author: snaroff
Date: Mon Oct 29 22:43:13 2007
New Revision: 43494

URL: http://llvm.org/viewvc/llvm-project?rev=43494&view=rev
Log:

Remove a couple FIXME's for rewriting ObjC interfaces (which are now being rewritten properly).


Modified:
    cfe/trunk/Driver/RewriteTest.cpp
    cfe/trunk/Parse/ParseObjc.cpp
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj

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

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Mon Oct 29 22:43:13 2007
@@ -19,6 +19,7 @@
 #include "clang/Basic/IdentifierTable.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "clang/Lex/Lexer.h"
 using namespace clang;
 using llvm::utostr;
 
@@ -271,18 +272,12 @@
   const char *startBuf = SM->getCharacterData(LocStart);
   const char *endBuf = SM->getCharacterData(LocEnd);
 
-  // FIXME: need to consider empty class decls (no vars, methods)...
-  //   @interface NSConstantString : NSSimpleCString
-  //   @end
-
-  if (*endBuf != '>' && *endBuf != '}')
-    // we have an identifier - scan ahead until the end of token.
-    endBuf = strchr(endBuf, ' '); // FIXME: implement correctly.
+  endBuf += Lexer::MeasureTokenLength(LocEnd, *SM);
 
   std::string ResultStr;
   SynthesizeObjcInternalStruct(ClassDecl, ResultStr);
     
-  Rewrite.ReplaceText(LocStart, endBuf-startBuf+1, 
+  Rewrite.ReplaceText(LocStart, endBuf-startBuf, 
                       ResultStr.c_str(), ResultStr.size());
   
   int nInstanceMethods = ClassDecl->getNumInstanceMethods();
@@ -307,6 +302,8 @@
     
     // FIXME: handle methods that are declared across multiple lines.
   }
+  // Lastly, comment out the @end.
+  Rewrite.ReplaceText(ClassDecl->getAtEndLoc(), 0, "// ", 3);
 }
 
 //===----------------------------------------------------------------------===//

Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=43494&r1=43493&r2=43494&view=diff

==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Mon Oct 29 22:43:13 2007
@@ -271,10 +271,11 @@
       ParseDeclarationOrFunctionDefinition();
     }
   }
-  if (allMethods.size())
-    /// Insert collected methods declarations into the @interface object.
-    Actions.ActOnAddMethodsToObjcDecl(CurScope, interfaceDecl, &allMethods[0], 
-                                      allMethods.size(), AtEndLoc);
+  /// Insert collected methods declarations into the @interface object.
+  /// This action is executed even if we don't have any methods (so the @end
+  /// can be recorded properly).
+  Actions.ActOnAddMethodsToObjcDecl(CurScope, interfaceDecl, &allMethods[0], 
+                                    allMethods.size(), AtEndLoc);
 }
 
 ///   Parse property attribute declarations.

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=43494&r1=43493&r2=43494&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Oct 29 22:43:13 2007
@@ -1861,7 +1861,7 @@
   // should be true.
   if (!ClassDecl)
     return;
-  
+    
   llvm::SmallVector<ObjcMethodDecl*, 32> insMethods;
   llvm::SmallVector<ObjcMethodDecl*, 16> clsMethods;
   

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=43494&r1=43493&r2=43494&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Mon Oct 29 22:43:13 2007
@@ -756,7 +756,6 @@
 		08FB7793FE84155DC02AAC07 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
-			compatibilityVersion = "Xcode 2.4";
 			hasScannedForEncodings = 1;
 			mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
 			projectDirPath = "";





More information about the cfe-commits mailing list