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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160759 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index 256984d..9f42fca 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -3103,7 +3103,9 @@
   // 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 @@
     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";