On Wed, May 21, 2014 at 4:43 PM, jahanian <[email protected]> wrote:

>
> On May 21, 2014, at 4:29 PM, Richard Smith <[email protected]> wrote:
>
> It's not OK to set a declaration invalid having only produced a warning.
>
>
> Yes.  But this is a unique situation:
>
> Both Old->getBuiltinID() and New-> getBuiltinID() refer to the same
> identifier
> New->getIdentifier()->setBuiltinID(Builtin::NotBuiltin)  (which we must
> do because it is user declared)
> makes “Old” as non-builtin as well. Not invalidating it we end up with a
> declaration of a built-in function
> which has no built-in ID!
>

With the patch, I'd expect that calls to the builtin function that don't
find the local extern decl will (sometimes) be silently discarded. It's far
too dangerous to allow a valid AST to contain invalid decls.

Is there an alternative? As things stand, we don’t keep source fidelity for
> local re-declaration
> of a built-in function  (and IRGen doesn’t like that :).
>

How about this: drop the setInvalidDecl() call. In its place, when we get a
type mismatch between two function declarations, if Old is implicit then
check whether it used to be a builtin. If so, check the type against the
most recent declaration instead.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to