[cfe-commits] r93201 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-forward-class.m
Fariborz Jahanian
fjahanian at apple.com
Mon Jan 11 14:48:40 PST 2010
Author: fjahanian
Date: Mon Jan 11 16:48:40 2010
New Revision: 93201
URL: http://llvm.org/viewvc/llvm-project?rev=93201&view=rev
Log:
Fix rewriting for forward class declaration.
(fixes radar 6969189).
Added:
cfe/trunk/test/Rewriter/rewrite-forward-class.m
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=93201&r1=93200&r2=93201&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Mon Jan 11 16:48:40 2010
@@ -787,9 +787,17 @@
// 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();
Added: cfe/trunk/test/Rewriter/rewrite-forward-class.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-forward-class.m?rev=93201&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-forward-class.m (added)
+++ cfe/trunk/test/Rewriter/rewrite-forward-class.m Mon Jan 11 16:48:40 2010
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -rewrite-objc -o - %s
+// rdar://6969189
+
+ at class XX;
+ at class YY, ZZ, QQ;
+ at class ISyncClient, SMSession, ISyncManager, ISyncSession, SMDataclassInfo, SMClientInfo,
+ DMCConfiguration, DMCStatusEntry;
+
More information about the cfe-commits
mailing list