[cfe-commits] r71107 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Wed May 6 12:07:11 PDT 2009
Author: snaroff
Date: Wed May 6 14:07:09 2009
New Revision: 71107
URL: http://llvm.org/viewvc/llvm-project?rev=71107&view=rev
Log:
Finish fixing <rdar://problem/6845623> from protocol to template.
Modified:
cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Modified: cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp?rev=71107&r1=71106&r2=71107&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Wed May 6 14:07:09 2009
@@ -4382,8 +4382,16 @@
if (DeclStmt *DS = dyn_cast<DeclStmt>(S)) {
// FIXME: What we're doing here is modifying the type-specifier that
// precedes the first Decl. In the future the DeclGroup should have
- // a separate type-specifier that we can rewrite.
- RewriteObjCQualifiedInterfaceTypes(*DS->decl_begin());
+ // a separate type-specifier that we can rewrite.
+ // NOTE: We need to avoid rewriting rewriting the DeclStmt if it is within
+ // the context of an ObjCForCollectionStmt. For example:
+ // NSArray *someArray;
+ // for (id <FooProtocol> index in someArray) ;
+ // This is because RewriteObjCForCollectionStmt() does textual rewriting
+ // and it depends on the original text locations/positions.
+ Stmt *ParentStmt = Stmts.back();
+ if (!ParentStmt || !isa<ObjCForCollectionStmt>(ParentStmt))
+ RewriteObjCQualifiedInterfaceTypes(*DS->decl_begin());
// Blocks rewrite rules.
for (DeclStmt::decl_iterator DI = DS->decl_begin(), DE = DS->decl_end();
More information about the cfe-commits
mailing list