[cfe-commits] r151889 - in /cfe/trunk/lib: Basic/Targets.cpp Frontend/InitHeaderSearch.cpp

Chandler Carruth chandlerc at google.com
Fri Mar 2 03:25:25 PST 2012


On Fri, Mar 2, 2012 at 2:49 AM, David Chisnall <csdavec at swan.ac.uk> wrote:

> Author: theraven
> Date: Fri Mar  2 04:49:52 2012
> New Revision: 151889
>
> URL: http://llvm.org/viewvc/llvm-project?rev=151889&view=rev
> Log:
> Add the Solaris support directory to the header search when using libc++.
>

If you're going to be touching Solaris header search logic, please factor
it into the driver like the Linux header search logic. That requires a
separate Solaris toolchain (if there isn't one already) and overriding some
methods, but it should be straight forward. Both win32 and Linux are
already factored so you can look at those as an example.

I'd rather not see any further growth of InitHeaderSearch, and notably,
there are no tests with this commit meaning it will break without warning
or an easy way to catch it in the future.


> Unconditionally define __C99FEATURES__ when using C++ on Solaris.  This is
> a
> (hopefully temporary) work around for libc++ exposing C99-but-not-C++98
> features in C++98 mode.
>

Test case? Please don't commit without test cases.


>
>
> Modified:
>    cfe/trunk/lib/Basic/Targets.cpp
>    cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
>
> Modified: cfe/trunk/lib/Basic/Targets.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=151889&r1=151888&r2=151889&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/Targets.cpp (original)
> +++ cfe/trunk/lib/Basic/Targets.cpp Fri Mar  2 04:49:52 2012
> @@ -498,7 +498,7 @@
>       Builder.defineMacro("_XOPEN_SOURCE", "600");
>     else
>       Builder.defineMacro("_XOPEN_SOURCE", "500");
> -    if (Opts.CPlusPlus0x)
> +    if (Opts.CPlusPlus)
>       Builder.defineMacro("__C99FEATURES__");
>     Builder.defineMacro("_LARGEFILE_SOURCE");
>     Builder.defineMacro("_LARGEFILE64_SOURCE");
>
> Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=151889&r1=151888&r2=151889&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Fri Mar  2 04:49:52 2012
> @@ -461,6 +461,11 @@
>           AddPath(P.str(), CXXSystem, true, false, false, true);
>         }
>       }
> +      // On Solaris, include the support directory for things like
> xlocale and
> +      // fudged system headers.
> +      if (triple.getOS() == llvm::Triple::Solaris)
> +        AddPath("/usr/include/c++/v1/support/solaris", CXXSystem, true,
> false,
> +            false);
>

Please follow the prevailing style of LLVM and Clang, and line up arguments
after the open parenthesis.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120302/105bd8d0/attachment.html>


More information about the cfe-commits mailing list