From d7e40f02af203e44a46c95276b3e260bf20cf18f Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 30 Nov 2010 18:25:34 +0000 Subject: [PATCH] Add objc_getClass as an objc builtin function (// rdar://8592641). Also rename LANGUAGEID to LanguageID. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120437 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Builtins.def | 2 ++ include/clang/Basic/Builtins.h | 4 ++-- test/SemaObjC/builtin_objc_getClass.m | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/SemaObjC/builtin_objc_getClass.m diff --git a/include/clang/Basic/Builtins.def b/include/clang/Basic/Builtins.def index 527244719c..f3e8b2b9f2 100644 --- a/include/clang/Basic/Builtins.def +++ b/include/clang/Basic/Builtins.def @@ -569,6 +569,8 @@ LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_LANGUAGES) // id objc_msgSend(id, SEL, ...) LIBBUILTIN(objc_msgSend, "GGH.", "f", "objc/message.h", OBJC_LANG) +// id objc_getClass(const char *name) +LIBBUILTIN(objc_getClass, "GcC*", "f", "objc/runtime.h", OBJC_LANG) BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF") // Builtin math library functions diff --git a/include/clang/Basic/Builtins.h b/include/clang/Basic/Builtins.h index eb26042052..76f21c842b 100644 --- a/include/clang/Basic/Builtins.h +++ b/include/clang/Basic/Builtins.h @@ -32,7 +32,7 @@ namespace clang { class QualType; class LangOptions; - enum LANGUAGEID { + enum LanguageID { C_LANG = 0x1, // builtin for c only. CXX_LANG = 0x2, // builtin for cplusplus only. OBJC_LANG = 0x4, // builtin for objective-c and objective-c++ @@ -49,7 +49,7 @@ enum ID { struct Info { const char *Name, *Type, *Attributes, *HeaderName; - LANGUAGEID builtin_lang; + LanguageID builtin_lang; bool Suppressed; bool operator==(const Info &RHS) const { diff --git a/test/SemaObjC/builtin_objc_getClass.m b/test/SemaObjC/builtin_objc_getClass.m new file mode 100644 index 0000000000..de4713b270 --- /dev/null +++ b/test/SemaObjC/builtin_objc_getClass.m @@ -0,0 +1,4 @@ +// 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 or explicitly provide a declaration for 'objc_getClass'}} -- 2.40.0