diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 47bbd8827d483c43dd2043c15b06efec2d984163..ce49cb20d3567996a27e70d7d00d55b73706baeb 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -490,14 +490,9 @@ Value *ScalarExprEmitter::VisitObjCMessageExpr(ObjCMessageExpr *E) { } } - // Get the selector string - std::string SelStr = E->getSelector().getName(); - llvm::Constant *Selector = CGF.CGM.GetAddrOfConstantString(SelStr); - - llvm::Value *SelPtr = Builder.CreateStructGEP(Selector, 0); return Runtime->GenerateMessageSend(Builder, ConvertType(E->getType()), CGF.LoadObjCSelf(), - Receiver, SelPtr, + Receiver, E->getSelector(), &Args[0], Args.size()); } diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index e9d20640b7829298d6fca484e0957bcd81415f34..9bf53d9700d822fc3d4a91cdb0fe724ba89f40a1 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -86,14 +86,9 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) { } } - // Get the selector string - std::string SelStr = E->getSelector().getName(); - llvm::Constant *Selector = CGM.GetAddrOfConstantString(SelStr); - - llvm::Value *SelPtr = Builder.CreateStructGEP(Selector, 0); if (isSuperMessage) { - const ObjCMethodDecl *OMD = dyn_cast(CurFuncDecl); - assert(OMD && "super is only valid in an Objective-C method"); + // super is only valid in an Objective-C method + const ObjCMethodDecl *OMD = cast(CurFuncDecl); const char *SuperClass = OMD->getClassInterface()->getSuperClass()->getName(); return Runtime->GenerateMessageSendSuper(Builder, ConvertType(E->getType()), @@ -103,7 +98,7 @@ llvm::Value *CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) { } return Runtime->GenerateMessageSend(Builder, ConvertType(E->getType()), LoadObjCSelf(), - Receiver, SelPtr, + Receiver, E->getSelector(), &Args[0], Args.size()); } diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 565167dc6f548d7b2e6a9b5bbe87659f4ce69809..5fe182019f4de97d2b84c4ec57f1a084a9a3cd02 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -105,7 +105,7 @@ public: const llvm::Type *ReturnTy, llvm::Value *Sender, llvm::Value *Receiver, - llvm::Value *Selector, + Selector Sel, llvm::Value** ArgV, unsigned ArgC); virtual llvm::Value *GenerateMessageSendSuper(llvm::IRBuilder &Builder, @@ -116,8 +116,8 @@ public: Selector Sel, llvm::Value** ArgV, unsigned ArgC); - virtual llvm::Value *LookupClass(llvm::IRBuilder &Builder, llvm::Value - *ClassName); + virtual llvm::Value *LookupClass(llvm::IRBuilder &Builder, + llvm::Value *ClassName); virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, Selector Sel); virtual llvm::Value *GetSelector(llvm::IRBuilder &Builder, llvm::Value *SelName, @@ -385,10 +385,10 @@ llvm::Value *CGObjCGNU::GenerateMessageSend(llvm::IRBuilder &Builder, const llvm::Type *ReturnTy, llvm::Value *Sender, llvm::Value *Receiver, - llvm::Value *Selector, + Selector Sel, llvm::Value** ArgV, unsigned ArgC) { - llvm::Value *cmd = GetSelector(Builder, Selector, 0); + llvm::Value *cmd = GetSelector(Builder, Sel); // Look up the method implementation. std::vector impArgTypes; diff --git a/clang/lib/CodeGen/CGObjCRuntime.h b/clang/lib/CodeGen/CGObjCRuntime.h index 07d89620965dd3bcb9b02108bc1a200dc5a1d631..f9b029736deed02bd7970ed21f4245f4d2807189 100644 --- a/clang/lib/CodeGen/CGObjCRuntime.h +++ b/clang/lib/CodeGen/CGObjCRuntime.h @@ -46,7 +46,7 @@ public: const llvm::Type *ReturnTy, llvm::Value *Sender, llvm::Value *Receiver, - llvm::Value *Selector, + Selector Sel, llvm::Value** ArgV, unsigned ArgC) =0; /// Generate the function required to register all Objective-C components in