objective-c modern translator: beautify rewrite of

struct __rw_objc_super; no functionality change.

llvm-svn: 154632
This commit is contained in:
Fariborz Jahanian 2012-04-12 23:52:52 +00:00
parent 73273275a4
commit 27db0b3754
1 changed files with 7 additions and 7 deletions

View File

@ -5615,8 +5615,13 @@ void RewriteModernObjC::Initialize(ASTContext &context) {
if (IsHeader) if (IsHeader)
Preamble = "#pragma once\n"; Preamble = "#pragma once\n";
Preamble += "struct objc_selector; struct objc_class;\n"; Preamble += "struct objc_selector; struct objc_class;\n";
Preamble += "struct __rw_objc_super { struct objc_object *object; "; Preamble += "struct __rw_objc_super { \n\tstruct objc_object *object; ";
Preamble += "struct objc_object *superClass; "; Preamble += "\n\tstruct objc_object *superClass; ";
// Add a constructor for creating temporary objects.
Preamble += "\n\t__rw_objc_super(struct objc_object *o, struct objc_object *s) ";
Preamble += ": object(o), superClass(s) {} ";
Preamble += "\n};\n";
if (LangOpts.MicrosoftExt) { if (LangOpts.MicrosoftExt) {
// Define all sections using syntax that makes sense. // Define all sections using syntax that makes sense.
// These are currently generated. // These are currently generated.
@ -5640,12 +5645,7 @@ void RewriteModernObjC::Initialize(ASTContext &context) {
Preamble += "#pragma section(\".objc_classrefs$B\", long, read, write)\n"; Preamble += "#pragma section(\".objc_classrefs$B\", long, read, write)\n";
Preamble += "#pragma section(\".objc_superrefs$B\", long, read, write)\n"; Preamble += "#pragma section(\".objc_superrefs$B\", long, read, write)\n";
// Add a constructor for creating temporary objects.
Preamble += "__rw_objc_super(struct objc_object *o, struct objc_object *s) "
": ";
Preamble += "object(o), superClass(s) {} ";
} }
Preamble += "};\n";
Preamble += "#ifndef _REWRITER_typedef_Protocol\n"; Preamble += "#ifndef _REWRITER_typedef_Protocol\n";
Preamble += "typedef struct objc_object Protocol;\n"; Preamble += "typedef struct objc_object Protocol;\n";
Preamble += "#define _REWRITER_typedef_Protocol\n"; Preamble += "#define _REWRITER_typedef_Protocol\n";