]> granicus.if.org Git - clang/commitdiff
Remove a couple FIXME's for rewriting ObjC interfaces (which are now being rewritten...
authorSteve Naroff <snaroff@apple.com>
Tue, 30 Oct 2007 03:43:13 +0000 (03:43 +0000)
committerSteve Naroff <snaroff@apple.com>
Tue, 30 Oct 2007 03:43:13 +0000 (03:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43494 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteTest.cpp
Parse/ParseObjc.cpp
Sema/SemaDecl.cpp
clang.xcodeproj/project.pbxproj

index 8063574750cd1cdc0ea2a34390fbb7ed7af98e4c..be09eede3106a96349af28b739be0d3acc678eae 100644 (file)
@@ -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 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) {
   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 @@ void RewriteTest::RewriteInterfaceDecl(ObjcInterfaceDecl *ClassDecl) {
     
     // FIXME: handle methods that are declared across multiple lines.
   }
+  // Lastly, comment out the @end.
+  Rewrite.ReplaceText(ClassDecl->getAtEndLoc(), 0, "// ", 3);
 }
 
 //===----------------------------------------------------------------------===//
index 0c0c165c2a3b281be8340f65432aebc899b2e112..b2323a2e104f228a448ca3276287921e49be790b 100644 (file)
@@ -271,10 +271,11 @@ void Parser::ParseObjCInterfaceDeclList(DeclTy *interfaceDecl,
       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.
index be34dfb004a0aa6e001d548e4de73699e7831d26..8d3887afd555efc65b2e628671f5f037b8d6a5f7 100644 (file)
@@ -1861,7 +1861,7 @@ void Sema::ActOnAddMethodsToObjcDecl(Scope* S, DeclTy *classDecl,
   // should be true.
   if (!ClassDecl)
     return;
-  
+    
   llvm::SmallVector<ObjcMethodDecl*, 32> insMethods;
   llvm::SmallVector<ObjcMethodDecl*, 16> clsMethods;
   
index fe4cf8d85be8296188b8454e3723b21a50eb5906..de41b4628d0c47ae944965792f26798c623eb63f 100644 (file)
                08FB7793FE84155DC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
                        projectDirPath = "";