]> granicus.if.org Git - clang/commitdiff
modern objc translator: fixes a bug where a class declaration with not
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 21 Feb 2012 23:58:41 +0000 (23:58 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 21 Feb 2012 23:58:41 +0000 (23:58 +0000)
any implementation in tu was not being translated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151106 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Rewrite/RewriteModernObjC.cpp
test/Rewriter/rewrite-modern-class.mm

index 6e075f26d8c8b868105c8864ccad635363037f98..9c9526109b2eeba2e4f1eea4828119731bd4d092 100644 (file)
@@ -3230,16 +3230,6 @@ void RewriteModernObjC::RewriteObjCInternalStruct(ObjCInterfaceDecl *CDecl,
 /// 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 @@ void RewriteModernObjC::HandleTranslationUnit(ASTContext &C) {
     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();
 
index 4221c7bc2f1b854f3ba4d77119080d494bf24284..964ef00eb6e42dfe6c1e16f9828b36c9a9fe8fd1 100644 (file)
   return (SUPER *)0;
 }
 @end
+
+@class FORM_CLASS;
+@interface INTF_DECL  {
+}
+@end
+
+double Meth(INTF_DECL *p, FORM_CLASS *f) {
+  return 1.34;
+}