Fix rewriting for forward class declaration.

(fixes radar 6969189).

llvm-svn: 93201
This commit is contained in:
Fariborz Jahanian 2010-01-11 22:48:40 +00:00
parent a6b1356cf9
commit 1c2cb6df9e
2 changed files with 19 additions and 3 deletions

View File

@ -787,9 +787,17 @@ void RewriteObjC::RewriteForwardClassDecl(ObjCClassDecl *ClassDecl) {
// as the class. As a convenience, we include the original declaration
// as a comment.
std::string typedefString;
typedefString += "// ";
typedefString.append(startBuf, semiPtr-startBuf+1);
typedefString += "\n";
typedefString += "// @class ";
for (ObjCClassDecl::iterator I = ClassDecl->begin(), E = ClassDecl->end();
I != E; ++I) {
ObjCInterfaceDecl *ForwardDecl = I->getInterface();
typedefString += ForwardDecl->getNameAsString();
if (I+1 != E)
typedefString += ", ";
else
typedefString += ";\n";
}
for (ObjCClassDecl::iterator I = ClassDecl->begin(), E = ClassDecl->end();
I != E; ++I) {
ObjCInterfaceDecl *ForwardDecl = I->getInterface();

View File

@ -0,0 +1,8 @@
// RUN: %clang_cc1 -rewrite-objc -o - %s
// rdar://6969189
@class XX;
@class YY, ZZ, QQ;
@class ISyncClient, SMSession, ISyncManager, ISyncSession, SMDataclassInfo, SMClientInfo,
DMCConfiguration, DMCStatusEntry;