aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-07-25 21:48:36 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-07-25 21:48:36 +0000
commit2ca5af239af48ed5c6af62ae03cd39c246af06db (patch)
treeabb582b1c1064b4fe0af567cfbee9a7fdfc3a38a
parent5292718007095d59ee9c4bca554a386674aa7045 (diff)
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
-rw-r--r--lib/Rewrite/RewriteModernObjC.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Rewrite/RewriteModernObjC.cpp b/lib/Rewrite/RewriteModernObjC.cpp
index 256984d881..9f42fcacfa 100644
--- a/lib/Rewrite/RewriteModernObjC.cpp
+++ b/lib/Rewrite/RewriteModernObjC.cpp
@@ -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";