[cfe-commits] [Patches] Make C++ work on FreeBSD
Daniel Dunbar
daniel at zuster.org
Mon Jun 29 08:40:08 PDT 2009
Hi Ed,
Doug and I chatted about this, and I think for now we are fine with
driving the is-cxx bit off of the name. It isn't ideal, in my opinion,
because I like being able to rename the executable, but for now it
works (and is better than having two complete driver binaries).
As for the actual pattern to match, I think doing it in the
constructor would be fine. I would propose matching anything with ++
in the name. Do you have a concrete need to match CC?
It would also be nice for the makefiles to build and install 'clang++'
as a symlink to clang, but this won't immediately work because we look
through symlinks when constructing the driver name I believe. I
suppose we will have to change the driver to not do this when
computing the name, unless someone has a better idea of how to handle
all this.
- Daniel
On Sun, Jun 28, 2009 at 3:57 AM, Ed Schouten<ed at 80386.nl> wrote:
> * Ed Schouten <ed at 80386.nl> wrote:
>> It looks like Clang doesn't behave like a C++ compiler when called as
>> `c++' or `g++'. Maybe we should look at the basename or the last bytes
>> of argv[0], but for now this seems to be good enough:
>>
>> Index: lib/Driver/Driver.cpp
>> ===================================================================
>> --- lib/Driver/Driver.cpp (revision 194810)
>> +++ lib/Driver/Driver.cpp (working copy)
>> @@ -118,6 +118,9 @@
>> // driver.
>> bool CCCPrintOptions = false, CCCPrintActions = false;
>>
>> + if (!strcmp(argv[0], "c++") || !strcmp(argv[0], "CC"))
>> + CCCIsCXX = true;
>> +
>> const char **Start = argv + 1, **End = argv + argc;
>> const char *HostTriple = DefaultHostTriple.c_str();
>
> Correcting myself; it seems we already cache the base name of the
> application inside Driver. I propose the following patch. Maybe we
> should put this in the constructor, but I'm not sure about that...
>
> Index: lib/Driver/Driver.cpp
> ===================================================================
> --- lib/Driver/Driver.cpp (revision 194810)
> +++ lib/Driver/Driver.cpp (working copy)
> @@ -118,6 +118,9 @@
> // driver.
> bool CCCPrintOptions = false, CCCPrintActions = false;
>
> + if (Name == "c++" || Name == "CC")
> + CCCIsCXX = true;
> +
> const char **Start = argv + 1, **End = argv + argc;
> const char *HostTriple = DefaultHostTriple.c_str();
>
> --
> Ed Schouten <ed at 80386.nl>
> WWW: http://80386.nl/
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
More information about the cfe-commits
mailing list