[cfe-commits] r163776 - /cfe/trunk/lib/Frontend/InitHeaderSearch.cpp

Chandler Carruth chandlerc at google.com
Wed Sep 12 23:53:34 PDT 2012


On Wed, Sep 12, 2012 at 11:42 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:

> 2012/9/13 Chandler Carruth <chandlerc at google.com>:
> > On Wed, Sep 12, 2012 at 11:10 PM, NAKAMURA Takumi <geek4civic at gmail.com>
> > wrote:
> >>
> >> 2012/9/13 Chandler Carruth <chandlerc at google.com>:
> >> > On Wed, Sep 12, 2012 at 10:53 PM, NAKAMURA Takumi <
> geek4civic at gmail.com>
> >> > wrote:
> >> >>
> >> >> Author: chapuni
> >> >> Date: Thu Sep 13 00:53:23 2012
> >> >> New Revision: 163776
> >> >>
> >> >> URL: http://llvm.org/viewvc/llvm-project?rev=163776&view=rev
> >> >> Log:
> >> >> InitHeaderSearch.cpp: [mingw] Handle DOSish paths only on Win32
> hosts.
> >> >
> >> >
> >> > No, this is completely wrong. The set of paths to search for headers
> >> > should
> >> > never have anything to do with the *host*, only the *target*. Please
> >> > revert
> >> > this and let's actually talk about the problem you're solving here.
> >>
> >> I think Driveletter-based paths would be useless and ignored safely on
> >> non-Win32 hosts (including cygwin). It's host's issue really.
> >
> >
> > In what way can this possibly be a host issue?
> >
> > If I build a Clang binary on my linux machine, and then on a windows
> machine
> > run it under some magical emulation layer, it will suddenly use these
> paths.
>
> I won't imagine that! I suppose such a emulator should use posix-like
> path, like cygwin.
>
> > The header search is a strictly *target* concern, and it should be the
> same
> > regardless of the host on which the compiler is built.
>
> I rather think "The header search can be affected by both host and target."
>

I don't understand what you're talking about at all. Look at the rest of
the header search code. It doesn't probe the host.

How could a darwin host know anything about about a linux target? or vice
versa? And yet if I build Clang on linux I can ask it to do darwin-specific
header search.


Let me try to be more clear: Header search in Clang is *not* a host
concern. Please don't try to make it a host concern, that is a completely
wrong design.

There is only one other place in all of InitHeaderSearch.cpp where we check
the host for anything, it is another '#ifdef _WIN32', and it is wrong.

There is only one part of the Driver's ToolChain logic which inspects the
host, and that is the WindowsToolChain.cpp which checks if the host will
allow it to compile against Win32 APIs for querying the registry. That is
something utterly different from what you are adding here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120912/392d16de/attachment.html>


More information about the cfe-commits mailing list