Home | History | Annotate | Download | only in Frontend

Lines Matching defs:Result

349                                       std::string &Result);
351 void RewriteObjCFieldDecl(FieldDecl *fieldDecl, std::string &Result);
355 std::string &Result);
357 bool RewriteObjCFieldDeclType(QualType &Type, std::string &Result);
360 std::string &Result);
401 std::string &Result);
403 std::string &Result);
406 StringRef prefix, StringRef ClassName, std::string &Result);
408 std::string &Result);
409 void RewriteClassSetupInitHook(std::string &Result);
411 void RewriteMetaDataIntoBuffer(std::string &Result);
412 void WriteImageInfo(std::string &Result);
414 std::string &Result);
415 void RewriteCategorySetupInitHook(std::string &Result);
419 std::string &Result);
532 QualType getSimpleFunctionType(QualType result,
536 if (result == Context->getObjCInstanceType())
537 result = Context->getObjCIdType();
540 return Context->getFunctionType(result, args, numArgs, fpi);
785 ObjCIvarDecl *IvarDecl, std::string &Result) {
786 Result += "OBJC_IVAR_$_";
787 Result += IDecl->getName();
788 Result += "$";
789 Result += IvarDecl->getName();
1936 std::string Result;
1943 Result = "catch (_objc_exc_"; Result += IDecl->getNameAsString();
1944 Result += " *_"; Result += catchDecl->getNameAsString();
1945 Result += ")";
1946 ReplaceText(startLoc, rParenBuf-startBuf+1, Result);
1948 Result.clear();
1949 Result = "{ ";
1950 Result += IDecl->getNameAsString();
1951 Result += " *"; Result += catchDecl->getNameAsString();
1952 Result += " = ("; Result += IDecl->getNameAsString(); Result += "*)";
1953 Result += "_"; Result += catchDecl->getNameAsString();
1955 Result += "; ";
1957 ReplaceText(lBraceLoc, 1, Result);
3083 /// returnType - Result type of the method being synthesized.
3701 std::string &Result) {
3703 Result += "\t";
3709 return RewriteObjCFieldDeclType(ElemTy, Result);
3715 Result += "\n\tstruct ";
3717 Result += "\n\tunion ";
3721 Result += RD->getName();
3724 Result += " ";
3727 Result += " {\n";
3731 RewriteObjCFieldDecl(FD, Result);
3733 Result += "\t} ";
3740 Result += "\n\tenum ";
3741 Result += ED->getName();
3744 Result += " ";
3748 Result += " {\n";
3751 Result += "\t"; Result += EC->getName(); Result += " = ";
3753 Result += Val.toString(10);
3754 Result += ",\n";
3756 Result += "\t} ";
3761 Result += "\t";
3770 std::string &Result) {
3774 bool EleboratedType = RewriteObjCFieldDeclType(Type, Result);
3777 Result += Name;
3779 Result += " : "; Result += utostr(fieldDecl->getBitWidthValue(*Context));
3785 Result += "[";
3787 Result += utostr(Dim.getZExtValue());
3788 Result += "]";
3794 Result += ";\n";
3800 std::string &Result) {
3823 RewriteObjCFieldDeclType(Type, Result);
3824 Result += ";";
3835 std::string &Result) {
3856 ReplaceText(LocStart, endBuf-startBuf, Result);
3864 RewriteLocallyDefinedNamedAggregates(IVars[i], Result);
3866 Result += "\nstruct ";
3867 Result += CDecl->getNameAsString();
3868 Result += "_IMPL {\n";
3871 Result += "\tstruct "; Result += RCDecl->getNameAsString();
3872 Result += "_IMPL "; Result += RCDecl->getNameAsString();
3873 Result += "_IVARS;\n";
3877 RewriteObjCFieldDecl(IVars[i], Result);
3879 Result += "};\n";
3881 ReplaceText(LocStart, endBuf-startBuf, Result);
3890 std::string &Result) {
3899 Result += "\n";
3901 Result += "__declspec(allocate(\".objc_ivar$B\")) ";
3902 Result += "extern \"C\" ";
3906 Result += "__declspec(dllimport) ";
3908 Result += "unsigned long ";
3909 WriteInternalIvarName(CDecl, IvarDecl, Result);
3910 Result += ";";
4316 // removed as result of rewriting of block literals.
4460 /// whose result type may be a block pointer or whose argument type(s)
5762 std::string &Result) {
5765 Result += "static ";
5766 Result += "struct _protocol_t *";
5767 Result += "_OBJC_PROTOCOL_REFERENCE_$_";
5768 Result += PDecl->getNameAsString();
5769 Result += " = &";
5770 ResultResult += PDecl->getNameAsString();
5771 Result += ";\n";
5995 std::string &Result) {
5999 Result += "0";
6001 Result += "__OFFSETOFIVAR__(struct ";
6002 Result += ivar->getContainingInterface()->getNameAsString();
6004 Result += "_IMPL";
6005 Result += ", ";
6006 Result += ivar->getNameAsString();
6007 Result += ")";
6113 static void WriteModernMetadataDeclarations(ASTContext *Context, std::string &Result) {
6118 Result += "\nstruct _prop_t {\n";
6119 Result += "\tconst char *name;\n";
6120 Result += "\tconst char *attributes;\n";
6121 Result += "};\n";
6123 Result += "\nstruct _protocol_t;\n";
6125 Result += "\nstruct _objc_method {\n";
6126 Result += "\tstruct objc_selector * _cmd;\n";
6127 Result += "\tconst char *method_type;\n";
6128 Result += "\tvoid *_imp;\n";
6129 Result += "};\n";
6131 Result += "\nstruct _protocol_t {\n";
6132 Result += "\tvoid * isa; // NULL\n";
6133 Result += "\tconst char *protocol_name;\n";
6134 Result += "\tconst struct _protocol_list_t * protocol_list; // super protocols\n";
6135 Result += "\tconst struct method_list_t *instance_methods;\n";
6136 Result += "\tconst struct method_list_t *class_methods;\n";
6137 Result += "\tconst struct method_list_t *optionalInstanceMethods;\n";
6138 Result += "\tconst struct method_list_t *optionalClassMethods;\n";
6139 Result += "\tconst struct _prop_list_t * properties;\n";
6140 Result += "\tconst unsigned int size; // sizeof(struct _protocol_t)\n";
6141 Result += "\tconst unsigned int flags; // = 0\n";
6142 Result += "\tconst char ** extendedMethodTypes;\n";
6143 Result += "};\n";
6145 Result += "\nstruct _ivar_t {\n";
6146 Result += "\tunsigned long int *offset; // pointer to ivar offset location\n";
6147 Result += "\tconst char *name;\n";
6148 Result += "\tconst char *type;\n";
6149 Result += "\tunsigned int alignment;\n";
6150 Result += "\tunsigned int size;\n";
6151 Result += "};\n";
6153 Result += "\nstruct _class_ro_t {\n";
6154 Result += "\tunsigned int flags;\n";
6155 Result += "\tunsigned int instanceStart;\n";
6156 Result += "\tunsigned int instanceSize;\n";
6159 Result += "\tunsigned int reserved;\n";
6160 Result += "\tconst unsigned char *ivarLayout;\n";
6161 Result += "\tconst char *name;\n";
6162 Result += "\tconst struct _method_list_t *baseMethods;\n";
6163 Result += "\tconst struct _objc_protocol_list *baseProtocols;\n";
6164 Result += "\tconst struct _ivar_list_t *ivars;\n";
6165 Result += "\tconst unsigned char *weakIvarLayout;\n";
6166 Result += "\tconst struct _prop_list_t *properties;\n";
6167 Result += "};\n";
6169 Result += "\nstruct _class_t {\n";
6170 Result += "\tstruct _class_t *isa;\n";
6171 Result += "\tstruct _class_t *superclass;\n";
6172 Result += "\tvoid *cache;\n";
6173 Result += "\tvoid *vtable;\n";
6174 Result += "\tstruct _class_ro_t *ro;\n";
6175 Result += "};\n";
6177 Result += "\nstruct _category_t {\n";
6178 Result += "\tconst char *name;\n";
6179 Result += "\tstruct _class_t *cls;\n";
6180 Result += "\tconst struct _method_list_t *instance_methods;\n";
6181 Result += "\tconst struct _method_list_t *class_methods;\n";
6182 Result += "\tconst struct _protocol_list_t *protocols;\n";
6183 Result += "\tconst struct _prop_list_t *properties;\n";
6184 Result += "};\n";
6186 Result += "extern \"C\" __declspec(dllimport) struct objc_cache _objc_empty_cache;\n";
6187 Result += "#pragma warning(disable:4273)\n";
6191 Result,
6193 Result += "struct /*_protocol_list_t*/"; Result += " {\n";
6194 Result += "\tlong protocol_count; // Note, this is 32/64 bit\n";
6195 Result += "\tstruct _protocol_t *super_protocols[";
6196 Result += utostr(super_protocol_count); Result += "];\n";
6197 Result += "}";
6200 static void Write_method_list_t_TypeDecl(std::string &Result,
6202 Result += "struct /*_method_list_t*/"; Result += " {\n";
6203 Result += "\tunsigned int entsize; // sizeof(struct _objc_method)\n";
6204 Result += "\tunsigned int method_count;\n";
6205 Result += "\tstruct _objc_method method_list[";
6206 Result += utostr(method_count); Result += "];\n";
6207 Result += "}";
6210 static void Write__prop_list_t_TypeDecl(std::string &Result,
6212 Result += "struct /*_prop_list_t*/"; Result += " {\n";
6213 Result += "\tunsigned int entsize; // sizeof(struct _prop_t)\n";
6214 Result += "\tunsigned int count_of_properties;\n";
6215 Result += "\tstruct _prop_t prop_list[";
6216 Result += utostr(property_count); Result += "];\n";
6217 Result += "}";
6220 static void Write__ivar_list_t_TypeDecl(std::string &Result,
6222 Result += "struct /*_ivar_list_t*/"; Result += " {\n";
6223 Result += "\tunsigned int entsize; // sizeof(struct _prop_t)\n";
6224 Result += "\tunsigned int count;\n";
6225 Result += "\tstruct _ivar_t ivar_list[";
6226 Result += utostr(ivar_count); Result += "];\n";
6227 Result += "}";
6230 static void Write_protocol_list_initializer(ASTContext *Context, std::string &Result,
6235 Result += "\nstatic ";
6236 Write_protocol_list_t_TypeDecl(Result, SuperProtocols.size());
6237 Result += " "; Result += VarName;
6238 Result += ProtocolName;
6239 Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
6240 Result += "\t"; Result += utostr(SuperProtocols.size()); Result += ",\n";
6243 Result += "\t&"; Result += "_OBJC_PROTOCOL_";
6244 Result += SuperPD->getNameAsString();
6246 Result += "\n};\n";
6248 Result += ",\n";
6254 ASTContext *Context, std::string &Result,
6260 Result += "\nstatic ";
6261 Write_method_list_t_TypeDecl(Result, Methods.size());
6262 Result += " "; Result += VarName;
6263 Result += TopLevelDeclName;
6264 Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
6265 Result += "\t"; Result += "sizeof(_objc_method)"; Result += ",\n";
6266 Result += "\t"; Result += utostr(Methods.size()); Result += ",\n";
6270 Result += "\t{{(struct objc_selector *)\"";
6272 Result += "\t{(struct objc_selector *)\"";
6273 Result += (MD)->getSelector().getAsString(); Result += "\"";
6274 Result += ", ";
6277 Result += "\""; Result += MethodTypeString; Result += "\"";
6278 Result += ", ";
6280 Result += "0";
6282 Result += "(void *)";
6283 Result += RewriteObj.MethodInternalNames[MD];
6286 Result += "}}\n";
6288 Result += "},\n";
6290 Result += "};\n";
6295 ASTContext *Context, std::string &Result,
6301 Result += "\nstatic ";
6302 Write__prop_list_t_TypeDecl(Result, Properties.size());
6303 Result += " "; Result += VarName;
6304 Result += ProtocolName;
6305 Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
6306 Result += "\t"; Result += "sizeof(_prop_t)"; Result += ",\n";
6307 Result += "\t"; Result += utostr(Properties.size()); Result += ",\n";
6311 Result += "\t{{\"";
6313 Result += "\t{\"";
6314 Result += PropDecl->getName(); Result += "\",";
6318 Result += "\""; Result += QuotePropertyTypeString; Result += "\"";
6320 Result += "}}\n";
6322 Result += "},\n";
6324 Result += "};\n";
6342 static void Write__class_ro_t_initializer(ASTContext *Context, std::string &Result,
6352 Result += "\nstatic struct _class_ro_t ";
6353 Result += VarName; Result += ClassName;
6354 Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
6355 Result += "\t";
6356 Result += llvm::utostr(flags); Result += ", ";
6357 Result += InstanceStart; Result += ", ";
6358 Result += InstanceSize; Result += ", \n";
6359 Result += "\t";
6363 Result += "(unsigned int)0, \n\t";
6365 Result += "0, \n\t";
6366 Result += "\""; Result += ClassName; Result += "\",\n\t";
6369 Result += "(const struct _method_list_t *)&";
6371 Result += "_OBJC_$_CLASS_METHODS_";
6373 Result += "_OBJC_$_INSTANCE_METHODS_";
6374 Result += ClassName;
6375 Result += ",\n\t";
6378 Result += "0, \n\t";
6381 Result += "(const struct _objc_protocol_list *)&";
6382 Result += "_OBJC_CLASS_PROTOCOLS_$_"; Result += ClassName;
6383 Result += ",\n\t";
6386 Result += "0, \n\t";
6389 Result += "(const struct _ivar_list_t *)&";
6390 Result += "_OBJC_$_INSTANCE_VARIABLES_"; Result += ClassName;
6391 Result += ",\n\t";
6394 Result += "0, \n\t";
6397 Result += "0, \n\t";
6399 Result += "(const struct _prop_list_t *)&";
6400 Result += "_OBJC_$_PROP_LIST_"; Result += ClassName;
6401 Result += ",\n";
6404 Result += "0, \n";
6406 Result += "};\n";
6409 static void Write_class_t(ASTContext *Context, std::string &Result,
6425 Result += "\n";
6426 Result += "extern \"C\" ";
6428 Result += "__declspec(dllexport) ";
6430 Result += "__declspec(dllimport) ";
6432 Result += "struct _class_t OBJC_CLASS_$_";
6433 Result += CDecl->getNameAsString();
6434 Result += ";\n";
6439 Result += "\n";
6440 Result += "extern \"C\" ";
6442 Result += "__declspec(dllexport) ";
6444 Result += "__declspec(dllimport) ";
6446 Result += "struct _class_t ";
6447 Result += VarName;
6448 Result += SuperClass->getNameAsString();
6449 Result += ";\n";
6452 Result += "extern \"C\" ";
6454 Result += "__declspec(dllexport) ";
6456 Result += "__declspec(dllimport) ";
6458 Result += "struct _class_t ";
6459 Result += VarName;
6460 Result += RootClass->getNameAsString();
6461 Result += ";\n";
6465 Result += "\nextern \"C\" __declspec(dllexport) struct _class_t ";
6466 Result += VarName; Result += CDecl->getNameAsString();
6467 Result += " __attribute__ ((used, section (\"__DATA,__objc_data\"))) = {\n";
6468 Result += "\t";
6471 Result += "0, // &"; Result += VarName;
6472 Result += RootClass->getNameAsString();
6473 Result += ",\n\t";
6474 Result += "0, // &"; Result += VarName;
6475 Result += CDecl->getSuperClass()->getNameAsString();
6476 Result += ",\n\t";
6479 Result += "0, // &"; Result += VarName;
6480 Result += CDecl->getNameAsString();
6481 Result += ",\n\t";
6482 Result += "0, // &OBJC_CLASS_$_"; Result += CDecl->getNameAsString();
6483 Result += ",\n\t";
6487 Result += "0, // &OBJC_METACLASS_$_";
6488 Result += CDecl->getNameAsString();
6489 Result += ",\n\t";
6491 Result += "0, // &"; Result += VarName;
6492 Result += CDecl->getSuperClass()->getNameAsString();
6493 Result += ",\n\t";
6496 Result += "0,\n\t";
6498 Result += "0, // (void *)&_objc_empty_cache,\n\t";
6499 Result += "0, // unused, was (void *)&_objc_empty_vtable,\n\t";
6501 Result += "&_OBJC_METACLASS_RO_$_";
6503 Result += "&_OBJC_CLASS_RO_$_";
6504 Result += CDecl->getNameAsString();
6505 Result += ",\n};\n";
6515 Result += "static void OBJC_CLASS_SETUP_$_";
6516 Result += CDecl->getNameAsString();
6517 Result += "(void ) {\n";
6518 Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString();
6519 Result += ".isa = "; Result += "&OBJC_METACLASS_$_";
6520 Result += RootClass->getNameAsString(); Result += ";\n";
6522 Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString();
6523 Result += ".superclass = ";
6525 Result += "&OBJC_CLASS_$_";
6527 Result += "&OBJC_METACLASS_$_";
6529 Result += SuperClass->getNameAsString(); Result += ";\n";
6531 Result += "\tOBJC_METACLASS_$_"; Result += CDecl->getNameAsString();
6532 Result += ".cache = "; Result += "&_objc_empty_cache"; Result += ";\n";
6534 Result += "\tOBJC_CLASS_$_"; Result += CDecl->getNameAsString();
6535 Result += ".isa = "; Result += "&OBJC_METACLASS_$_";
6536 Result += CDecl->getNameAsString(); Result += ";\n";
6539 Result += "\tOBJC_CLASS_$_"; Result += CDecl->getNameAsString();
6540 Result += ".superclass = "; Result += "&OBJC_CLASS_$_";
6541 Result += SuperClass->getNameAsString(); Result += ";\n";
6544 Result += "\tOBJC_CLASS_$_"; Result += CDecl->getNameAsString();
6545 Result += ".cache = "; Result += "&_objc_empty_cache"; Result += ";\n";
6546 Result += "}\n";
6550 std::string &Result,
6561 Result += "\n";
6562 Result += "extern \"C\" ";
6564 Result += "__declspec(dllexport) ";
6566 Result += "__declspec(dllimport) ";
6568 Result += "struct _class_t ";
6569 Result += "OBJC_CLASS_$_"; Result += ClassName;
6570 Result += ";\n";
6572 Result += "\nstatic struct _category_t ";
6573 Result += "_OBJC_$_CATEGORY_";
6574 Result += ClassName; Result += "_$_"; Result += CatName;
6575 Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = \n";
6576 Result += "{\n";
6577 Result += "\t\""; Result += ClassName; Result += "\",\n";
6578 Result += "\t0, // &"; Result += "OBJC_CLASS_$_"; Result += ClassName;
6579 Result += ",\n";
6581 Result += "\t(const struct _method_list_t *)&";
6582 Result += "_OBJC_$_CATEGORY_INSTANCE_METHODS_";
6583 Result += ClassName; Result += "_$_"; Result += CatName;
6584 Result += ",\n";
6587 Result += "\t0,\n";
6590 Result += "\t(const struct _method_list_t *)&";
6591 Result += "_OBJC_$_CATEGORY_CLASS_METHODS_";
6592 Result += ClassName; Result += "_$_"; Result += CatName;
6593 Result += ",\n";
6596 Result += "\t0,\n";
6599 Result += "\t(const struct _protocol_list_t *)&";
6600 Result += "_OBJC_CATEGORY_PROTOCOLS_$_";
6601 Result += ClassName; Result += "_$_"; Result += CatName;
6602 Result += ",\n";
6605 Result += "\t0,\n";
6608 Result += "\t(const struct _prop_list_t *)&"; Result += "_OBJC_$_PROP_LIST_";
6609 Result += ClassName; Result += "_$_"; Result += CatName;
6610 Result += ",\n";
6613 Result += "\t0,\n";
6615 Result += "};\n";
6618 Result += "static void OBJC_CATEGORY_SETUP_$_";
6619 Result += ClassDecl->getNameAsString();
6620 Result += "_$_";
6621 Result += CatName;
6622 Result += "(void ) {\n";
6623 Result += "\t_OBJC_$_CATEGORY_";
6624 Result += ClassDecl->getNameAsString();
6625 Result += "_$_";
6626 Result += CatName;
6627 Result += ".cls = "; Result += "&OBJC_CLASS_$_"; Result += ClassName;
6628 Result += ";\n}\n";
6632 ASTContext *Context, std::string &Result,
6639 Result += "\nstatic const char *";
6640 Result += VarName; Result += ProtocolName;
6641 Result += " [] __attribute__ ((used, section (\"__DATA,__objc_const\"))) = \n";
6642 Result += "{\n";
6648 Result += "\t\""; Result += QuoteMethodTypeString; Result += "\"";
6650 Result += "\n};\n";
6652 Result += ",\n";
6659 std::string &Result,
6673 Result += "\n";
6677 Result += "__declspec(allocate(\".objc_ivar$B\")) ";
6682 Result += "extern \"C\" unsigned long int ";
6684 Result += "extern \"C\" __declspec(dllexport) unsigned long int ";
6685 WriteInternalIvarName(CDecl, IvarDecl, Result);
6686 Result += " __attribute__ ((used, section (\"__DATA,__objc_ivar\")))";
6687 Result += " = ";
6688 RewriteObj.RewriteIvarOffsetComputation(IvarDecl, Result);
6689 Result += ";\n";
6694 ASTContext *Context, std::string &Result,
6699 Write_IvarOffsetVar(RewriteObj, Context, Result, Ivars, CDecl);
6701 Result += "\nstatic ";
6702 Write__ivar_list_t_TypeDecl(Result, Ivars.size());
6703 Result += " "; Result += VarName;
6704 Result += CDecl->getNameAsString();
6705 Result += " __attribute__ ((used, section (\"__DATA,__objc_const\"))) = {\n";
6706 Result += "\t"; Result += "sizeof(_ivar_t)"; Result += ",\n";
6707 Result += "\t"; Result += utostr(Ivars.size()); Result += ",\n";
6711 Result += "\t{{";
6713 Result += "\t {";
6714 Result += "(unsigned long int *)&";
6715 WriteInternalIvarName(CDecl, IvarDecl, Result);
6716 Result += ", ";
6718 Result += "\""; Result += IvarDecl->getName(); Result += "\", ";
6723 Result += "\""; Result += QuoteIvarTypeString; Result += "\", ";
6729 Result += llvm::utostr(Align); Result += ", ";
6731 Result += llvm::utostr(Size.getQuantity());
6733 Result += "}}\n";
6735 Result += "},\n";
6737 Result += "};\n";
6743 std::string &Result) {
6748 WriteModernMetadataDeclarations(Context, Result);
6756 RewriteObjCProtocolMetaData(*I, Result);
6792 Write__extendedMethodTypes_initializer(*this, Context, Result,
6802 Write_protocol_list_initializer(Context, Result, SuperProtocols,
6806 Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
6810 Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
6814 Write_method_list_t_initializer(*this, Context, Result, OptInstanceMethods,
6818 Write_method_list_t_initializer(*this, Context, Result, OptClassMethods,
6828 Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties,
6834 Result += "\n";
6836 Result += "static ";
6837 Result += "struct _protocol_t _OBJC_PROTOCOL_";
6838 Result += PDecl->getNameAsString();
6839 Result += " __attribute__ ((used, section (\"__DATA,__datacoal_nt,coalesced\"))) = {\n";
6840 Result += "\t0,\n"; // id is; is null
6841 Result += "\t\""; Result += PDecl->getNameAsString(); Result += "\",\n";
6843 Result += "\t(const struct _protocol_list_t *)&"; Result += "_OBJC_PROTOCOL_REFS_";
6844 Result += PDecl->getNameAsString(); Result += ",\n";
6847 Result += "\t0,\n";
6849 Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_INSTANCE_METHODS_";
6850 Result += PDecl->getNameAsString(); Result += ",\n";
6853 Result += "\t0,\n";
6856 Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_CLASS_METHODS_";
6857 Result += PDecl->getNameAsString(); Result += ",\n";
6860 Result += "\t0,\n";
6863 Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_OPT_INSTANCE_METHODS_";
6864 Result += PDecl->getNameAsString(); Result += ",\n";
6867 Result += "\t0,\n";
6870 Result += "\t(const struct method_list_t *)&_OBJC_PROTOCOL_OPT_CLASS_METHODS_";
6871 Result += PDecl->getNameAsString(); Result += ",\n";
6874 Result += "\t0,\n";
6877 Result += "\t(const struct _prop_list_t *)&_OBJC_PROTOCOL_PROPERTIES_";
6878 Result += PDecl->getNameAsString(); Result += ",\n";
6881 Result += "\t0,\n";
6883 Result += "\t"; Result += "sizeof(_protocol_t)"; Result += ",\n";
6884 Result += "\t0,\n";
6887 Result += "\t(const char **)&"; Result += "_OBJC_PROTOCOL_METHOD_TYPES_";
6888 Result += PDecl->getNameAsString();
6889 Result += "\n};\n";
6892 Result += "\t0\n};\n";
6895 Result += "static ";
6896 Result += "struct _protocol_t *";
6897 Result += "_OBJC_LABEL_PROTOCOL_$_"; Result += PDecl->getNameAsString();
6898 Result += " = &_OBJC_PROTOCOL_"; Result += PDecl->getNameAsString();
6899 Result += ";\n";
6910 std::string &Result) {
6914 RewriteObjCProtocolMetaData(Protocols[i], Result);
6923 Result += "\n";
6925 Result += "__declspec(allocate(\".cat_cls_meth$B\")) ";
6926 Result += "static struct {\n";
6927 Result += "\tstruct _objc_protocol_list *next;\n";
6928 Result += "\tint protocol_count;\n";
6929 Result += "\tstruct _objc_protocol *class_protocols[";
6930 Result += utostr(Protocols.size());
6931 Result += "];\n} _OBJC_";
6932 Result += prefix;
6933 Result += "_PROTOCOLS_";
6934 Result += ClassName;
6935 Result += " __attribute__ ((used, section (\"__OBJC, __cat_cls_meth\")))= "
6937 Result += utostr(Protocols.size());
6938 Result += "\n";
6940 Result += "\t,{&_OBJC_PROTOCOL_";
6941 Result += Protocols[0]->getNameAsString();
6942 Result += " \n";
6945 Result += "\t ,&_OBJC_PROTOCOL_";
6946 Result += Protocols[i]->getNameAsString();
6947 Result += "\n";
6949 Result += "\t }\n};\n";
6965 std::string &Result) {
6973 WriteModernMetadataDeclarations(Context, Result);
6984 Write__ivar_list_t_initializer(*this, Context, Result, IVars,
7014 Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
7021 Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
7035 RewriteObjCProtocolMetaData(*I, Result);
7038 Write_protocol_list_initializer(Context, Result,
7049 Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
7070 Write__class_ro_t_initializer(Context, Result, flags,
7110 Write__class_ro_t_initializer(Context, Result, flags,
7119 Write_class_t(Context, Result,
7123 Write_class_t(Context, Result,
7132 void RewriteModernObjC::RewriteClassSetupInitHook(std::string &Result) {
7136 Result += "#pragma section(\".objc_inithooks$B\", long, read, write)\n";
7137 Result += "__declspec(allocate(\".objc_inithooks$B\")) ";
7138 Result += "static void *OBJC_CLASS_SETUP[] = {\n";
7142 Result += "\t(void *)&OBJC_CLASS_SETUP_$_";
7143 Result += CDecl->getName(); Result += ",\n";
7145 Result += "};\n";
7148 void RewriteModernObjC::RewriteMetaDataIntoBuffer(std::string &Result) {
7154 RewriteObjCClassMetaData(ClassImplementation[i], Result);
7156 RewriteClassSetupInitHook(Result);
7160 RewriteObjCCategoryImplDecl(CategoryImplementation[i], Result);
7162 RewriteCategorySetupInitHook(Result);
7166 Result += "__declspec(allocate(\".objc_classlist$B\")) ";
7167 Result += "static struct _class_t *L_OBJC_LABEL_CLASS_$ [";
7168 Result += llvm::utostr(ClsDefCount); Result += "]";
7169 Result +=
7173 Result += "\t&OBJC_CLASS_$_";
7174 Result += ClassImplementation[i]->getNameAsString();
7175 Result += ",\n";
7177 Result += "};\n";
7181 Result += "__declspec(allocate(\".objc_nlclslist$B\")) \n";
7182 Result += "static struct _class_t *_OBJC_LABEL_NONLAZY_CLASS_$[] = {\n\t";
7184 Result += "\t&OBJC_CLASS_$_"; Result += DefinedNonLazyClasses[i]->getNameAsString();
7185 Result += ",\n";
7187 Result += "};\n";
7193 Result += "__declspec(allocate(\".objc_catlist$B\")) ";
7194 Result += "static struct _category_t *L_OBJC_LABEL_CATEGORY_$ [";
7195 Result += llvm::utostr(CatDefCount); Result += "]";
7196 Result +=
7200 Result += "\t&_OBJC_$_CATEGORY_";
7201 Result +=
7203 Result += "_$_";
7204 Result += CategoryImplementation[i]->getNameAsString();
7205 Result += ",\n";
7207 Result += "};\n";
7212 Result += "__declspec(allocate(\".objc_nlcatlist$B\")) \n";
7213 Result += "static struct _category_t *_OBJC_LABEL_NONLAZY_CATEGORY_$[] = {\n\t";
7215 Result += "\t&_OBJC_$_CATEGORY_";
7216 Result +=
7218 Result += "_$_";
7219 Result += DefinedNonLazyCategories[i]->getNameAsString();
7220 Result += ",\n";
7222 Result += "};\n";
7226 void RewriteModernObjC::WriteImageInfo(std::string &Result) {
7228 Result += "__declspec(allocate(\".objc_imageinfo$B\")) \n";
7230 Result += "static struct IMAGE_INFO { unsigned version; unsigned flag; } ";
7232 Result += "_OBJC_IMAGE_INFO = { 0, 2 };\n";
7238 std::string &Result) {
7239 WriteModernMetadataDeclarations(Context, Result);
7276 Write_method_list_t_initializer(*this, Context, Result, InstanceMethods,
7283 Write_method_list_t_initializer(*this, Context, Result, ClassMethods,
7297 RewriteObjCProtocolMetaData(*I, Result);
7300 Write_protocol_list_initializer(Context, Result,
7311 Write_prop_list_t_initializer(*this, Context, Result, ClassProperties,
7316 Write_category_t(*this, Context, Result,
7330 void RewriteModernObjC::RewriteCategorySetupInitHook(std::string &Result) {
7334 Result += "#pragma section(\".objc_inithooks$B\", long, read, write)\n";
7335 Result += "__declspec(allocate(\".objc_inithooks$B\")) ";
7336 Result += "static void *OBJC_CATEGORY_SETUP[] = {\n";
7341 Result += "\t(void *)&OBJC_CATEGORY_SETUP_$_";
7342 Result += ClassDecl->getName();
7343 Result += "_$_";
7344 Result += CatDecl->getName();
7345 Result += ",\n";
7347 Result += "};\n";
7358 std::string &Result) {
7368 Result += "\nstruct _objc_method {\n";
7369 Result += "\tSEL _cmd;\n";
7370 Result += "\tchar *method_types;\n";
7371 Result += "\tvoid *_imp;\n";
7372 Result += "};\n";
7386 Result += "\n";
7389 Result += "__declspec(allocate(\".inst_meth$B\")) ";
7391 Result += "__declspec(allocate(\".cls_meth$B\")) ";
7393 Result += "static struct {\n";
7394 Result += "\tstruct _objc_method_list *next_method;\n";
7395 Result += "\tint method_count;\n";
7396 Result += "\tstruct _objc_method method_list[";
7397 Result += utostr(NumMethods);
7398 Result += "];\n} _OBJC_";
7399 Result += prefix;
7400 Result += IsInstanceMethod ? "INSTANCE" : "CLASS";
7401 Result += "_METHODS_";
7402 Result += ClassName;
7403 Result += " __attribute__ ((used, section (\"__OBJC, __";
7404 Result += IsInstanceMethod ? "inst" : "cls";
7405 Result += "_meth\")))= ";
7406 Result += "{\n\t0, " + utostr(NumMethods) + "\n";
7408 Result += "\t,{{(SEL)\"";
7409 Result += (*MethodBegin)->getSelector().getAsString().c_str();
7412 Result += "\", \"";
7413 Result += MethodTypeString;
7414 Result += "\", (void *)";
7415 Result += MethodInternalNames[*MethodBegin];
7416 Result += "}\n";
7418 Result += "\t ,{(SEL)\"";
7419 Result += (*MethodBegin)->getSelector().getAsString().c_str();
7422 Result += "\", \"";
7423 Result += MethodTypeString;
7424 Result += "\", (void *)";
7425 Result += MethodInternalNames[*MethodBegin];
7426 Result += "}\n";
7428 Result += "\t }\n};\n";