[cfe-commits] r120429 - in /cfe/trunk: clang.xcodeproj/project.pbxproj include/clang/Basic/Builtins.def include/clang/Basic/Builtins.h lib/Basic/Builtins.cpp lib/Basic/Targets.cpp lib/Frontend/FrontendAction.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaLookup.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Nov 30 09:35:25 PST 2010


Author: fjahanian
Date: Tue Nov 30 11:35:24 2010
New Revision: 120429

URL: http://llvm.org/viewvc/llvm-project?rev=120429&view=rev
Log:
Such function decls,as objc's objc_msgSend, builtins in 
a specific language. We are adding such language info. by
extensing Builtins.def and via a language flag added
to LIBBUILTIN/BUILTIN and check for that when deciding
a name is builtin or not. Implements //rdar://8689273.

Modified:
    cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/trunk/include/clang/Basic/Builtins.def
    cfe/trunk/include/clang/Basic/Builtins.h
    cfe/trunk/lib/Basic/Builtins.cpp
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Frontend/FrontendAction.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaLookup.cpp

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Tue Nov 30 11:35:24 2010
@@ -2063,7 +2063,6 @@
 			isa = PBXProject;
 			buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
 			compatibilityVersion = "Xcode 2.4";
-			developmentRegion = English;
 			hasScannedForEncodings = 1;
 			knownRegions = (
 				English,

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Tue Nov 30 11:35:24 2010
@@ -78,7 +78,7 @@
 //  FIXME: gcc has nonnull
 
 #if defined(BUILTIN) && !defined(LIBBUILTIN)
-#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) BUILTIN(ID, TYPE, ATTRS)
+#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
 #endif
 
 // Standard libc/libm functions:
@@ -512,85 +512,85 @@
 
 // C99 library functions
 // C99 stdlib.h
-LIBBUILTIN(abort, "v",            "fr",    "stdlib.h")
-LIBBUILTIN(calloc, "v*zz",        "f",     "stdlib.h")
-LIBBUILTIN(exit, "vi",            "fr",    "stdlib.h")
-LIBBUILTIN(_Exit, "vi",           "fr",    "stdlib.h")
-LIBBUILTIN(malloc, "v*z",         "f",     "stdlib.h")
-LIBBUILTIN(realloc, "v*v*z",      "f",     "stdlib.h")
+LIBBUILTIN(abort, "v",            "fr",    "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(calloc, "v*zz",        "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(exit, "vi",            "fr",    "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(_Exit, "vi",           "fr",    "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(malloc, "v*z",         "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(realloc, "v*v*z",      "f",     "stdlib.h", ALL_LANGUAGES)
 // C99 string.h
-LIBBUILTIN(memcpy, "v*v*vC*z",    "f",     "string.h")
-LIBBUILTIN(memmove, "v*v*vC*z",   "f",     "string.h")
-LIBBUILTIN(strcpy, "c*c*cC*",     "f",     "string.h")
-LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     "string.h")
-LIBBUILTIN(strcat, "c*c*cC*",     "f",     "string.h")
-LIBBUILTIN(strncat, "c*c*cC*z",   "f",     "string.h")
-LIBBUILTIN(strxfrm, "zc*cC*z",    "f",     "string.h")
-LIBBUILTIN(memchr, "v*vC*iz",     "f",     "string.h")
-LIBBUILTIN(strchr, "c*cC*i",      "f",     "string.h")
-LIBBUILTIN(strcspn, "zcC*cC*",    "f",     "string.h")
-LIBBUILTIN(strpbrk, "c*cC*cC*",   "f",     "string.h")
-LIBBUILTIN(strrchr, "c*cC*i",     "f",     "string.h")
-LIBBUILTIN(strspn, "zcC*cC*",     "f",     "string.h")
-LIBBUILTIN(strstr, "c*cC*cC*",    "f",     "string.h")
-LIBBUILTIN(strtok, "c*c*cC*",     "f",     "string.h")
-LIBBUILTIN(memset, "v*v*iz",      "f",     "string.h")
-LIBBUILTIN(strerror, "c*i",       "f",     "string.h")
-LIBBUILTIN(strlen, "zcC*",        "f",     "string.h")
+LIBBUILTIN(memcpy, "v*v*vC*z",    "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(memmove, "v*v*vC*z",   "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strcpy, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strcat, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strncat, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strxfrm, "zc*cC*z",    "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(memchr, "v*vC*iz",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strchr, "c*cC*i",      "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strcspn, "zcC*cC*",    "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strpbrk, "c*cC*cC*",   "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strrchr, "c*cC*i",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strspn, "zcC*cC*",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strstr, "c*cC*cC*",    "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strtok, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(memset, "v*v*iz",      "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strerror, "c*i",       "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strlen, "zcC*",        "f",     "string.h", ALL_LANGUAGES)
 // C99 stdio.h
-LIBBUILTIN(printf, "icC*.",       "fp:0:", "stdio.h")
-LIBBUILTIN(fprintf, "iP*cC*.",    "fp:1:", "stdio.h")
-LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", "stdio.h")
-LIBBUILTIN(sprintf, "ic*cC*.",    "fp:1:", "stdio.h")
-LIBBUILTIN(vprintf, "icC*a",      "fP:0:", "stdio.h")
-LIBBUILTIN(vfprintf, "i.",        "fP:1:", "stdio.h")
-LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h")
-LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h")
-LIBBUILTIN(scanf, "icC*.",       "fs:0:", "stdio.h")
+LIBBUILTIN(printf, "icC*.",       "fp:0:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(fprintf, "iP*cC*.",    "fp:1:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(sprintf, "ic*cC*.",    "fp:1:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(vprintf, "icC*a",      "fP:0:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(vfprintf, "i.",        "fP:1:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h", ALL_LANGUAGES)
+LIBBUILTIN(scanf, "icC*.",       "fs:0:", "stdio.h", ALL_LANGUAGES)
 // C99
-LIBBUILTIN(longjmp, "vJi",        "fr",    "setjmp.h")
+LIBBUILTIN(longjmp, "vJi",        "fr",    "setjmp.h", ALL_LANGUAGES)
 
 // Non-C library functions
 // FIXME: Non-C-standard stuff shouldn't be builtins in non-GNU mode!
-LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h")
+LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h", ALL_LANGUAGES)
 // POSIX string.h
-LIBBUILTIN(stpcpy, "c*c*cC*",     "f",     "string.h")
-LIBBUILTIN(stpncpy, "c*c*cC*z",   "f",     "string.h")
-LIBBUILTIN(strdup, "c*cC*",       "f",     "string.h")
-LIBBUILTIN(strndup, "c*cC*z",     "f",     "string.h")
+LIBBUILTIN(stpcpy, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(stpncpy, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strdup, "c*cC*",       "f",     "string.h", ALL_LANGUAGES)
+LIBBUILTIN(strndup, "c*cC*z",     "f",     "string.h", ALL_LANGUAGES)
 // POSIX strings.h
-LIBBUILTIN(index, "c*cC*i",       "f",     "strings.h")
-LIBBUILTIN(rindex, "c*cC*i",      "f",     "strings.h")
-LIBBUILTIN(bzero, "vv*z",         "f",     "strings.h")
+LIBBUILTIN(index, "c*cC*i",       "f",     "strings.h", ALL_LANGUAGES)
+LIBBUILTIN(rindex, "c*cC*i",      "f",     "strings.h", ALL_LANGUAGES)
+LIBBUILTIN(bzero, "vv*z",         "f",     "strings.h", ALL_LANGUAGES)
 // POSIX unistd.h
-LIBBUILTIN(_exit, "vi",           "fr",    "unistd.h")
+LIBBUILTIN(_exit, "vi",           "fr",    "unistd.h", ALL_LANGUAGES)
 // POSIX setjmp.h
-LIBBUILTIN(_longjmp, "vJi",       "fr",    "setjmp.h")
-LIBBUILTIN(siglongjmp, "vSJi",    "fr",    "setjmp.h")
+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")
+LIBBUILTIN(objc_msgSend, "GGH.",   "f",     "objc/message.h", OBJC_LANG)
 BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
 
 // Builtin math library functions
-LIBBUILTIN(pow, "ddd", "fe", "math.h")
-LIBBUILTIN(powl, "LdLdLd", "fe", "math.h")
-LIBBUILTIN(powf, "fff", "fe", "math.h")
-
-LIBBUILTIN(sqrt, "dd", "fe", "math.h")
-LIBBUILTIN(sqrtl, "LdLd", "fe", "math.h")
-LIBBUILTIN(sqrtf, "ff", "fe", "math.h")
-
-LIBBUILTIN(sin, "dd", "fe", "math.h")
-LIBBUILTIN(sinl, "LdLd", "fe", "math.h")
-LIBBUILTIN(sinf, "ff", "fe", "math.h")
-
-LIBBUILTIN(cos, "dd", "fe", "math.h")
-LIBBUILTIN(cosl, "LdLd", "fe", "math.h")
-LIBBUILTIN(cosf, "ff", "fe", "math.h")
+LIBBUILTIN(pow, "ddd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(powl, "LdLdLd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(powf, "fff", "fe", "math.h", ALL_LANGUAGES)
+
+LIBBUILTIN(sqrt, "dd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(sqrtl, "LdLd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(sqrtf, "ff", "fe", "math.h", ALL_LANGUAGES)
+
+LIBBUILTIN(sin, "dd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(sinl, "LdLd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(sinf, "ff", "fe", "math.h", ALL_LANGUAGES)
+
+LIBBUILTIN(cos, "dd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(cosl, "LdLd", "fe", "math.h", ALL_LANGUAGES)
+LIBBUILTIN(cosf, "ff", "fe", "math.h", ALL_LANGUAGES)
 
 // Blocks runtime Builtin math library functions
-LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h")
-LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h")
+LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES)
+LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES)
 // FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
 
 #undef BUILTIN

Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Tue Nov 30 11:35:24 2010
@@ -30,7 +30,15 @@
   class IdentifierTable;
   class ASTContext;
   class QualType;
-
+  class LangOptions;
+  
+  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++
+    ALL_LANGUAGES = (C_LANG|CXX_LANG|OBJC_LANG) //builtin is for all languages.
+  };
+  
 namespace Builtin {
 enum ID {
   NotBuiltin  = 0,      // This is not a builtin function.
@@ -41,6 +49,7 @@
 
 struct Info {
   const char *Name, *Type, *Attributes, *HeaderName;
+  LANGUAGEID builtin_lang;
   bool Suppressed;
 
   bool operator==(const Info &RHS) const {
@@ -62,7 +71,7 @@
   /// InitializeBuiltins - Mark the identifiers for all the builtins with their
   /// appropriate builtin ID # and mark any non-portable builtin identifiers as
   /// such.
-  void InitializeBuiltins(IdentifierTable &Table, bool NoBuiltins = false);
+  void InitializeBuiltins(IdentifierTable &Table, const LangOptions& LangOpts);
 
   /// \brief Popular the vector with the names of all of the builtins.
   void GetBuiltinNames(llvm::SmallVectorImpl<const char *> &Names,

Modified: cfe/trunk/lib/Basic/Builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Builtins.cpp?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Builtins.cpp (original)
+++ cfe/trunk/lib/Basic/Builtins.cpp Tue Nov 30 11:35:24 2010
@@ -14,12 +14,14 @@
 #include "clang/Basic/Builtins.h"
 #include "clang/Basic/IdentifierTable.h"
 #include "clang/Basic/TargetInfo.h"
+#include "clang/Basic/LangOptions.h"
 using namespace clang;
 
 static const Builtin::Info BuiltinInfo[] = {
-  { "not a builtin function", 0, 0, 0, false },
-#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, false },
-#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER, false },
+  { "not a builtin function", 0, 0, 0, ALL_LANGUAGES, false },
+#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES, false },
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) { #ID, TYPE, ATTRS, HEADER,\
+                                                            BUILTIN_LANG, false },
 #include "clang/Basic/Builtins.def"
 };
 
@@ -41,17 +43,20 @@
 /// appropriate builtin ID # and mark any non-portable builtin identifiers as
 /// such.
 void Builtin::Context::InitializeBuiltins(IdentifierTable &Table,
-                                          bool NoBuiltins) {
+                                          const LangOptions& LangOpts) {
   // Step #1: mark all target-independent builtins with their ID's.
   for (unsigned i = Builtin::NotBuiltin+1; i != Builtin::FirstTSBuiltin; ++i)
     if (!BuiltinInfo[i].Suppressed &&
-        (!NoBuiltins || !strchr(BuiltinInfo[i].Attributes, 'f')))
-      Table.get(BuiltinInfo[i].Name).setBuiltinID(i);
+        (!LangOpts.NoBuiltin || !strchr(BuiltinInfo[i].Attributes, 'f'))) {
+      if (LangOpts.ObjC1 || 
+          BuiltinInfo[i].builtin_lang != clang::OBJC_LANG)
+        Table.get(BuiltinInfo[i].Name).setBuiltinID(i);
+    }
 
   // Step #2: Register target-specific builtins.
   for (unsigned i = 0, e = NumTSRecords; i != e; ++i)
     if (!TSRecords[i].Suppressed &&
-        (!NoBuiltins ||
+        (!LangOpts.NoBuiltin ||
          (TSRecords[i].Attributes &&
           !strchr(TSRecords[i].Attributes, 'f'))))
       Table.get(TSRecords[i].Name).setBuiltinID(i+Builtin::FirstTSBuiltin);

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Tue Nov 30 11:35:24 2010
@@ -598,8 +598,9 @@
 };
 
 const Builtin::Info PPCTargetInfo::BuiltinInfo[] = {
-#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, false },
-#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER, false },
+#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES, false },
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
+                                              ALL_LANGUAGES, false },
 #include "clang/Basic/BuiltinsPPC.def"
 };
 
@@ -924,8 +925,9 @@
 namespace {
 // Namespace for x86 abstract base class
 const Builtin::Info BuiltinInfo[] = {
-#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, false },
-#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER, false },
+#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES, false },
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
+                                              ALL_LANGUAGES, false },
 #include "clang/Basic/BuiltinsX86.def"
 };
 
@@ -1948,8 +1950,9 @@
 }
 
 const Builtin::Info ARMTargetInfo::BuiltinInfo[] = {
-#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, false },
-#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER, false },
+#define BUILTIN(ID, TYPE, ATTRS) { #ID, TYPE, ATTRS, 0, ALL_LANGUAGES, false },
+#define LIBBUILTIN(ID, TYPE, ATTRS, HEADER) { #ID, TYPE, ATTRS, HEADER,\
+                                              ALL_LANGUAGES, false },
 #include "clang/Basic/BuiltinsARM.def"
 };
 } // end anonymous namespace.

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Tue Nov 30 11:35:24 2010
@@ -202,7 +202,7 @@
   if (!CI.hasASTContext() || !CI.getASTContext().getExternalSource()) {
     Preprocessor &PP = CI.getPreprocessor();
     PP.getBuiltinInfo().InitializeBuiltins(PP.getIdentifierTable(),
-                                           PP.getLangOptions().NoBuiltin);
+                                           PP.getLangOptions());
   }
 
   return true;

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Nov 30 11:35:24 2010
@@ -4305,13 +4305,8 @@
     if (CheckFunctionCall(FDecl, TheCall))
       return ExprError();
 
-    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);
-    }
+    if (unsigned BuiltinID = FDecl->getBuiltinID())
+      return CheckBuiltinFunctionCall(BuiltinID, TheCall);
   } else if (NDecl) {
     if (CheckBlockCall(NDecl, TheCall))
       return ExprError();

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=120429&r1=120428&r2=120429&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Nov 30 11:35:24 2010
@@ -484,12 +484,7 @@
         if (S.getLangOptions().CPlusPlus &&
             S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
           return false;
-        // 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 (!S.getLangOptions().ObjC1 &&
-            S.Context.BuiltinInfo.GetTypeString(BuiltinID)[0] == 'G')
-          return false;
-
+        
         NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II, BuiltinID,
                                              S.TUScope, R.isForRedeclaration(),
                                              R.getNameLoc());





More information about the cfe-commits mailing list