[cfe-commits] r151106 - in /cfe/trunk: lib/Rewrite/RewriteModernObjC.cpp test/Rewriter/rewrite-modern-class.mm
Fariborz Jahanian
fjahanian at apple.com
Tue Feb 21 15:58:42 PST 2012
Author: fjahanian
Date: Tue Feb 21 17:58:41 2012
New Revision: 151106
URL: http://llvm.org/viewvc/llvm-project?rev=151106&view=rev
Log:
modern objc translator: fixes a bug where a class declaration with not
any implementation in tu was not being translated.
Modified:
cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
cfe/trunk/test/Rewriter/rewrite-modern-class.mm
Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=151106&r1=151105&r2=151106&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Tue Feb 21 17:58:41 2012
@@ -3230,16 +3230,6 @@
/// and emits meta-data.
void RewriteModernObjC::RewriteImplementations() {
-
- for (unsigned i = 0, e = ObjCInterfacesSeen.size(); i < e; i++) {
- ObjCInterfaceDecl *CDecl = ObjCInterfacesSeen[i];
- // Write struct declaration for the class matching its ivar declarations.
- // Note that for modern abi, this is postponed until the end of TU
- // because class extensions and the implementation might declare their own
- // private ivars.
- RewriteInterfaceDecl(CDecl);
- }
-
int ClsDefCount = ClassImplementation.size();
int CatDefCount = CategoryImplementation.size();
@@ -5022,6 +5012,15 @@
RewriteObjCProtocolMetaData(*I, Preamble);
InsertText(SM->getLocForStartOfFile(MainFileID), Preamble, false);
+ for (unsigned i = 0, e = ObjCInterfacesSeen.size(); i < e; i++) {
+ ObjCInterfaceDecl *CDecl = ObjCInterfacesSeen[i];
+ // Write struct declaration for the class matching its ivar declarations.
+ // Note that for modern abi, this is postponed until the end of TU
+ // because class extensions and the implementation might declare their own
+ // private ivars.
+ RewriteInterfaceDecl(CDecl);
+ }
+
if (ClassImplementation.size() || CategoryImplementation.size())
RewriteImplementations();
Modified: cfe/trunk/test/Rewriter/rewrite-modern-class.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-modern-class.mm?rev=151106&r1=151105&r2=151106&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-modern-class.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-modern-class.mm Tue Feb 21 17:58:41 2012
@@ -60,3 +60,12 @@
return (SUPER *)0;
}
@end
+
+ at class FORM_CLASS;
+ at interface INTF_DECL {
+}
+ at end
+
+double Meth(INTF_DECL *p, FORM_CLASS *f) {
+ return 1.34;
+}
More information about the cfe-commits
mailing list