]> granicus.if.org Git - clang/commitdiff
Add implicit definition of objc_msgSend.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 23 Apr 2009 07:00:09 +0000 (07:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 23 Apr 2009 07:00:09 +0000 (07:00 +0000)
 - As with malloc and friends, this is important where the return type
   on a 64-bit platform would otherwise end up discarding the upper
   32-bits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69874 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Builtins.def
test/CodeGenObjC/implicit-objc_msgSend.m [new file with mode: 0644]

index 766cb1143dd08a948a118dfe94845907fa19b104..ca1a9d04b1faec995f2f92c9b0ab908acb70e9f4 100644 (file)
@@ -249,6 +249,11 @@ LIBBUILTIN(vfprintf, "iP*cC*a",   "fP:1:", "stdio.h")
 LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h")
 LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h")
 
+// FIXME: This type isn't very correct, it should be
+//   id objc_msgSend(id, SEL)
+// but we need new type letters for that.
+LIBBUILTIN(objc_msgSend, "v*.",   "f",     "objc/message.h")
+
 // FIXME: asprintf and vasprintf aren't C99 functions. Should they be
 // target-specific builtins, perhaps? 
 
diff --git a/test/CodeGenObjC/implicit-objc_msgSend.m b/test/CodeGenObjC/implicit-objc_msgSend.m
new file mode 100644 (file)
index 0000000..4511cca
--- /dev/null
@@ -0,0 +1,7 @@
+// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s &&
+// RUN: grep -F 'declare i8* @objc_msgSend(...)' %t
+
+typedef struct objc_selector *SEL;
+id f0(id x, SEL s) {
+  return objc_msgSend(x, s);
+}