r225134 - Fix default image name to 'a.exe' on Windows, instead 'a.out'.

Yaron Keren yaron.keren at gmail.com
Thu Jan 8 13:59:52 PST 2015


The Driver needs DefaultImageName which is based on the target triple but
the only location the target triple is computed using  computeTargetTriple() is
in getToolChain() and the target triple is not kept otherwise.

We could have getToolChain return the computed target triple to its
caller BuildCompilation (non const mmeber function) and have
BuildCompilation set DefaultImageName based on the OS. Does this make sense
to you?

I'll fix the test.






2015-01-08 23:16 GMT+02:00 Hans Wennborg <hans at chromium.org>:

> On Sun, Jan 4, 2015 at 5:48 AM, Yaron Keren <yaron.keren at gmail.com> wrote:
> > Author: yrnkrn
> > Date: Sun Jan  4 07:48:30 2015
> > New Revision: 225134
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=225134&view=rev
> > Log:
> > Fix default image name to 'a.exe' on Windows, instead 'a.out'.
> > This applies to mingw as clang-cl already has its own logic for the
> filename.
>
> [..]
>
> > Modified: cfe/trunk/lib/Driver/Driver.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=225134&r1=225133&r2=225134&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Driver/Driver.cpp (original)
> > +++ cfe/trunk/lib/Driver/Driver.cpp Sun Jan  4 07:48:30 2015
> > @@ -1996,6 +1996,8 @@ const ToolChain &Driver::getToolChain(co
> >                                        StringRef DarwinArchName) const {
> >    llvm::Triple Target = computeTargetTriple(DefaultTargetTriple, Args,
> >                                              DarwinArchName);
> > +  if (Target.isOSWindows())
> > +    DefaultImageName = "a.exe";
>
> This doesn't seem right. Why should getToolChain() be changing the
> Driver's DefaultImageName? That this requires DefaultImageName to be
> mutable makes it feel even more iffy.
>
> Maybe DefaultImageName should be a property of the Target? Or perhaps
> there should be a "const char *Driver::DefaultImageName(llvm::Triple)"
> method?
>
>
> > Modified: cfe/trunk/test/Driver/lto.c
>
> It would be nice to test for the default image name explicitly by
> setting -target and looking at the cc1 invocation.
>
>  - Hans
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150108/e1f2b82e/attachment.html>


More information about the cfe-commits mailing list