aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Rewrite/RewriteModernObjC.cpp19
-rw-r--r--test/Rewriter/rewrite-modern-class.mm9
2 files changed, 18 insertions, 10 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index 6e075f26d8..9c9526109b 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -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();
diff --git a/test/Rewriter/rewrite-modern-class.mm b/test/Rewriter/rewrite-modern-class.mm
index 4221c7bc2f..964ef00eb6 100644
--- a/test/Rewriter/rewrite-modern-class.mm
+++ b/test/Rewriter/rewrite-modern-class.mm
@@ -60,3 +60,12 @@
return (SUPER *)0;
}
@end
+
+@class FORM_CLASS;
+@interface INTF_DECL {
+}
+@end
+
+double Meth(INTF_DECL *p, FORM_CLASS *f) {
+ return 1.34;
+}