clang ObjC rewriter: generated code used in "for (x in y)" loop uses

incorrect cast, causing compile error (fixes radar 7342867).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92986 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2010-01-08 01:29:44 +00:00
Родитель a1d7d627a4
Коммит 65b0aa5d39
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -1483,14 +1483,18 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S,
SynthCountByEnumWithState(buf);
buf += ");\n\t";
buf += elementName;
buf += " = ((id)0);\n\t";
buf += " = ((";
buf += elementTypeAsString;
buf += ")0);\n\t";
buf += "__break_label_";
buf += utostr(ObjCBcLabelNo.back());
buf += ": ;\n\t";
buf += "}\n\t";
buf += "else\n\t\t";
buf += elementName;
buf += " = ((id)0);\n";
buf += " = ((";
buf += elementTypeAsString;
buf += ")0);\n\t";
buf += "}\n";
// Insert all these *after* the statement body.

Просмотреть файл

@ -0,0 +1,7 @@
// RUN: %clang_cc1 -rewrite-objc %s -o -
@class NSArray;
int main() {
NSArray *foo;
for (Class c in foo) { }
}