objective-c modern translator. Provide declaration of

"memset' lazily when is needed in translation of
struct-valued methods which require checkinf of nil receivers
outside their bodies. // rdar://11847319

llvm-svn: 160759
This commit is contained in:
Fariborz Jahanian 2012-07-25 21:48:36 +00:00
parent abd254e1b6
commit 1a11252f60
1 changed files with 3 additions and 6 deletions

View File

@ -3103,7 +3103,9 @@ Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFla
// build type for containing the objc_msgSend_stret object.
static unsigned stretCount=0;
std::string name = "__Stret"; name += utostr(stretCount);
std::string str = "struct "; str += name;
std::string str =
"extern \"C\" void * __cdecl memset(void *_Dst, int _Val, size_t _Size);\n";
str += "struct "; str += name;
str += " {\n\t";
str += name;
str += "(id receiver, SEL sel";
@ -5959,11 +5961,6 @@ void RewriteModernObjC::Initialize(ASTContext &context) {
Preamble += "#define __block\n";
Preamble += "#define __weak\n";
}
Preamble += "\n#if defined(_MSC_VER)\n";
Preamble += "#include <string.h>\n";
Preamble += "#else\n";
Preamble += "extern \"C\" void * memset(void *b, int c, unsigned long len);\n";
Preamble += "#endif\n";
// Declarations required for modern objective-c array and dictionary literals.
Preamble += "\n#include <stdarg.h>\n";