]> granicus.if.org Git - clang/commitdiff
Fixed a bug whereby a parethesized collection expression was not being rewritten...
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 9 Jan 2008 17:50:00 +0000 (17:50 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 9 Jan 2008 17:50:00 +0000 (17:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45776 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/RewriteTest.cpp
test/Sema/rewrite-foreach-1.m

index ee2f8ef2f6538d47e42d24d137a3f95cf35e24a0..1ba0af5ae33618b457fe2198683fa0cbc8168258 100644 (file)
@@ -854,7 +854,7 @@ Stmt *RewriteTest::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S) {
   // 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";
   
index 71e3fbd582ecc8b5ed446aa41b15555e1b621896..5962f3332e79b13aa7dc42dffd9e9627c5a77b21 100644 (file)
@@ -24,6 +24,14 @@ int LOOP();
          { LOOP(); }
         for (id el1 in self) 
          LOOP();
+
+       for (el in (self)) 
+          if (el)
+            LOOP(); 
+
+       for (el in ((self))) 
+          if (el)
+            LOOP(); 
 }
 @end