[cfe-commits] r45776 - in /cfe/trunk: Driver/RewriteTest.cpp test/Sema/rewrite-foreach-1.m

Fariborz Jahanian fjahanian at apple.com
Wed Jan 9 09:50:01 PST 2008


Author: fjahanian
Date: Wed Jan  9 11:50:00 2008
New Revision: 45776

URL: http://llvm.org/viewvc/llvm-project?rev=45776&view=rev
Log:
Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.

Modified:
    cfe/trunk/Driver/RewriteTest.cpp
    cfe/trunk/test/Sema/rewrite-foreach-1.m

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

==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Wed Jan  9 11:50:00 2008
@@ -854,7 +854,7 @@
   // Replace ')' in for '(' type elem in collection ')' with ';'
   SourceLocation endCollectionLoc = S->getCollection()->getLocEnd();
   const char *endCollectionBuf = SM->getCharacterData(endCollectionLoc);
-  const char *lparenBuf = strchr(endCollectionBuf, ')');
+  const char *lparenBuf = strchr(endCollectionBuf+1, ')');
   SourceLocation lparenLoc = startLoc.getFileLocWithOffset(lparenBuf-startBuf);
   buf = ";\n\t";
   

Modified: cfe/trunk/test/Sema/rewrite-foreach-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/rewrite-foreach-1.m?rev=45776&r1=45775&r2=45776&view=diff

==============================================================================
--- cfe/trunk/test/Sema/rewrite-foreach-1.m (original)
+++ cfe/trunk/test/Sema/rewrite-foreach-1.m Wed Jan  9 11:50:00 2008
@@ -24,6 +24,14 @@
 	  { LOOP(); }
         for (id el1 in self) 
 	  LOOP();
+
+	for (el in (self)) 
+          if (el)
+            LOOP(); 
+
+	for (el in ((self))) 
+          if (el)
+            LOOP(); 
 }
 @end
 





More information about the cfe-commits mailing list