зеркало из https://github.com/microsoft/clang-1.git
IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82117 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d3a932a298
Коммит
d6c93d7035
|
@ -92,8 +92,10 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
|
|||
isCategoryImpl,
|
||||
Receiver,
|
||||
isClassMessage,
|
||||
Args);
|
||||
Args,
|
||||
E->getMethodDecl());
|
||||
}
|
||||
|
||||
return Runtime.GenerateMessageSend(*this, E->getType(), E->getSelector(),
|
||||
Receiver, isClassMessage, Args,
|
||||
E->getMethodDecl());
|
||||
|
|
|
@ -139,7 +139,8 @@ public:
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs);
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method);
|
||||
virtual llvm::Value *GetClass(CGBuilderTy &Builder,
|
||||
const ObjCInterfaceDecl *OID);
|
||||
virtual llvm::Value *GetSelector(CGBuilderTy &Builder, Selector Sel);
|
||||
|
@ -364,7 +365,8 @@ CGObjCGNU::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs) {
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method) {
|
||||
llvm::Value *cmd = GetSelector(CGF.Builder, Sel);
|
||||
|
||||
CallArgList ActualArgs;
|
||||
|
@ -1530,7 +1532,7 @@ llvm::Function *CGObjCGNU::GenerateMethod(const ObjCMethodDecl *OMD,
|
|||
std::string FunctionName = SymbolNameForMethod(ClassName, CategoryName,
|
||||
MethodName, isClassMethod);
|
||||
|
||||
llvm::Function *Method
|
||||
llvm::Function *Method
|
||||
= llvm::Function::Create(MethodTy,
|
||||
llvm::GlobalValue::InternalLinkage,
|
||||
FunctionName,
|
||||
|
|
|
@ -934,6 +934,7 @@ protected:
|
|||
QualType Arg0Ty,
|
||||
bool IsSuper,
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *OMD,
|
||||
const ObjCCommonTypesHelper &ObjCTypes);
|
||||
|
||||
public:
|
||||
|
@ -1091,7 +1092,8 @@ public:
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs);
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method);
|
||||
|
||||
virtual llvm::Value *GetClass(CGBuilderTy &Builder,
|
||||
const ObjCInterfaceDecl *ID);
|
||||
|
@ -1313,7 +1315,8 @@ public:
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs);
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method);
|
||||
|
||||
virtual llvm::Value *GetClass(CGBuilderTy &Builder,
|
||||
const ObjCInterfaceDecl *ID);
|
||||
|
@ -1447,7 +1450,8 @@ CGObjCMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CodeGen::CallArgList &CallArgs) {
|
||||
const CodeGen::CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method) {
|
||||
// Create and init a super structure; this is a (receiver, class)
|
||||
// pair we will pass to objc_msgSendSuper.
|
||||
llvm::Value *ObjCSuper =
|
||||
|
@ -1489,7 +1493,7 @@ CGObjCMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
|
|||
return EmitLegacyMessageSend(CGF, ResultType,
|
||||
EmitSelector(CGF.Builder, Sel),
|
||||
ObjCSuper, ObjCTypes.SuperPtrCTy,
|
||||
true, CallArgs, ObjCTypes);
|
||||
true, CallArgs, Method, ObjCTypes);
|
||||
}
|
||||
|
||||
/// Generate code for a message send expression.
|
||||
|
@ -1503,18 +1507,19 @@ CodeGen::RValue CGObjCMac::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
|
|||
return EmitLegacyMessageSend(CGF, ResultType,
|
||||
EmitSelector(CGF.Builder, Sel),
|
||||
Receiver, CGF.getContext().getObjCIdType(),
|
||||
false, CallArgs, ObjCTypes);
|
||||
false, CallArgs, Method, ObjCTypes);
|
||||
}
|
||||
|
||||
CodeGen::RValue CGObjCCommonMac::EmitLegacyMessageSend(
|
||||
CodeGen::CodeGenFunction &CGF,
|
||||
QualType ResultType,
|
||||
llvm::Value *Sel,
|
||||
llvm::Value *Arg0,
|
||||
QualType Arg0Ty,
|
||||
bool IsSuper,
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCCommonTypesHelper &ObjCTypes) {
|
||||
CodeGen::RValue
|
||||
CGObjCCommonMac::EmitLegacyMessageSend(CodeGen::CodeGenFunction &CGF,
|
||||
QualType ResultType,
|
||||
llvm::Value *Sel,
|
||||
llvm::Value *Arg0,
|
||||
QualType Arg0Ty,
|
||||
bool IsSuper,
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method,
|
||||
const ObjCCommonTypesHelper &ObjCTypes) {
|
||||
CallArgList ActualArgs;
|
||||
if (!IsSuper)
|
||||
Arg0 = CGF.Builder.CreateBitCast(Arg0, ObjCTypes.ObjectPtrTy, "tmp");
|
||||
|
@ -5080,18 +5085,18 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend(
|
|||
}
|
||||
|
||||
/// Generate code for a message send expression in the nonfragile abi.
|
||||
CodeGen::RValue CGObjCNonFragileABIMac::GenerateMessageSend(
|
||||
CodeGen::CodeGenFunction &CGF,
|
||||
QualType ResultType,
|
||||
Selector Sel,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method) {
|
||||
CodeGen::RValue
|
||||
CGObjCNonFragileABIMac::GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
|
||||
QualType ResultType,
|
||||
Selector Sel,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method) {
|
||||
return LegacyDispatchedSelector(Sel)
|
||||
? EmitLegacyMessageSend(CGF, ResultType, EmitSelector(CGF.Builder, Sel),
|
||||
Receiver, CGF.getContext().getObjCIdType(),
|
||||
false, CallArgs, ObjCTypes)
|
||||
false, CallArgs, Method, ObjCTypes)
|
||||
: EmitMessageSend(CGF, ResultType, Sel,
|
||||
Receiver, CGF.getContext().getObjCIdType(),
|
||||
false, CallArgs);
|
||||
|
@ -5199,7 +5204,8 @@ CGObjCNonFragileABIMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CodeGen::CallArgList &CallArgs) {
|
||||
const CodeGen::CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method) {
|
||||
// ...
|
||||
// Create and init a super structure; this is a (receiver, class)
|
||||
// pair we will pass to objc_msgSendSuper.
|
||||
|
@ -5236,8 +5242,7 @@ CGObjCNonFragileABIMac::GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
|
|||
return (LegacyDispatchedSelector(Sel))
|
||||
? EmitLegacyMessageSend(CGF, ResultType,EmitSelector(CGF.Builder, Sel),
|
||||
ObjCSuper, ObjCTypes.SuperPtrCTy,
|
||||
true, CallArgs,
|
||||
ObjCTypes)
|
||||
true, CallArgs, Method, ObjCTypes)
|
||||
: EmitMessageSend(CGF, ResultType, Sel,
|
||||
ObjCSuper, ObjCTypes.SuperPtrCTy,
|
||||
true, CallArgs);
|
||||
|
|
|
@ -116,6 +116,9 @@ public:
|
|||
virtual void GenerateClass(const ObjCImplementationDecl *OID) = 0;
|
||||
|
||||
/// Generate an Objective-C message send operation.
|
||||
///
|
||||
/// \param Method - The method being called, this may be null if synthesizing
|
||||
/// a property setter or getter.
|
||||
virtual CodeGen::RValue
|
||||
GenerateMessageSend(CodeGen::CodeGenFunction &CGF,
|
||||
QualType ResultType,
|
||||
|
@ -123,11 +126,14 @@ public:
|
|||
llvm::Value *Receiver,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method=0) = 0;
|
||||
const ObjCMethodDecl *Method = 0) = 0;
|
||||
|
||||
/// Generate an Objective-C message send operation to the super
|
||||
/// class initiated in a method for Class and with the given Self
|
||||
/// object.
|
||||
///
|
||||
/// \param Method - The method being called, this may be null if synthesizing
|
||||
/// a property setter or getter.
|
||||
virtual CodeGen::RValue
|
||||
GenerateMessageSendSuper(CodeGen::CodeGenFunction &CGF,
|
||||
QualType ResultType,
|
||||
|
@ -136,7 +142,8 @@ public:
|
|||
bool isCategoryImpl,
|
||||
llvm::Value *Self,
|
||||
bool IsClassMessage,
|
||||
const CallArgList &CallArgs) = 0;
|
||||
const CallArgList &CallArgs,
|
||||
const ObjCMethodDecl *Method = 0) = 0;
|
||||
|
||||
/// Emit the code to return the named protocol as an object, as in a
|
||||
/// @protocol expression.
|
||||
|
|
Загрузка…
Ссылка в новой задаче