diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-01-08 01:29:44 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-01-08 01:29:44 +0000 |
commit | 65b0aa5d3973e07c8c4449ef2b81c389fd48229a (patch) | |
tree | c2d709645ea6e7350f680934b152dca8ac8e2008 /lib/Frontend/RewriteObjC.cpp | |
parent | a1d7d627a4e6b2f5586644b848b9bd62f54109f4 (diff) |
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
Diffstat (limited to 'lib/Frontend/RewriteObjC.cpp')
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index 4245856efa..ee803a33e3 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -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. |