[cfe-commits] r121441 - in /cfe/trunk: include/clang/Basic/Builtins.def test/SemaObjC/builtin_objc_getClass.m test/SemaObjC/builtin_objc_lib_functions.m

Fariborz Jahanian fjahanian at apple.com
Thu Dec 9 16:39:16 PST 2010


Author: fjahanian
Date: Thu Dec  9 18:39:16 2010
New Revision: 121441

URL: http://llvm.org/viewvc/llvm-project?rev=121441&view=rev
Log:
Added remaining objective-c library builtins (as in gcc) to
clang. // rdar://8735023

Added:
    cfe/trunk/test/SemaObjC/builtin_objc_lib_functions.m
      - copied, changed from r121375, cfe/trunk/test/SemaObjC/builtin_objc_getClass.m
Removed:
    cfe/trunk/test/SemaObjC/builtin_objc_getClass.m
Modified:
    cfe/trunk/include/clang/Basic/Builtins.def

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=121441&r1=121440&r2=121441&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Thu Dec  9 18:39:16 2010
@@ -569,8 +569,50 @@
 LIBBUILTIN(siglongjmp, "vSJi",    "fr",    "setjmp.h", ALL_LANGUAGES)
 //   id objc_msgSend(id, SEL, ...)
 LIBBUILTIN(objc_msgSend, "GGH.",   "f",     "objc/message.h", OBJC_LANG)
+
+// long double objc_msgSend_fpret(id self, SEL op, ...) 
+LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG)
+// id objc_msgSend_stret (id, SEL, ...)
+LIBBUILTIN(objc_msgSend_stret, "GGH.", "f", "objc/message.h", OBJC_LANG)
+// id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
+LIBBUILTIN(objc_msgSendSuper, "Gv*H.", "f", "objc/message.h", OBJC_LANG)
+// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
+LIBBUILTIN(objc_msgSendSuper_stret, "vv*H.", "f", "objc/message.h", OBJC_LANG)
 //   id objc_getClass(const char *name)
 LIBBUILTIN(objc_getClass, "GcC*",   "f",     "objc/runtime.h", OBJC_LANG)
+//   id objc_getMetaClass(const char *name)
+LIBBUILTIN(objc_getMetaClass, "GcC*",   "f", "objc/runtime.h", OBJC_LANG)
+// void objc_enumerationMutation(id)
+LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG)
+
+// id objc_read_weak(id *location)
+LIBBUILTIN(objc_read_weak, "GG*", "f", "/objc/objc-auto.h", OBJC_LANG)
+// id objc_assign_weak(id value, id *location)
+LIBBUILTIN(objc_assign_weak, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG)
+// id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
+// FIXME. Darwin has ptrdiff_t typedef'ed to int.
+LIBBUILTIN(objc_assign_ivar, "GGGi", "f", "/objc/objc-auto.h", OBJC_LANG)
+// id objc_assign_global(id val, id *dest)
+LIBBUILTIN(objc_assign_global, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG)
+// id objc_assign_strongCast(id val, id *dest
+LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "/objc/objc-auto.h", OBJC_LANG)
+
+// id objc_exception_extract(void *localExceptionData)
+LIBBUILTIN(objc_exception_extract, "Gv*", "f", "/objc/objc-exception.h", OBJC_LANG)
+// void objc_exception_try_enter(void *localExceptionData)
+LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "/objc/objc-exception.h", OBJC_LANG)
+// void objc_exception_try_exit(void *localExceptionData)
+LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "/objc/objc-exception.h", OBJC_LANG)
+// int objc_exception_match(Class exceptionClass, id exception)
+LIBBUILTIN(objc_exception_match, "iGG", "f", "/objc/objc-exception.h", OBJC_LANG)
+// void objc_exception_throw(id exception)
+LIBBUILTIN(objc_exception_throw, "vG", "f", "/objc/objc-exception.h", OBJC_LANG)
+
+// int objc_sync_enter(id obj)
+LIBBUILTIN(objc_sync_enter, "iG", "f", "/objc/objc-sync.h", OBJC_LANG)
+// int objc_sync_exit(id obj)
+LIBBUILTIN(objc_sync_exit, "iG", "f", "/objc/objc-sync.h", OBJC_LANG)
+
 BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
 
 // Builtin math library functions

Removed: cfe/trunk/test/SemaObjC/builtin_objc_getClass.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/builtin_objc_getClass.m?rev=121440&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/builtin_objc_getClass.m (original)
+++ cfe/trunk/test/SemaObjC/builtin_objc_getClass.m (removed)
@@ -1,4 +0,0 @@
-// RUN: %clang_cc1 %s -fsyntax-only -std=gnu99 -verify
-// rdar://8592641
-Class f0() { return objc_getClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getClass' with type 'id (const char *)'}} \
-					  // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getClass'}}

Copied: cfe/trunk/test/SemaObjC/builtin_objc_lib_functions.m (from r121375, cfe/trunk/test/SemaObjC/builtin_objc_getClass.m)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/builtin_objc_lib_functions.m?p2=cfe/trunk/test/SemaObjC/builtin_objc_lib_functions.m&p1=cfe/trunk/test/SemaObjC/builtin_objc_getClass.m&r1=121375&r2=121441&rev=121441&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/builtin_objc_getClass.m (original)
+++ cfe/trunk/test/SemaObjC/builtin_objc_lib_functions.m Thu Dec  9 18:39:16 2010
@@ -1,4 +1,29 @@
-// RUN: %clang_cc1 %s -fsyntax-only -std=gnu99 -verify
+// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify
 // rdar://8592641
 Class f0() { return objc_getClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getClass' with type 'id (const char *)'}} \
 					  // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getClass'}}
+
+// rdar://8735023
+Class f1() { return objc_getMetaClass("a"); } // expected-warning {{implicitly declaring C library function 'objc_getMetaClass' with type 'id (const char *)'}} \
+					  // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getMetaClass'}}
+
+void f2(id val) { objc_enumerationMutation(val); } // expected-warning {{implicitly declaring C library function 'objc_enumerationMutation' with type 'void (id)'}} \
+						   // expected-note {{please include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_enumerationMutation'}}
+
+long double f3(id self, SEL op) { return objc_msgSend_fpret(self, op); } // expected-warning {{implicitly declaring C library function 'objc_msgSend_fpret' with type 'long double (id, SEL, ...)'}} \
+    // expected-note {{please include the header <objc/message.h> or explicitly provide a declaration for 'objc_msgSend_fpret'}}
+
+id f4(struct objc_super *super, SEL op) { // expected-warning {{declaration of 'struct objc_super' will not be visible outside of this function}}
+  return objc_msgSendSuper(super, op); // expected-warning {{implicitly declaring C library function 'objc_msgSendSuper' with type 'id (void *, SEL, ...)'}} \
+					// expected-note {{please include the header <objc/message.h> or explicitly provide a declaration for 'objc_msgSendSuper'}}
+}
+
+id f5(id val, id *dest) {
+  return objc_assign_strongCast(val, dest); // expected-warning {{implicitly declaring C library function 'objc_assign_strongCast' with type 'id (id, id *)'}} \
+					    // expected-note {{please include the header </objc/objc-auto.h> or explicitly provide a declaration for 'objc_assign_strongCast'}}
+}
+
+int f6(Class exceptionClass, id exception) {
+  return objc_exception_match(exceptionClass, exception); // expected-warning {{implicitly declaring C library function 'objc_exception_match' with type 'int (id, id)'}} \
+  							  // expected-note {{please include the header </objc/objc-exception.h> or explicitly provide a declaration for 'objc_exception_match'}}
+}





More information about the cfe-commits mailing list