Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 474042 | Differences between
and this patch

Collapse All | Expand All

(-)a/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp (+81 lines)
Lines 1870-1875 bool FreeBSD::UseSjLjExceptions() const { Link Here
1870
  }
1870
  }
1871
}
1871
}
1872
1872
1873
/// \brief Helper to add the three variant paths for a libstdc++ installation.
1874
/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
1875
                                                const ArgList &DriverArgs,
1876
                                                ArgStringList &CC1Args) {
1877
  if (!llvm::sys::fs::exists(Base))
1878
    return false;
1879
  addSystemInclude(DriverArgs, CC1Args, Base);
1880
  addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir);
1881
  addSystemInclude(DriverArgs, CC1Args, Base + "/backward");
1882
  return true;
1883
}
1884
1885
/// \brief Helper to add an extra variant path for an (Ubuntu) multilib
1886
/// libstdc++ installation.
1887
/*static*/ bool FreeBSD::addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
1888
                                                Twine TargetArchDir,
1889
                                                Twine MultiLibSuffix,
1890
                                                const ArgList &DriverArgs,
1891
                                                ArgStringList &CC1Args) {
1892
  if (!addLibStdCXXIncludePaths(Base+Suffix, TargetArchDir + MultiLibSuffix,
1893
                                DriverArgs, CC1Args))
1894
    return false;
1895
1896
  addSystemInclude(DriverArgs, CC1Args, Base + "/" + TargetArchDir + Suffix
1897
                   + MultiLibSuffix);
1898
  return true;
1899
}
1900
1901
void FreeBSD::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
1902
                                         ArgStringList &CC1Args) const {
1903
  if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
1904
      DriverArgs.hasArg(options::OPT_nostdincxx))
1905
    return;
1906
1907
  // Check if libc++ has been enabled and provide its include paths if so.
1908
  if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
1909
    // libc++ is always installed at a fixed path on Linux currently.
1910
    addSystemInclude(DriverArgs, CC1Args,
1911
                     getDriver().SysRoot + "/usr/include/c++/v1");
1912
    return;
1913
  }
1914
1915
  // We need a detected GCC installation on Linux to provide libstdc++'s
1916
  // headers. We handled the libc++ case above.
1917
  if (!GCCInstallation.isValid())
1918
    return;
1919
1920
  // By default, look for the C++ headers in an include directory adjacent to
1921
  // the lib directory of the GCC installation. Note that this is expect to be
1922
  // equivalent to '/usr/include/c++/X.Y' in almost all cases.
1923
  StringRef LibDir = GCCInstallation.getParentLibPath();
1924
  StringRef InstallDir = GCCInstallation.getInstallPath();
1925
  StringRef Version = GCCInstallation.getVersion().Text;
1926
  StringRef TripleStr = GCCInstallation.getTriple().str();
1927
1928
  if (addLibStdCXXIncludePaths(LibDir.str() + "/../include",
1929
                               "/c++/" + Version.str(),
1930
                               TripleStr,
1931
                               GCCInstallation.getMultiarchSuffix(),
1932
                               DriverArgs, CC1Args))
1933
    return;
1934
1935
  const std::string IncludePathCandidates[] = {
1936
    // Gentoo is weird and places its headers inside the GCC install, so if the
1937
    // first attempt to find the headers fails, try this pattern.
1938
    InstallDir.str() + "/include/g++-v4",
1939
    // Android standalone toolchain has C++ headers in yet another place.
1940
    LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(),
1941
    // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++,
1942
    // without a subdirectory corresponding to the gcc version.
1943
    LibDir.str() + "/../include/c++",
1944
  };
1945
1946
  for (unsigned i = 0; i < llvm::array_lengthof(IncludePathCandidates); ++i) {
1947
    if (addLibStdCXXIncludePaths(IncludePathCandidates[i], (TripleStr +
1948
                GCCInstallation.getMultiarchSuffix()),
1949
            DriverArgs, CC1Args))
1950
      break;
1951
  }
1952
}
1953
1873
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
1954
/// NetBSD - NetBSD tool chain which can call as(1) and ld(1) directly.
1874
1955
1875
NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
1956
NetBSD::NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
(-)a/llvm-3.3.src/tools/clang/lib/Driver/ToolChains.h (+13 lines)
Lines 462-470 public: Link Here
462
  virtual bool IsObjCNonFragileABIDefault() const { return true; }
462
  virtual bool IsObjCNonFragileABIDefault() const { return true; }
463
463
464
  virtual bool UseSjLjExceptions() const;
464
  virtual bool UseSjLjExceptions() const;
465
466
  virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
467
                                            ArgStringList &CC1Args) const;
465
protected:
468
protected:
466
  virtual Tool *buildAssembler() const;
469
  virtual Tool *buildAssembler() const;
467
  virtual Tool *buildLinker() const;
470
  virtual Tool *buildLinker() const;
471
private:
472
  static bool addLibStdCXXIncludePaths(Twine Base, Twine Suffix,
473
                                       Twine TargetArchDir,
474
                                       Twine MultiLibSuffix,
475
                                       const ArgList &DriverArgs,
476
                                       ArgStringList &CC1Args);
477
  static bool addLibStdCXXIncludePaths(Twine Base, Twine TargetArchDir,
478
                                       const ArgList &DriverArgs,
479
                                       ArgStringList &CC1Args);
480
468
};
481
};
469
482
470
class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {
483
class LLVM_LIBRARY_VISIBILITY NetBSD : public Generic_ELF {

Return to bug 474042