[cfe-commits] r70922 - /cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp
Steve Naroff
snaroff at apple.com
Mon May 4 15:12:42 PDT 2009
Author: snaroff
Date: Mon May 4 17:12:42 2009
New Revision: 70922
URL: http://llvm.org/viewvc/llvm-project?rev=70922&view=rev
Log:
Fix <rdar://problem/6845623> from protocol to template.
Need to make sure RewriteObjC::RewriteObjCForCollectionStmt() transcribes all qualified ObjC types to 'id'.
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=70922&r1=70921&r2=70922&view=diff
==============================================================================
--- cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp (original)
+++ cfe/branches/Apple/objective-rewrite/tools/clang/Driver/RewriteObjC.cpp Mon May 4 17:12:42 2009
@@ -1315,7 +1315,12 @@
// type elem;
NamedDecl* D = cast<NamedDecl>(DS->getSolitaryDecl());
QualType ElementType = cast<ValueDecl>(D)->getType();
- elementTypeAsString = ElementType.getAsString();
+ if (ElementType->isObjCQualifiedIdType() ||
+ ElementType->isObjCQualifiedInterfaceType())
+ // Simply use 'id' for all qualified types.
+ elementTypeAsString = "id";
+ else
+ elementTypeAsString = ElementType.getAsString();
buf += elementTypeAsString;
buf += " ";
elementName = D->getNameAsCString();
@@ -1325,8 +1330,13 @@
else {
DeclRefExpr *DR = cast<DeclRefExpr>(S->getElement());
elementName = DR->getDecl()->getNameAsCString();
- elementTypeAsString
- = cast<ValueDecl>(DR->getDecl())->getType().getAsString();
+ ValueDecl *VD = cast<ValueDecl>(DR->getDecl());
+ if (VD->getType()->isObjCQualifiedIdType() ||
+ VD->getType()->isObjCQualifiedInterfaceType())
+ // Simply use 'id' for all qualified types.
+ elementTypeAsString = "id";
+ else
+ elementTypeAsString = VD->getType().getAsString();
}
// struct __objcFastEnumerationState enumState = { 0 };
More information about the cfe-commits
mailing list