[PATCH][Solaris] Use the GCC Installation detector to add the C++ include paths
Xan López
xan at igalia.com
Tue Jul 28 03:20:00 PDT 2015
A follow up to the previous patch, this gets rid of the last hardcoded
path (and moves it to its proper place).
-------------- next part --------------
>From 8efa091aaad52ca0c1bb8bdab9c36404d641b471 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Xan=20L=C3=B3pez?= <xan at igalia.com>
Date: Thu, 23 Jul 2015 16:39:08 +0200
Subject: [PATCH 2/2] [Solaris] Move the C++ includes management to the Driver
We can also use the detected GCC installation now, instead of
hardcoding the C++ includes path.
---
lib/Driver/ToolChains.cpp | 17 +++++++++++++++++
lib/Driver/ToolChains.h | 3 +++
lib/Frontend/InitHeaderSearch.cpp | 9 ---------
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index f599186..ebb5916 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -2940,6 +2940,23 @@ Tool *Solaris::buildAssembler() const {
Tool *Solaris::buildLinker() const { return new tools::solaris::Linker(*this); }
+void Solaris::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
+ ArgStringList &CC1Args) const {
+ if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
+ DriverArgs.hasArg(options::OPT_nostdincxx))
+ return;
+
+ // Include the support directory for things like xlocale and fudged system headers.
+ addSystemInclude(DriverArgs, CC1Args, "/usr/include/c++/v1/support/solaris");
+
+ if (GCCInstallation.isValid()) {
+ GCCVersion Version = GCCInstallation.getVersion();
+ addSystemInclude(DriverArgs, CC1Args, "/usr/gcc/" +
+ Version.MajorStr + "." + Version.MinorStr +
+ "/include/c++/" + Version.Text);
+ }
+}
+
/// Distribution (very bare-bones at the moment).
enum Distro {
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index 27944c8..d0d02f8 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -521,6 +521,9 @@ public:
bool IsIntegratedAssemblerDefault() const override { return true; }
+ void AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+ llvm::opt::ArgStringList &CC1Args) const override;
+
protected:
Tool *buildAssembler() const override;
Tool *buildLinker() const override;
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index e3a17c9..f68cf0f 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -404,10 +404,6 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOp
AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3",
"", "", "", triple);
break;
- case llvm::Triple::Solaris:
- AddGnuCPlusPlusIncludePaths("/usr/gcc/4.5/include/c++/4.5.2/",
- "i386-pc-solaris2.11", "", "", triple);
- break;
default:
break;
}
@@ -453,11 +449,6 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
AddUnmappedPath(P, CXXSystem, false);
}
}
- // 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, false);
-
AddPath("/usr/include/c++/v1", CXXSystem, false);
} else {
AddDefaultCPlusPlusIncludePaths(triple, HSOpts);
--
2.4.3
More information about the llvm-commits
mailing list