[cfe-commits] r43285 - in /cfe/trunk: Driver/RewriteTest.cpp Lex/Preprocessor.cpp

Steve Naroff snaroff at apple.com
Tue Oct 23 18:09:49 PDT 2007


Author: snaroff
Date: Tue Oct 23 20:09:48 2007
New Revision: 43285

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

Incorporate some feedback from Chris...


Modified:
    cfe/trunk/Driver/RewriteTest.cpp
    cfe/trunk/Lex/Preprocessor.cpp

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

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Tue Oct 23 20:09:48 2007
@@ -40,6 +40,7 @@
       SM = &Context->SourceMgr;
       MainFileID = mainFileID;
       MsgSendFunctionDecl = 0;
+      GetClassFunctionDecl = 0;
       Rewrite.setSourceMgr(Context->SourceMgr);
     }
     
@@ -74,9 +75,9 @@
 
   // Look for built-in declarations that we need to refer during the rewrite.
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
-    if (FD->getIdentifier() == &Context->Idents.get("objc_msgSend"))
+    if (strcmp(FD->getName(), "objc_msgSend") == 0)
       MsgSendFunctionDecl = FD;
-    else if (FD->getIdentifier() == &Context->Idents.get("objc_getClass"))
+    else if (strcmp(FD->getName(), "objc_getClass") == 0)
       GetClassFunctionDecl = FD;
   }
   if (SM->getDecomposedFileLoc(Loc).first == MainFileID)
@@ -185,8 +186,7 @@
   // Get the start location and compute the semi location.
   SourceLocation startLoc = ClassDecl->getLocation();
   const char *startBuf = SM->getCharacterData(startLoc);
-  const char *semiPtr = startBuf;
-  while (semiPtr && (*semiPtr != ';')) semiPtr++;
+  const char *semiPtr = strchr(startBuf, ';');
 
   // Translate to typedef's that forward reference structs with the same name
   // as the class. As a convenience, we include the original declaration

Modified: cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Preprocessor.cpp?rev=43285&r1=43284&r2=43285&view=diff

==============================================================================
--- cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/Lex/Preprocessor.cpp Tue Oct 23 20:09:48 2007
@@ -400,7 +400,7 @@
     // Predefine ObjC primitive functions, traditionally declared in
     // <objc/objc-runtime.h>. Unlike the declarations above, we don't protect
     // these with a header guard (since multiple identical function declarations
-    // don't result in an error.
+    // don't result in an error. FIXME: don't predefine these...
     ObjcType = "OBJC_EXPORT id objc_getClass(const char *name);\n";
     Buf.insert(Buf.end(), ObjcType, ObjcType+strlen(ObjcType));
     ObjcType = "OBJC_EXPORT id objc_getMetaClass(const char *name);\n";





More information about the cfe-commits mailing list