llvm::Constant *GetMethodConstant(const ObjCMethodDecl *MD);
+ llvm::Constant *GetMethodDescriptionConstant(const ObjCMethodDecl *MD);
+
/// EmitMethodList - Emit the method list for the given
/// implementation. The return value has type MethodListnfABITy.
llvm::Constant *EmitMethodList(const std::string &Name,
for (ObjCProtocolDecl::instmeth_iterator i = PD->instmeth_begin(),
e = PD->instmeth_end(); i != e; ++i) {
ObjCMethodDecl *MD = *i;
- llvm::Constant *C = GetMethodConstant(MD);
+ llvm::Constant *C = GetMethodDescriptionConstant(MD);
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
OptInstanceMethods.push_back(C);
} else {
for (ObjCProtocolDecl::classmeth_iterator i = PD->classmeth_begin(),
e = PD->classmeth_end(); i != e; ++i) {
ObjCMethodDecl *MD = *i;
- llvm::Constant *C = GetMethodConstant(MD);
+ llvm::Constant *C = GetMethodDescriptionConstant(MD);
if (MD->getImplementationControl() == ObjCMethodDecl::Optional) {
OptClassMethods.push_back(C);
} else {
PD->protocol_begin(),
PD->protocol_end());
- Values[3] = EmitMethodList("\01l_OBJC_$_INSTANCE_METHODS_"
+ Values[3] = EmitMethodList("\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_"
+ PD->getNameAsString(),
"__DATA, __objc_const",
InstanceMethods);
- Values[4] = EmitMethodList("\01l_OBJC_$_CLASS_METHODS_"
+ Values[4] = EmitMethodList("\01l_OBJC_$_PROTOCOL_CLASS_METHODS_"
+ PD->getNameAsString(),
"__DATA, __objc_const",
ClassMethods);
- Values[5] = EmitMethodList("\01l_OBJC_$_INSTANCE_METHODS_OPT_"
+ Values[5] = EmitMethodList("\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_"
+ PD->getNameAsString(),
"__DATA, __objc_const",
OptInstanceMethods);
- Values[6] = EmitMethodList("\01l_OBJC_$_CLASS_METHODS_OPT_"
+ Values[6] = EmitMethodList("\01l_OBJC_$_PROTOCOL_CLASS_METHODS_OPT_"
+ PD->getNameAsString(),
"__DATA, __objc_const",
OptClassMethods);
return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListnfABIPtrTy);
}
+/// GetMethodDescriptionConstant - This routine build following meta-data:
+/// struct _objc_method {
+/// SEL _cmd;
+/// char *method_type;
+/// char *_imp;
+/// }
+
+llvm::Constant *
+CGObjCNonFragileABIMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) {
+ std::vector<llvm::Constant*> Desc(3);
+ Desc[0] = llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()),
+ ObjCTypes.SelectorPtrTy);
+ Desc[1] = GetMethodVarType(MD);
+ // FIXME. This is really always NULL?
+ Desc[2] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy);
+ return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Desc);
+}
/* *** */
CodeGen::CGObjCRuntime *