r250473 - Add an error when calling a builtin that requires features that don't

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 17 04:35:59 PDT 2015


On Sat, Oct 17, 2015 at 4:30 AM Dimitry Andric <dimitry at andric.com> wrote:

> On 16 Oct 2015, at 01:47, Eric Christopher via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
> >
> > Author: echristo
> > Date: Thu Oct 15 18:47:11 2015
> > New Revision: 250473
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=250473&view=rev
> > Log:
> > Add an error when calling a builtin that requires features that don't
> > match the feature set of the function that they're being called from.
> ...
> > +def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
>
> Thanks.  Note, a typical error message now becomes something pretty terse,
> like this:
>
> '__builtin_foo' needs target feature bar
>
> It would be helpful if the error message gave some sort of hint on what
> the actual problem is (wrong -march parameter, probably?), and how to fix
> it.
>

Could get an actual mapping of command line to target feature I suppose and
use that. Would require, likely, a mapping of command line option to target
feature in TargetInfo with a default implementation that just returns the
string as a feature for targets that don't bother to implement as the
current implementation is actually target neutral.

I thought about using minimum command line options in the builtins but
that's more difficult to construct up.

In short, very possible to do this, a bit of typing.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151017/ed3fa7db/attachment.html>


More information about the cfe-commits mailing list