objc_msgSend is not a builtin type in non-objc mode.
Fixes //rdar://8686888


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119813 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index b70486a..bc811d0 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -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();