diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-25 00:14:44 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-25 00:14:44 +0000 |
commit | 8e991ba2e256e56959a65a049e161aa30b3c0dec (patch) | |
tree | 7e0a5180f58b5927b0fd56addad11ebd7dc0697e /Driver/RewriteTest.cpp | |
parent | 54395d440dc82a5e51b945c6c2a7f4bc4bea0358 (diff) |
Refactored RewriteObjcMethodsMetaData to better rewrite
instance/class methods metadata.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/RewriteTest.cpp')
-rw-r--r-- | Driver/RewriteTest.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp index 66e2203726..17fd0473fc 100644 --- a/Driver/RewriteTest.cpp +++ b/Driver/RewriteTest.cpp @@ -68,8 +68,8 @@ namespace { void RewriteObjcMethodsMetaData(ObjcMethodDecl **Methods, int NumMethods, + bool IsInstanceMethod, const char *prefix, - const char *MethodKind, const char *ClassName); void RewriteObjcProtocolsMetaData(ObjcProtocolDecl **Protocols, @@ -358,8 +358,8 @@ Stmt *RewriteTest::RewriteMessageExpr(ObjCMessageExpr *Exp) { /// class methods. void RewriteTest::RewriteObjcMethodsMetaData(ObjcMethodDecl **Methods, int NumMethods, + bool IsInstanceMethod, const char *prefix, - const char *MethodKind, const char *ClassName) { static bool objc_impl_method = false; if (NumMethods > 0 && !objc_impl_method) { @@ -389,8 +389,9 @@ void RewriteTest::RewriteObjcMethodsMetaData(ObjcMethodDecl **Methods, printf("\tint method_count;\n"); printf("\tstruct _objc_method method_list[%d];\n", NumMethods); printf("} _OBJC_%s%s_METHODS_%s " - "__attribute__ ((section (\"__OBJC, __inst_meth\")))= " - "{\n\t0, %d\n", prefix, MethodKind, ClassName, NumMethods); + "__attribute__ ((section (\"__OBJC, __%s_meth\")))= " + "{\n\t0, %d\n", prefix, IsInstanceMethod ? "INSTANCE" : "CLASS", + ClassName, IsInstanceMethod ? "inst" : "cls", NumMethods); for (int i = 0; i < NumMethods; i++) // TODO: 1) method selector name may hav to go into their own section // 2) encode method types for use here (which may have to go into @@ -547,12 +548,14 @@ void RewriteTest::RewriteObjcCategoryImplDecl(ObjcCategoryImplDecl *IDecl) { // Build _objc_method_list for class's instance methods if needed RewriteObjcMethodsMetaData(IDecl->getInstanceMethods(), IDecl->getNumInstanceMethods(), - "CATEGORY_", "INSTANCE", FullCategoryName); + true, + "CATEGORY_", FullCategoryName); // Build _objc_method_list for class's class methods if needed RewriteObjcMethodsMetaData(IDecl->getClassMethods(), IDecl->getNumClassMethods(), - "CATEGORY_", "CLASS", FullCategoryName); + false, + "CATEGORY_", FullCategoryName); // Protocols referenced in class declaration? RewriteObjcProtocolsMetaData(CDecl->getReferencedProtocols(), @@ -666,12 +669,14 @@ void RewriteTest::RewriteObjcClassMetaData(ObjcImplementationDecl *IDecl) { // Build _objc_method_list for class's instance methods if needed RewriteObjcMethodsMetaData(IDecl->getInstanceMethods(), IDecl->getNumInstanceMethods(), - "", "INSTANCE", IDecl->getName()); + true, + "", IDecl->getName()); // Build _objc_method_list for class's class methods if needed RewriteObjcMethodsMetaData(IDecl->getClassMethods(), - IDecl->getNumClassMethods(), - "", "CLASS", IDecl->getName()); + IDecl->getNumClassMethods(), + false, + "", IDecl->getName()); // Protocols referenced in class declaration? RewriteObjcProtocolsMetaData(CDecl->getReferencedProtocols(), |