On Nov 19, 2010, at 10:16 AM, Fariborz Jahanian wrote:

> 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();

This feels a little hackish; could we instead mark this as an 
Objective-C-specific builtin, e.g., by extending Builtins.def? The best 
approach would be to have some kind of language flags for LIBBUILTIN/BUILTIN, 
as we do for language keywords, e.g.,

        LIBBUILTIN(objc_msgSend, "GGH.",   "f",     "objc/message.h", KEYOBJC)


        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to