]> granicus.if.org Git - clang/commitdiff
Provide a precise builtin declaration for objc_msgSend
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 8 Nov 2010 22:53:18 +0000 (22:53 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 8 Nov 2010 22:53:18 +0000 (22:53 +0000)
to avoid a bogus warning. Fixes //rdar: //8632525

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

include/clang/Basic/Builtins.def
lib/AST/ASTContext.cpp
test/CodeGenObjC/implicit-objc_msgSend.m
test/SemaObjC/builtin_objc_msgSend.m [new file with mode: 0644]

index eca73774f0c981d1243193b1be12f1b043afead1..28a507840986a2f46c8d8ef0d334aa7716d1ee15 100644 (file)
@@ -29,6 +29,8 @@
 //  d -> double
 //  z -> size_t
 //  F -> constant CFString
+//  G -> id
+//  H -> SEL
 //  a -> __builtin_va_list
 //  A -> "reference" to __builtin_va_list
 //  V -> Vector, following num elements and a base type.
@@ -559,11 +561,8 @@ LIBBUILTIN(_exit, "vi",           "fr",    "unistd.h")
 // POSIX setjmp.h
 LIBBUILTIN(_longjmp, "vJi",       "fr",    "setjmp.h")
 LIBBUILTIN(siglongjmp, "vSJi",    "fr",    "setjmp.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")
+LIBBUILTIN(objc_msgSend, "GGH.",   "f",     "objc/message.h")
 BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
 
 // Builtin math library functions
index b2451a2d867d10757c949625e671144d3e6fbf66..26e53ca57a697ee0bbde6c1c09691c27f787274e 100644 (file)
@@ -5384,6 +5384,12 @@ static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
   case 'F':
     Type = Context.getCFConstantStringType();
     break;
+  case 'G':
+    Type = Context.getObjCIdType();
+    break;
+  case 'H':
+    Type = Context.getObjCSelType();
+    break;
   case 'a':
     Type = Context.getBuiltinVaListType();
     assert(!Type.isNull() && "builtin va list type not initialized!");
index a21e869229a78ae06b4addb35c6199901d818808..322f82e920a0c0c75dd6a84ac7479676a13bd364 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -o %t %s
-// RUN: grep -F 'declare i8* @objc_msgSend(...)' %t
+// RUN: grep -F 'declare i8* @objc_msgSend(i8*, i8*, ...)' %t
 
 typedef struct objc_selector *SEL;
 id f0(id x, SEL s) {
diff --git a/test/SemaObjC/builtin_objc_msgSend.m b/test/SemaObjC/builtin_objc_msgSend.m
new file mode 100644 (file)
index 0000000..7530d90
--- /dev/null
@@ -0,0 +1,3 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar: // 8632525
+extern id objc_msgSend(id self, SEL op, ...);