[cfe-commits] r119813 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/builtin_objc_msgSend.cpp

Fariborz Jahanian fjahanian at apple.com
Fri Nov 19 10:16:46 PST 2010


Author: fjahanian
Date: Fri Nov 19 12:16:46 2010
New Revision: 119813

URL: http://llvm.org/viewvc/llvm-project?rev=119813&view=rev
Log:
objc_msgSend is not a builtin type in non-objc mode.
Fixes //rdar://8686888

Added:
    cfe/trunk/test/SemaCXX/builtin_objc_msgSend.cpp
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=119813&r1=119812&r2=119813&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Nov 19 12:16:46 2010
@@ -4295,8 +4295,13 @@
     if (CheckFunctionCall(FDecl, TheCall))
       return ExprError();
 
-    if (unsigned BuiltinID = FDecl->getBuiltinID())
-      return CheckBuiltinFunctionCall(BuiltinID, TheCall);
+    if (unsigned BuiltinID = FDecl->getBuiltinID()) {
+      // When not in Objective-C mode, there is no builtin 'id' type.
+      // We won't have pre-defined library functions which use this type.
+      if (getLangOptions().ObjC1 ||
+          Context.BuiltinInfo.GetTypeString(BuiltinID)[0] != 'G')
+        return CheckBuiltinFunctionCall(BuiltinID, TheCall);
+    }
   } else if (NDecl) {
     if (CheckBlockCall(NDecl, TheCall))
       return ExprError();

Added: cfe/trunk/test/SemaCXX/builtin_objc_msgSend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/builtin_objc_msgSend.cpp?rev=119813&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/builtin_objc_msgSend.cpp (added)
+++ cfe/trunk/test/SemaCXX/builtin_objc_msgSend.cpp Fri Nov 19 12:16:46 2010
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+// rdar://8686888
+
+typedef struct objc_selector *SEL;
+typedef struct objc_object *id;
+
+extern "C" __attribute__((visibility("default"))) id objc_msgSend(id self, SEL op, ...)
+    __attribute__((visibility("default")));
+
+inline void TCFReleaseGC(void * object)
+{
+ static SEL SEL_release;
+ objc_msgSend((id)object, SEL_release);
+}





More information about the cfe-commits mailing list