public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in sys-devel/llvm/files: clang-3.3-gcc-header-path.patch
@ 2013-10-13  7:34 Michal Gorny (mgorny)
  0 siblings, 0 replies; only message in thread
From: Michal Gorny (mgorny) @ 2013-10-13  7:34 UTC (permalink / raw
  To: gentoo-commits

mgorny      13/10/13 07:34:11

  Added:                clang-3.3-gcc-header-path.patch
  Log:
  Backport g++-X.Y header location support. Fixes bug #487584.
  
  (Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key EFB4464E!)

Revision  Changes    Path
1.1                  sys-devel/llvm/files/clang-3.3-gcc-header-path.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch?rev=1.1&content-type=text/plain

Index: clang-3.3-gcc-header-path.patch
===================================================================
Backport handling of 'g++-vX.Y' header location.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=487584
---
 tools/clang/lib/Driver/ToolChains.cpp | 20 ++++++++++++--------
 tools/clang/lib/Driver/ToolChains.h   |  3 +++
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp
index 7c9e9c0..e38d42d 100644
--- a/tools/clang/lib/Driver/ToolChains.cpp
+++ b/tools/clang/lib/Driver/ToolChains.cpp
@@ -917,17 +917,19 @@ Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args,
 /// This is the primary means of forming GCCVersion objects.
 /*static*/
 Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
-  const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "" };
+  const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "", "", "" };
   std::pair<StringRef, StringRef> First = VersionText.split('.');
   std::pair<StringRef, StringRef> Second = First.second.split('.');
 
-  GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "" };
+  GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "", "", "" };
   if (First.first.getAsInteger(10, GoodVersion.Major) ||
       GoodVersion.Major < 0)
     return BadVersion;
+  GoodVersion.MajorStr = First.first.str();
   if (Second.first.getAsInteger(10, GoodVersion.Minor) ||
       GoodVersion.Minor < 0)
     return BadVersion;
+  GoodVersion.MinorStr = Second.first.str();
 
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
@@ -945,7 +947,7 @@ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) {
       if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) ||
           GoodVersion.Patch < 0)
         return BadVersion;
-      GoodVersion.PatchSuffix = PatchText.substr(EndNumber).str();
+      GoodVersion.PatchSuffix = PatchText.substr(EndNumber);
     }
   }
 
@@ -2590,11 +2592,11 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
   // equivalent to '/usr/include/c++/X.Y' in almost all cases.
   StringRef LibDir = GCCInstallation.getParentLibPath();
   StringRef InstallDir = GCCInstallation.getInstallPath();
-  StringRef Version = GCCInstallation.getVersion().Text;
   StringRef TripleStr = GCCInstallation.getTriple().str();
+  const GCCVersion &Version = GCCInstallation.getVersion();
 
   if (addLibStdCXXIncludePaths(LibDir.str() + "/../include", 
-                               "/c++/" + Version.str(),
+                               "/c++/" + Version.Text,
                                TripleStr,
                                GCCInstallation.getMultiarchSuffix(),
                                DriverArgs, CC1Args))
@@ -2602,10 +2604,12 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
 
   const std::string IncludePathCandidates[] = {
     // Gentoo is weird and places its headers inside the GCC install, so if the
-    // first attempt to find the headers fails, try this pattern.
-    InstallDir.str() + "/include/g++-v4",
+    // first attempt to find the headers fails, try these patterns.
+    InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." +
+        Version.MinorStr,
+    InstallDir.str() + "/include/g++-v" + Version.MajorStr,
     // Android standalone toolchain has C++ headers in yet another place.
-    LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(),
+    LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text,
     // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
     // without a subdirectory corresponding to the gcc version.
     LibDir.str() + "/../include/c++",
diff --git a/tools/clang/lib/Driver/ToolChains.h b/tools/clang/lib/Driver/ToolChains.h
index 3afd8dd..04cf467 100644
--- a/tools/clang/lib/Driver/ToolChains.h
+++ b/tools/clang/lib/Driver/ToolChains.h
@@ -48,6 +48,9 @@ protected:
     /// \brief The parsed major, minor, and patch numbers.
     int Major, Minor, Patch;
 
+    /// \brief The text of the parsed major, and major+minor versions.
+    std::string MajorStr, MinorStr;
+
     /// \brief Any textual suffix on the patch number.
     std::string PatchSuffix;
 
-- 
1.8.3.2






^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-13  7:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-13  7:34 [gentoo-commits] gentoo-x86 commit in sys-devel/llvm/files: clang-3.3-gcc-header-path.patch Michal Gorny (mgorny)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox