[cfe-commits] [Patches] Make C++ work on FreeBSD

Ed Schouten ed at 80386.nl
Sun Jun 28 03:57:50 PDT 2009


* 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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090628/242a74ca/attachment.sig>


More information about the cfe-commits mailing list