Patch to build AST for property implementation declarations and
to print declaration from its AST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50117 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/ASTConsumers.cpp b/Driver/ASTConsumers.cpp
index 9653526..eaee94e 100644
--- a/Driver/ASTConsumers.cpp
+++ b/Driver/ASTConsumers.cpp
@@ -53,6 +53,7 @@
void PrintObjCCategoryDecl(ObjCCategoryDecl *PID);
void PrintObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID);
void PrintObjCPropertyDecl(ObjCPropertyDecl *PD);
+ void PrintObjCPropertyImplDecl(ObjCPropertyImplDecl *PID);
};
} // end anonymous namespace
@@ -228,6 +229,10 @@
}
}
+ for (ObjCImplementationDecl::propimpl_iterator I = OID->propimpl_begin(),
+ E = OID->propimpl_end(); I != E; ++I)
+ PrintObjCPropertyImplDecl(*I);
+
Out << "@end\n";
}
@@ -287,7 +292,10 @@
Out << "@implementation "
<< PID->getClassInterface()->getName()
<< '(' << PID->getName() << ");\n";
-
+ for (ObjCCategoryImplDecl::propimpl_iterator I = PID->propimpl_begin(),
+ E = PID->propimpl_end(); I != E; ++I)
+ PrintObjCPropertyImplDecl(*I);
+ Out << "@end\n";
// FIXME: implement the rest...
}
@@ -367,7 +375,21 @@
Out << ";\n";
}
-
+
+/// PrintObjCPropertyImplDecl - Print an objective-c property implementation
+/// declaration syntax.
+///
+void DeclPrinter::PrintObjCPropertyImplDecl(ObjCPropertyImplDecl *PID) {
+ if (PID->getPropertyImplementation() ==
+ ObjCPropertyImplDecl::OBJC_PR_IMPL_SYNTHSIZE)
+ Out << "\n@synthesize ";
+ else
+ Out << "\n@dynamic ";
+ Out << PID->getPropertyDecl()->getName();
+ if (PID->getPropertyIvarDecl())
+ Out << "=" << PID->getPropertyIvarDecl()->getName();
+ Out << ";\n";
+}
//===----------------------------------------------------------------------===//
/// ASTPrinter - Pretty-printer of ASTs