InitHeaderSearch.cpp revision 630766057eabe78f9bb2e0c0d023223fb8d0174e
1df22c2cc7703c7df04eadd2e6e59c61f545a5741Nick Lewycky//===--- InitHeaderSearch.cpp - Initialize header search paths ------------===// 20fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// 30fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// The LLVM Compiler Infrastructure 40fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// 50fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// This file is distributed under the University of Illinois Open Source 60fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// License. See LICENSE.TXT for details. 70fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// 80fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber//===----------------------------------------------------------------------===// 90fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// 100fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// This file implements the InitHeaderSearch class. 110fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber// 120fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber//===----------------------------------------------------------------------===// 130fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 142100fe952a644134b1dca462f2e6330cf14ef47cOscar Fuentes#ifdef HAVE_CLANG_CONFIG_H 152100fe952a644134b1dca462f2e6330cf14ef47cOscar Fuentes# include "clang/Config/config.h" 162100fe952a644134b1dca462f2e6330cf14ef47cOscar Fuentes#endif 172100fe952a644134b1dca462f2e6330cf14ef47cOscar Fuentes 182cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar#include "clang/Frontend/Utils.h" 190fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber#include "clang/Basic/FileManager.h" 200fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber#include "clang/Basic/LangOptions.h" 2163c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar#include "clang/Frontend/HeaderSearchOptions.h" 2263c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar#include "clang/Lex/HeaderSearch.h" 230fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber#include "llvm/ADT/SmallString.h" 240fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber#include "llvm/ADT/SmallPtrSet.h" 25aadd7a48453b4f58bd8e1e9eb670918ee7d6a711Rafael Espindola#include "llvm/ADT/SmallVector.h" 26f0a2f51be576089e1a84cd677c09156dae067b6aRafael Espindola#include "llvm/ADT/StringExtras.h" 272cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar#include "llvm/ADT/Triple.h" 28e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer#include "llvm/ADT/Twine.h" 29d57a7ef9252964bc6c8471451d7bd395b0520cb8Chris Lattner#include "llvm/Support/raw_ostream.h" 3003013fa9a0bf1ef4b907f5fec006c8f4000fdd21Michael J. Spencer#include "llvm/Support/Path.h" 31121e3c207415fb4c105d690de384d8f3d49b0f2dArgyrios Kyrtzidis#include "llvm/Config/config.h" 32620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump#ifdef _MSC_VER 33620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump #define WIN32_LEAN_AND_MEAN 1 34620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump #include <windows.h> 35620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump#endif 360fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weberusing namespace clang; 372cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbarusing namespace clang::frontend; 382cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 392cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbarnamespace { 402cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 412cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar/// InitHeaderSearch - This class makes it easier to set the search paths of 422cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar/// a HeaderSearch object. InitHeaderSearch stores several search path lists 432cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar/// internally, which can be sent to a HeaderSearch object in one swoop. 442cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbarclass InitHeaderSearch { 452df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger std::vector<std::pair<IncludeDirGroup, DirectoryLookup> > IncludePath; 462df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger typedef std::vector<std::pair<IncludeDirGroup, 472df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger DirectoryLookup> >::const_iterator path_iterator; 482cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar HeaderSearch& Headers; 492cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar bool Verbose; 50af6530c938bfc60902f0dfec1c0808aedbee1663Michael J. Spencer std::string IncludeSysroot; 51af6530c938bfc60902f0dfec1c0808aedbee1663Michael J. Spencer bool IsNotEmptyOrRoot; 522cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 532cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbarpublic: 542cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 55c09265a5fd94af5dcfd7325d0cb4f04197d65afcChandler Carruth InitHeaderSearch(HeaderSearch &HS, bool verbose, llvm::StringRef sysroot) 56af6530c938bfc60902f0dfec1c0808aedbee1663Michael J. Spencer : Headers(HS), Verbose(verbose), IncludeSysroot(sysroot), 57af6530c938bfc60902f0dfec1c0808aedbee1663Michael J. Spencer IsNotEmptyOrRoot(!(sysroot.empty() || sysroot == "/")) { 58c09265a5fd94af5dcfd7325d0cb4f04197d65afcChandler Carruth } 592cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 602cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// AddPath - Add the specified path to the specified group list. 61e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer void AddPath(const llvm::Twine &Path, IncludeDirGroup Group, 622cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar bool isCXXAware, bool isUserSupplied, 632cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar bool isFramework, bool IgnoreSysRoot = false); 642cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 65a608737659d4330d9ae7622bf1a87c33b9d97072mike-m /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu 662cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// libstdc++. 67e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer void AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, 68e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef ArchDir, 69e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Dir32, 70e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Dir64, 712cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar const llvm::Triple &triple); 722cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 7306a8dc616ec8324694d45cd4d724634a899be9a3Michael J. Spencer /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW 742cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// libstdc++. 75e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer void AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, 76e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Arch, 77e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Version); 782cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 792cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// AddDelimitedPaths - Add a list of paths delimited by the system PATH 802cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// separator. The processing follows that of the CPATH variable for gcc. 819e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer void AddDelimitedPaths(llvm::StringRef String); 822cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 832cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar // AddDefaultCIncludePaths - Add paths that should always be searched. 8479bc57c074cb91f574fba19215f95b63dcf6b04bmike-m void AddDefaultCIncludePaths(const llvm::Triple &triple, 8579bc57c074cb91f574fba19215f95b63dcf6b04bmike-m const HeaderSearchOptions &HSOpts); 862cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 872cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar // AddDefaultCPlusPlusIncludePaths - Add paths that should be searched when 882cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar // compiling c++. 892cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar void AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple); 902cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 912cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// AddDefaultSystemIncludePaths - Adds the default system include paths so 922cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// that e.g. stdio.h is found. 932cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar void AddDefaultSystemIncludePaths(const LangOptions &Lang, 944c2bcad7b843c10fd4a2ffd43da40bfefb4dc8baDouglas Gregor const llvm::Triple &triple, 9579bc57c074cb91f574fba19215f95b63dcf6b04bmike-m const HeaderSearchOptions &HSOpts); 962cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 972cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// Realize - Merges all search path lists into one list and send it to 982cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar /// HeaderSearch. 992df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger void Realize(const LangOptions &Lang); 1002cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar}; 1012cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar 1022cdafa8001ee69b75d2906cbb36f16cf8e1dc60aDaniel Dunbar} 1030fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 104e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramervoid InitHeaderSearch::AddPath(const llvm::Twine &Path, 105458fb10ef5ba2d7b375c6c64095c1458af0a5be3Benjamin Kramer IncludeDirGroup Group, bool isCXXAware, 106458fb10ef5ba2d7b375c6c64095c1458af0a5be3Benjamin Kramer bool isUserSupplied, bool isFramework, 107458fb10ef5ba2d7b375c6c64095c1458af0a5be3Benjamin Kramer bool IgnoreSysRoot) { 108e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer assert(!Path.isTriviallyEmpty() && "can't handle empty path here"); 1090fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber FileManager &FM = Headers.getFileMgr(); 1101eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1110fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // Compute the actual path, taking into consideration -isysroot. 1125853b0f117ee811388219bce738b24835b8d7fb2Chandler Carruth llvm::SmallString<256> MappedPathStorage; 113f3721457cd9f364f262e7a2d61edcdad05996e61Chandler Carruth llvm::StringRef MappedPathStr = Path.toStringRef(MappedPathStorage); 1141eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1150fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // Handle isysroot. 116256053b31e697fdf0cc48f17d621c82fc3b8dff0Michael J. Spencer if (Group == System && !IgnoreSysRoot && 117256053b31e697fdf0cc48f17d621c82fc3b8dff0Michael J. Spencer llvm::sys::path::is_absolute(MappedPathStr) && 118af6530c938bfc60902f0dfec1c0808aedbee1663Michael J. Spencer IsNotEmptyOrRoot) { 1195619ae5d25dc77410a444c86606d4ec9bae8b921Chandler Carruth MappedPathStorage.clear(); 120c09265a5fd94af5dcfd7325d0cb4f04197d65afcChandler Carruth MappedPathStr = 121af6530c938bfc60902f0dfec1c0808aedbee1663Michael J. Spencer (IncludeSysroot + Path).toStringRef(MappedPathStorage); 1220fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 1231eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1240fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // Compute the DirectoryLookup type. 1259d72851fec9e9c62570a027d42701562bbf29751Chris Lattner SrcMgr::CharacteristicKind Type; 1260fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber if (Group == Quoted || Group == Angled) 1270b9e736308af5397f558ffc8e780c438c2fdb563Chris Lattner Type = SrcMgr::C_User; 1280fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber else if (isCXXAware) 1290b9e736308af5397f558ffc8e780c438c2fdb563Chris Lattner Type = SrcMgr::C_System; 1300fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber else 1310b9e736308af5397f558ffc8e780c438c2fdb563Chris Lattner Type = SrcMgr::C_ExternCSystem; 1321eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1331eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1340fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // If the directory exists, add it. 13539b49bcaaddb1049234fca9500c0ac02c088e23dChris Lattner if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr)) { 1362df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger IncludePath.push_back(std::make_pair(Group, DirectoryLookup(DE, Type, 1372df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger isUserSupplied, isFramework))); 1380fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber return; 1390fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 1401eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1410fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // Check to see if this is an apple-style headermap (which are not allowed to 1420fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // be frameworks). 1430fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber if (!isFramework) { 14439b49bcaaddb1049234fca9500c0ac02c088e23dChris Lattner if (const FileEntry *FE = FM.getFile(MappedPathStr)) { 1450fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber if (const HeaderMap *HM = Headers.CreateHeaderMap(FE)) { 1460fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // It is a headermap, add it to the search path. 1472df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger IncludePath.push_back(std::make_pair(Group, DirectoryLookup(HM, Type, 1482df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger isUserSupplied))); 1490fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber return; 1500fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 1510fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 1520fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 1531eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 1540fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber if (Verbose) 155f3721457cd9f364f262e7a2d61edcdad05996e61Chandler Carruth llvm::errs() << "ignoring nonexistent directory \"" 156f3721457cd9f364f262e7a2d61edcdad05996e61Chandler Carruth << MappedPathStr << "\"\n"; 1570fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber} 1580fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 1590fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 1609e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramervoid InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) { 1619e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer if (at.empty()) // Empty string should not add '.' path. 1620fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber return; 1630fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 1649e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer llvm::StringRef::size_type delim; 1659e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer while ((delim = at.find(llvm::sys::PathSeparator)) != llvm::StringRef::npos) { 1669e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer if (delim == 0) 1670fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber AddPath(".", Angled, false, true, false); 1680fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber else 1699e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer AddPath(at.substr(0, delim), Angled, false, true, false); 1709e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer at = at.substr(delim + 1); 1710fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 1729e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer 1739e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer if (at.empty()) 1740fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber AddPath(".", Angled, false, true, false); 1750fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber else 1760fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber AddPath(at, Angled, false, true, false); 1770fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber} 1780fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 179e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramervoid InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base, 180e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef ArchDir, 181e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Dir32, 182e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Dir64, 18331b63beefa058aa42a12a1c2b72b43a4ba21f7f1Rafael Espindola const llvm::Triple &triple) { 1846ec18a3f86c702004af66cce6ff979999a736898Rafael Espindola // Add the base dir 1852df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath(Base, CXXSystem, true, false, false); 186ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola 187ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola // Add the multilib dirs 18831b63beefa058aa42a12a1c2b72b43a4ba21f7f1Rafael Espindola llvm::Triple::ArchType arch = triple.getArch(); 18931b63beefa058aa42a12a1c2b72b43a4ba21f7f1Rafael Espindola bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64; 19031b63beefa058aa42a12a1c2b72b43a4ba21f7f1Rafael Espindola if (is64bit) 1912df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath(Base + "/" + ArchDir + "/" + Dir64, CXXSystem, true, false, false); 19231b63beefa058aa42a12a1c2b72b43a4ba21f7f1Rafael Espindola else 1932df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath(Base + "/" + ArchDir + "/" + Dir32, CXXSystem, true, false, false); 1946ec18a3f86c702004af66cce6ff979999a736898Rafael Espindola 1956ec18a3f86c702004af66cce6ff979999a736898Rafael Espindola // Add the backward dir 1962df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath(Base + "/backward", CXXSystem, true, false, false); 1972e9f652d53346bf7e64c8a12a9ff06b004a3e489Rafael Espindola} 1980fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 199e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramervoid InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base, 200e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Arch, 201e89ba59005479529f5567f12b436617a2ca73ec2Benjamin Kramer llvm::StringRef Version) { 202ab8ae19ea4285a15ca43123e8e218e401dc5cb5aBenjamin Kramer AddPath(Base + "/" + Arch + "/" + Version + "/include/c++", 2032df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger CXXSystem, true, false, false); 2048e9006bb31184a38b7c4c9d3d3040394652cbd9bChris Lattner AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/" + Arch, 2052df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger CXXSystem, true, false, false); 206ab8ae19ea4285a15ca43123e8e218e401dc5cb5aBenjamin Kramer AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/backward", 2072df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger CXXSystem, true, false, false); 208620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump} 20943d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump 210620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump // FIXME: This probably should goto to some platform utils place. 211620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump#ifdef _MSC_VER 21275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson 213620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump // Read registry string. 21475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // This also supports a means to look for high-versioned keys by use 21575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // of a $VERSION placeholder in the key path. 21675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // $VERSION in the key path is a placeholder for the version number, 21775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // causing the highest value path to be searched for and used. 21875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // I.e. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION". 21975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // There can be additional characters in the component. Only the numberic 22075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // characters are compared. 2216cd5216bb61e6165d8f6e8fb781d45c035bd4e00Benjamin Kramerstatic bool getSystemRegistryString(const char *keyPath, const char *valueName, 2226cd5216bb61e6165d8f6e8fb781d45c035bd4e00Benjamin Kramer char *value, size_t maxLength) { 22343d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump HKEY hRootKey = NULL; 22443d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump HKEY hKey = NULL; 22543d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump const char* subKey = NULL; 22643d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump DWORD valueType; 22743d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump DWORD valueSize = maxLength - 1; 22875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson long lResult; 22943d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump bool returnValue = false; 23043d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump if (strncmp(keyPath, "HKEY_CLASSES_ROOT\\", 18) == 0) { 23143d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump hRootKey = HKEY_CLASSES_ROOT; 23243d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump subKey = keyPath + 18; 23343d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump } 23443d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump else if (strncmp(keyPath, "HKEY_USERS\\", 11) == 0) { 23543d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump hRootKey = HKEY_USERS; 23643d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump subKey = keyPath + 11; 23743d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump } 23843d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump else if (strncmp(keyPath, "HKEY_LOCAL_MACHINE\\", 19) == 0) { 23943d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump hRootKey = HKEY_LOCAL_MACHINE; 24043d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump subKey = keyPath + 19; 241121e3c207415fb4c105d690de384d8f3d49b0f2dArgyrios Kyrtzidis } 24243d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump else if (strncmp(keyPath, "HKEY_CURRENT_USER\\", 18) == 0) { 24343d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump hRootKey = HKEY_CURRENT_USER; 24443d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump subKey = keyPath + 18; 24543d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump } 24643d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump else 24743d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump return(false); 24875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson const char *placeHolder = strstr(subKey, "$VERSION"); 24975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson char bestName[256]; 25075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson bestName[0] = '\0'; 25175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // If we have a $VERSION placeholder, do the highest-version search. 25275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (placeHolder) { 25375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson const char *keyEnd = placeHolder - 1; 25475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson const char *nextKey = placeHolder; 25575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // Find end of previous key. 25675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson while ((keyEnd > subKey) && (*keyEnd != '\\')) 25775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson keyEnd--; 25875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // Find end of key containing $VERSION. 25975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson while (*nextKey && (*nextKey != '\\')) 26075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson nextKey++; 26175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson size_t partialKeyLength = keyEnd - subKey; 26275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson char partialKey[256]; 26375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (partialKeyLength > sizeof(partialKey)) 26475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson partialKeyLength = sizeof(partialKey); 26575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson strncpy(partialKey, subKey, partialKeyLength); 26675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson partialKey[partialKeyLength] = '\0'; 26775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson HKEY hTopKey = NULL; 26875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson lResult = RegOpenKeyEx(hRootKey, partialKey, 0, KEY_READ, &hTopKey); 26975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (lResult == ERROR_SUCCESS) { 27075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson char keyName[256]; 27175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson int bestIndex = -1; 27275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson double bestValue = 0.0; 27375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson DWORD index, size = sizeof(keyName) - 1; 27433cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes for (index = 0; RegEnumKeyEx(hTopKey, index, keyName, &size, NULL, 27533cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes NULL, NULL, NULL) == ERROR_SUCCESS; index++) { 27633cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes const char *sp = keyName; 27733cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes while (*sp && !isdigit(*sp)) 27833cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes sp++; 27933cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes if (!*sp) 28033cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes continue; 28133cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes const char *ep = sp + 1; 28233cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes while (*ep && (isdigit(*ep) || (*ep == '.'))) 28333cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes ep++; 28433cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes char numBuf[32]; 28533cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes strncpy(numBuf, sp, sizeof(numBuf) - 1); 28633cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes numBuf[sizeof(numBuf) - 1] = '\0'; 28733cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes double value = strtod(numBuf, NULL); 28833cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes if (value > bestValue) { 28933cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes bestIndex = (int)index; 29033cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes bestValue = value; 29133cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes strcpy(bestName, keyName); 29233cc2437ae3a609cdc44179931a2909eb48a8200Nuno Lopes } 29375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson size = sizeof(keyName) - 1; 29475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 29575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // If we found the highest versioned key, open the key and get the value. 29675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (bestIndex != -1) { 29775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // Append rest of key. 29875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson strncat(bestName, nextKey, sizeof(bestName) - 1); 29975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson bestName[sizeof(bestName) - 1] = '\0'; 30075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // Open the chosen key path remainder. 30175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson lResult = RegOpenKeyEx(hTopKey, bestName, 0, KEY_READ, &hKey); 30275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (lResult == ERROR_SUCCESS) { 30375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType, 30475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson (LPBYTE)value, &valueSize); 30575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (lResult == ERROR_SUCCESS) 30675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson returnValue = true; 30775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson RegCloseKey(hKey); 30875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 30975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 31075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson RegCloseKey(hTopKey); 31175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 31275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 31375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson else { 31475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson lResult = RegOpenKeyEx(hRootKey, subKey, 0, KEY_READ, &hKey); 31575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (lResult == ERROR_SUCCESS) { 31675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType, 31775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson (LPBYTE)value, &valueSize); 31875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (lResult == ERROR_SUCCESS) 31975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson returnValue = true; 32075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson RegCloseKey(hKey); 32175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 32243d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump } 32343d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump return(returnValue); 32443d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump} 325620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump#else // _MSC_VER 326620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump // Read registry string. 3276cd5216bb61e6165d8f6e8fb781d45c035bd4e00Benjamin Kramerstatic bool getSystemRegistryString(const char*, const char*, char*, size_t) { 328620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump return(false); 329620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump} 330620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump#endif // _MSC_VER 331121e3c207415fb4c105d690de384d8f3d49b0f2dArgyrios Kyrtzidis 33243d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump // Get Visual Studio installation directory. 3336cd5216bb61e6165d8f6e8fb781d45c035bd4e00Benjamin Kramerstatic bool getVisualStudioDir(std::string &path) { 334ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer // First check the environment variables that vsvars32.bat sets. 335ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer const char* vcinstalldir = getenv("VCINSTALLDIR"); 336ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer if(vcinstalldir) { 337ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer char *p = const_cast<char *>(strstr(vcinstalldir, "\\VC")); 338ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer if (p) 339ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer *p = '\0'; 340ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer path = vcinstalldir; 341ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer return(true); 342ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer } 343ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer 34475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson char vsIDEInstallDir[256]; 34580f93d9fe82ebe7e58913646248240de838283beDouglas Gregor char vsExpressIDEInstallDir[256]; 346ff58e3610f4e12094def69eb2d6dcb4330378d8fMichael J. Spencer // Then try the windows registry. 34775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson bool hasVCDir = getSystemRegistryString( 34875ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION", 34975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson "InstallDir", vsIDEInstallDir, sizeof(vsIDEInstallDir) - 1); 35080f93d9fe82ebe7e58913646248240de838283beDouglas Gregor bool hasVCExpressDir = getSystemRegistryString( 35180f93d9fe82ebe7e58913646248240de838283beDouglas Gregor "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\$VERSION", 35280f93d9fe82ebe7e58913646248240de838283beDouglas Gregor "InstallDir", vsExpressIDEInstallDir, sizeof(vsExpressIDEInstallDir) - 1); 353125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi // If we have both vc80 and vc90, pick version we were compiled with. 35475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (hasVCDir && vsIDEInstallDir[0]) { 355620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump char *p = (char*)strstr(vsIDEInstallDir, "\\Common7\\IDE"); 356620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump if (p) 357620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump *p = '\0'; 358620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump path = vsIDEInstallDir; 359620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump return(true); 36043d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump } 36180f93d9fe82ebe7e58913646248240de838283beDouglas Gregor else if (hasVCExpressDir && vsExpressIDEInstallDir[0]) { 36280f93d9fe82ebe7e58913646248240de838283beDouglas Gregor char *p = (char*)strstr(vsExpressIDEInstallDir, "\\Common7\\IDE"); 36380f93d9fe82ebe7e58913646248240de838283beDouglas Gregor if (p) 36480f93d9fe82ebe7e58913646248240de838283beDouglas Gregor *p = '\0'; 36580f93d9fe82ebe7e58913646248240de838283beDouglas Gregor path = vsExpressIDEInstallDir; 36680f93d9fe82ebe7e58913646248240de838283beDouglas Gregor return(true); 36780f93d9fe82ebe7e58913646248240de838283beDouglas Gregor } 368620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump else { 369620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump // Try the environment. 37080f93d9fe82ebe7e58913646248240de838283beDouglas Gregor const char* vs100comntools = getenv("VS100COMNTOOLS"); 371620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump const char* vs90comntools = getenv("VS90COMNTOOLS"); 372620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump const char* vs80comntools = getenv("VS80COMNTOOLS"); 373620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump const char* vscomntools = NULL; 37480f93d9fe82ebe7e58913646248240de838283beDouglas Gregor 375125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi // Try to find the version that we were compiled with 37680f93d9fe82ebe7e58913646248240de838283beDouglas Gregor if(false) {} 37780f93d9fe82ebe7e58913646248240de838283beDouglas Gregor #if (_MSC_VER >= 1600) // VC100 37880f93d9fe82ebe7e58913646248240de838283beDouglas Gregor else if(vs100comntools) { 37980f93d9fe82ebe7e58913646248240de838283beDouglas Gregor vscomntools = vs100comntools; 380620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump } 38180f93d9fe82ebe7e58913646248240de838283beDouglas Gregor #elif (_MSC_VER == 1500) // VC80 38280f93d9fe82ebe7e58913646248240de838283beDouglas Gregor else if(vs90comntools) { 38380f93d9fe82ebe7e58913646248240de838283beDouglas Gregor vscomntools = vs90comntools; 38480f93d9fe82ebe7e58913646248240de838283beDouglas Gregor } 38580f93d9fe82ebe7e58913646248240de838283beDouglas Gregor #elif (_MSC_VER == 1400) // VC80 38680f93d9fe82ebe7e58913646248240de838283beDouglas Gregor else if(vs80comntools) { 38780f93d9fe82ebe7e58913646248240de838283beDouglas Gregor vscomntools = vs80comntools; 38880f93d9fe82ebe7e58913646248240de838283beDouglas Gregor } 38980f93d9fe82ebe7e58913646248240de838283beDouglas Gregor #endif 39080f93d9fe82ebe7e58913646248240de838283beDouglas Gregor // Otherwise find any version we can 39180f93d9fe82ebe7e58913646248240de838283beDouglas Gregor else if (vs100comntools) 39280f93d9fe82ebe7e58913646248240de838283beDouglas Gregor vscomntools = vs100comntools; 393620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump else if (vs90comntools) 394620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump vscomntools = vs90comntools; 395620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump else if (vs80comntools) 396620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump vscomntools = vs80comntools; 39780f93d9fe82ebe7e58913646248240de838283beDouglas Gregor 398620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump if (vscomntools && *vscomntools) { 399cb421fa690da545b58a720abe5f1c49b166dbde7Dan Gohman char *p = const_cast<char *>(strstr(vscomntools, "\\Common7\\Tools")); 400620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump if (p) 401620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump *p = '\0'; 402620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump path = vscomntools; 403620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump return(true); 404620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump } 405620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump else 406620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump return(false); 407620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump } 408620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump return(false); 40943d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump} 4104d374d4a4832a01d5d3b75c59cb1567e60df41e7Sebastian Redl 41175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // Get Windows SDK installation directory. 4126cd5216bb61e6165d8f6e8fb781d45c035bd4e00Benjamin Kramerstatic bool getWindowsSDKDir(std::string &path) { 41375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson char windowsSDKInstallDir[256]; 41475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson // Try the Windows registry. 41575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson bool hasSDKDir = getSystemRegistryString( 41675ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION", 41775ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson "InstallationFolder", windowsSDKInstallDir, sizeof(windowsSDKInstallDir) - 1); 418125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi // If we have both vc80 and vc90, pick version we were compiled with. 41975ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson if (hasSDKDir && windowsSDKInstallDir[0]) { 42075ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson path = windowsSDKInstallDir; 42175ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson return(true); 42275ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson } 42375ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson return(false); 42475ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson} 42575ee3bd6e7ed2b4286d5e717ae7b94411f90b3b9John Thompson 42679bc57c074cb91f574fba19215f95b63dcf6b04bmike-mvoid InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, 42779bc57c074cb91f574fba19215f95b63dcf6b04bmike-m const HeaderSearchOptions &HSOpts) { 4288e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer llvm::Triple::OSType os = triple.getOS(); 4298e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer 4308e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer switch (os) { 431630766057eabe78f9bb2e0c0d023223fb8d0174eRoman Divacky case llvm::Triple::FreeBSD: 4328e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer case llvm::Triple::NetBSD: 4338e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer break; 4348e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer default: 4358e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer // FIXME: temporary hack: hard-coded paths. 4368e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer AddPath("/usr/local/include", System, true, false, false); 4378e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer break; 4388e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer } 43979bc57c074cb91f574fba19215f95b63dcf6b04bmike-m 44079bc57c074cb91f574fba19215f95b63dcf6b04bmike-m // Builtin includes use #include_next directives and should be positioned 44179bc57c074cb91f574fba19215f95b63dcf6b04bmike-m // just prior C include dirs. 44279bc57c074cb91f574fba19215f95b63dcf6b04bmike-m if (HSOpts.UseBuiltinIncludes) { 44379bc57c074cb91f574fba19215f95b63dcf6b04bmike-m // Ignore the sys root, we *always* look for clang headers relative to 44479bc57c074cb91f574fba19215f95b63dcf6b04bmike-m // supplied path. 44579bc57c074cb91f574fba19215f95b63dcf6b04bmike-m llvm::sys::Path P(HSOpts.ResourceDir); 44679bc57c074cb91f574fba19215f95b63dcf6b04bmike-m P.appendComponent("include"); 44779bc57c074cb91f574fba19215f95b63dcf6b04bmike-m AddPath(P.str(), System, false, false, false, /*IgnoreSysRoot=*/ true); 44879bc57c074cb91f574fba19215f95b63dcf6b04bmike-m } 44979bc57c074cb91f574fba19215f95b63dcf6b04bmike-m 45079bc57c074cb91f574fba19215f95b63dcf6b04bmike-m // Add dirs specified via 'configure --with-c-include-dirs'. 451c706468b1e00bab49ca92eb500a39657f530f828Daniel Dunbar llvm::StringRef CIncludeDirs(C_INCLUDE_DIRS); 452c706468b1e00bab49ca92eb500a39657f530f828Daniel Dunbar if (CIncludeDirs != "") { 453aadd7a48453b4f58bd8e1e9eb670918ee7d6a711Rafael Espindola llvm::SmallVector<llvm::StringRef, 5> dirs; 454aadd7a48453b4f58bd8e1e9eb670918ee7d6a711Rafael Espindola CIncludeDirs.split(dirs, ":"); 455aadd7a48453b4f58bd8e1e9eb670918ee7d6a711Rafael Espindola for (llvm::SmallVectorImpl<llvm::StringRef>::iterator i = dirs.begin(); 456aadd7a48453b4f58bd8e1e9eb670918ee7d6a711Rafael Espindola i != dirs.end(); 457125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi ++i) 458f0a2f51be576089e1a84cd677c09156dae067b6aRafael Espindola AddPath(*i, System, false, false, false); 459f0a2f51be576089e1a84cd677c09156dae067b6aRafael Espindola return; 460f0a2f51be576089e1a84cd677c09156dae067b6aRafael Espindola } 4618e50a96b387dca7525caa8a6add31420dd82a2cdBenjamin Kramer 46243d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump switch (os) { 463d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar case llvm::Triple::Win32: { 464d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar std::string VSDir; 465d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar std::string WindowsSDKDir; 466d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar if (getVisualStudioDir(VSDir)) { 467d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath(VSDir + "\\VC\\include", System, false, false, false); 468d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar if (getWindowsSDKDir(WindowsSDKDir)) 469d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath(WindowsSDKDir + "\\include", System, false, false, false); 470d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar else 471d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath(VSDir + "\\VC\\PlatformSDK\\Include", 472d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar System, false, false, false); 473d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar } else { 474d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar // Default install paths. 475d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath("C:/Program Files/Microsoft Visual Studio 10.0/VC/include", 476d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar System, false, false, false); 477d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath("C:/Program Files/Microsoft Visual Studio 9.0/VC/include", 478d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar System, false, false, false); 479d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath( 4809319f02dea2449caf5c7a0d07c596ca324e43574John Thompson "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include", 481d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar System, false, false, false); 482d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath("C:/Program Files/Microsoft Visual Studio 8/VC/include", 483d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar System, false, false, false); 484d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar AddPath( 4859319f02dea2449caf5c7a0d07c596ca324e43574John Thompson "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include", 486d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar System, false, false, false); 48743d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump } 48843d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump break; 489d11ee7f66213bc418df192b7724d3aed349a642cDaniel Dunbar } 49086ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner case llvm::Triple::Haiku: 49186ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/common/include", System, true, false, false); 49286ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os", System, true, false, false); 49386ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/app", System, true, false, false); 49486ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/arch", System, true, false, false); 49586ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/device", System, true, false, false); 49686ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/drivers", System, true, false, false); 497125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddPath("/boot/develop/headers/os/game", System, true, false, false); 49886ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/interface", System, true, false, false); 49986ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/kernel", System, true, false, false); 50086ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/locale", System, true, false, false); 50186ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/mail", System, true, false, false); 50286ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/media", System, true, false, false); 50386ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/midi", System, true, false, false); 50486ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/midi2", System, true, false, false); 50586ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/net", System, true, false, false); 50686ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/storage", System, true, false, false); 50786ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/support", System, true, false, false); 50886ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/translation", 50986ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 510125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddPath("/boot/develop/headers/os/add-ons/graphics", 51186ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 512125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddPath("/boot/develop/headers/os/add-ons/input_server", 51386ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 514125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddPath("/boot/develop/headers/os/add-ons/screen_saver", 51586ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 516125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddPath("/boot/develop/headers/os/add-ons/tracker", 51786ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 51886ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/be_apps/Deskbar", 51986ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 52086ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/be_apps/NetPositive", 52186ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 52286ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/os/be_apps/Tracker", 52386ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 52486ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/cpp", System, true, false, false); 525125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddPath("/boot/develop/headers/cpp/i586-pc-haiku", 52686ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner System, true, false, false); 52786ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/3rdparty", System, true, false, false); 52886ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/bsd", System, true, false, false); 52986ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/glibc", System, true, false, false); 53086ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers/posix", System, true, false, false); 53186ed3a326342fa2a8c9d9b5d1d7280c9bad2b007Chris Lattner AddPath("/boot/develop/headers", System, true, false, false); 532a7e6845660f91ec611427e1db842780e1ec12bdbEli Friedman break; 53332df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi case llvm::Triple::Cygwin: 53432df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi AddPath("/usr/include/w32api", System, true, false, false); 53532df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi break; 536620d57a293143e3f07d6e4f5ba50020a80f45564Mike Stump case llvm::Triple::MinGW32: 53743d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump AddPath("c:/mingw/include", System, true, false, false); 53843d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump break; 53943d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump default: 54043d8176d2e8e304b2d419fb0fe139cc07af80deaMike Stump break; 5410fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 542d3f88343af2dec3459493fafa22532317321eaf0John Thompson 543d3f88343af2dec3459493fafa22532317321eaf0John Thompson AddPath("/usr/include", System, false, false, false); 544e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola} 545e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola 5460e3cc05542e62fe89345ce94a73494525ee463e0Chris Lattnervoid InitHeaderSearch:: 5470e3cc05542e62fe89345ce94a73494525ee463e0Chris LattnerAddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { 548e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola llvm::Triple::OSType os = triple.getOS(); 549ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT); 550ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola if (CxxIncludeRoot != "") { 551ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH); 552ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola if (CxxIncludeArch == "") 553ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(), 5540e3cc05542e62fe89345ce94a73494525ee463e0Chris Lattner CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, 5550e3cc05542e62fe89345ce94a73494525ee463e0Chris Lattner triple); 556ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola else 557ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH, 5580e3cc05542e62fe89345ce94a73494525ee463e0Chris Lattner CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, 5590e3cc05542e62fe89345ce94a73494525ee463e0Chris Lattner triple); 560ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola return; 561ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola } 562e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // FIXME: temporary hack: hard-coded paths. 563e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola switch (os) { 564e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::Cygwin: 56532df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi // Cygwin-1.7 56632df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4"); 56732df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi // g++-4 / Cygwin-1.5 56832df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2"); 56932df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi // FIXME: Do we support g++-3.4.4? 57032df002017e3e8d86bfd3f7090b341d265676fc9NAKAMURA Takumi AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4"); 571e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 572e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::MinGW32: 57305c699e97aea64ee8cea1faaca900a39f977350cNAKAMURA Takumi // mingw-w64-20110207 5742df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("c:/MinGW/include/c++/4.5.3", CXXSystem, true, false, false); 5752df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("c:/MinGW/include/c++/4.5.3/x86_64-w64-mingw32", CXXSystem, true, 5762df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger false, false); 5772df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("c:/MinGW/include/c++/4.5.3/backward", CXXSystem, true, false, 5782df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger false); 57905c699e97aea64ee8cea1faaca900a39f977350cNAKAMURA Takumi // mingw-w64-20101129 5802df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("c:/MinGW/include/c++/4.5.2", CXXSystem, true, false, false); 5812df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("c:/MinGW/include/c++/4.5.2/x86_64-w64-mingw32", CXXSystem, true, 5822df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger false, false); 5832df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("c:/MinGW/include/c++/4.5.2/backward", CXXSystem, true, false, 5842df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger false); 585125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi // Try gcc 4.5.0 586125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0"); 587e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Try gcc 4.4.0 588e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0"); 589e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Try gcc 4.3.0 590e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0"); 591e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 592e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::Darwin: 593f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar switch (triple.getArch()) { 594f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar default: break; 595f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar 596125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi case llvm::Triple::ppc: 597582c30135dce1857db62e58b916ab0fa5edfb1d6Douglas Gregor case llvm::Triple::ppc64: 598616d4362f01a8f819f9351372c3c4368777d4480Douglas Gregor AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", 599125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi "powerpc-apple-darwin10", "", "ppc64", 600616d4362f01a8f819f9351372c3c4368777d4480Douglas Gregor triple); 601582c30135dce1857db62e58b916ab0fa5edfb1d6Douglas Gregor AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", 602125b4cb35536e45201f8f2cb19ee620e3ad67c49NAKAMURA Takumi "powerpc-apple-darwin10", "", "ppc64", 603582c30135dce1857db62e58b916ab0fa5edfb1d6Douglas Gregor triple); 604582c30135dce1857db62e58b916ab0fa5edfb1d6Douglas Gregor break; 605582c30135dce1857db62e58b916ab0fa5edfb1d6Douglas Gregor 606f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar case llvm::Triple::x86: 607f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar case llvm::Triple::x86_64: 608f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", 609f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar "i686-apple-darwin10", "", "x86_64", triple); 610f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", 611f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar "i686-apple-darwin8", "", "", triple); 612f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar break; 613f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar 614f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar case llvm::Triple::arm: 615f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar case llvm::Triple::thumb: 616f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", 617f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar "arm-apple-darwin10", "v7", "", triple); 618f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", 619f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar "arm-apple-darwin10", "v6", "", triple); 620f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar break; 621f2070b374c1d6fc72aa6bdb2f49c1efdc4f6d963Daniel Dunbar } 622e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 6237a7ca281bcf50b34de1ce067d3c55879b81722aeChris Lattner case llvm::Triple::DragonFly: 6242df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger AddPath("/usr/include/c++/4.1", CXXSystem, true, false, false); 6257a7ca281bcf50b34de1ce067d3c55879b81722aeChris Lattner break; 626e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::Linux: 627ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m //===------------------------------------------------------------------===// 628ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Debian based distros. 629ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y 630ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m //===------------------------------------------------------------------===// 631c12bbe5cbee8936204d286e17d8e0511dd67ddb4Rafael Espindola // Ubuntu 10.10 "Maverick Meerkat" -- gcc-4.4.5 632adafdbae908a8e798fa4940ed89f61597b3d7ca5Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", 633adafdbae908a8e798fa4940ed89f61597b3d7ca5Rafael Espindola "i686-linux-gnu", "", "64", triple); 634adafdbae908a8e798fa4940ed89f61597b3d7ca5Rafael Espindola // The rest of 10.10 is the same as previous versions. 635adafdbae908a8e798fa4940ed89f61597b3d7ca5Rafael Espindola 636ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 10.04 LTS "Lucid Lynx" -- gcc-4.4.3 637ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 9.10 "Karmic Koala" -- gcc-4.4.1 638ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Debian 6.0 "squeeze" -- gcc-4.4.2 639e69f047a6c882ce36bd260a8fed0ae31114a5a7eNick Lewycky AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", 640331e8010aed1c2175328ed470aea75e93ff70b32Torok Edwin "x86_64-linux-gnu", "32", "", triple); 641e69f047a6c882ce36bd260a8fed0ae31114a5a7eNick Lewycky AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", 642ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i486-linux-gnu", "", "64", triple); 643db0835552ff4b640bc908a50ccd075ab63cf6fffNick Lewycky AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", 644db0835552ff4b640bc908a50ccd075ab63cf6fffNick Lewycky "arm-linux-gnueabi", "", "", triple); 645ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 9.04 "Jaunty Jackalope" -- gcc-4.3.3 646ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 8.10 "Intrepid Ibex" -- gcc-4.3.2 647ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Debian 5.0 "lenny" -- gcc-4.3.2 648ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", 649ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "x86_64-linux-gnu", "32", "", triple); 650ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", 651ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i486-linux-gnu", "", "64", triple); 652e7d6c2cae6a9b9985db02cfc8bb4e7b714630ed5Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", 653e7d6c2cae6a9b9985db02cfc8bb4e7b714630ed5Rafael Espindola "arm-linux-gnueabi", "", "", triple); 654ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 8.04.4 LTS "Hardy Heron" -- gcc-4.2.4 655ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 8.04.[0-3] LTS "Hardy Heron" -- gcc-4.2.3 656ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", 657ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "x86_64-linux-gnu", "32", "", triple); 658ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", 659ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i486-linux-gnu", "", "64", triple); 660ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Ubuntu 7.10 "Gutsy Gibbon" -- gcc-4.1.3 661ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1", 662ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "x86_64-linux-gnu", "32", "", triple); 663ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1", 664ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i486-linux-gnu", "", "64", triple); 665189a14869a36ecf8bd5edc94255a34061044efe2Nuno Lopes 666ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m //===------------------------------------------------------------------===// 667ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Redhat based distros. 668ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m //===------------------------------------------------------------------===// 6696638b3a15edea25c4b1fdf8046e71d82683d8efaRafael Espindola // Fedora 14 6706638b3a15edea25c4b1fdf8046e71d82683d8efaRafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1", 6716638b3a15edea25c4b1fdf8046e71d82683d8efaRafael Espindola "x86_64-redhat-linux", "32", "", triple); 6726638b3a15edea25c4b1fdf8046e71d82683d8efaRafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1", 6736638b3a15edea25c4b1fdf8046e71d82683d8efaRafael Espindola "i686-redhat-linux", "", "", triple); 674ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Fedora 13 6754336e191cc52aa1ef72f9a542f5a6d5f9f02a825Chris Lattner AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4", 6764336e191cc52aa1ef72f9a542f5a6d5f9f02a825Chris Lattner "x86_64-redhat-linux", "32", "", triple); 6774336e191cc52aa1ef72f9a542f5a6d5f9f02a825Chris Lattner AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4", 6784336e191cc52aa1ef72f9a542f5a6d5f9f02a825Chris Lattner "i686-redhat-linux","", "", triple); 679ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Fedora 12 680ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", 6810720b5159010479c08f8264a8a209037ecf55922Chris Lattner "x86_64-redhat-linux", "32", "", triple); 682ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", 683ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i686-redhat-linux","", "", triple); 684ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Fedora 12 (pre-FEB-2010) 685ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2", 686ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "x86_64-redhat-linux", "32", "", triple); 687ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2", 688ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i686-redhat-linux","", "", triple); 689189a14869a36ecf8bd5edc94255a34061044efe2Nuno Lopes // Fedora 11 690189a14869a36ecf8bd5edc94255a34061044efe2Nuno Lopes AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1", 691ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "x86_64-redhat-linux", "32", "", triple); 692ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1", 693ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i586-redhat-linux","", "", triple); 694ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Fedora 10 695ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2", 696ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner "x86_64-redhat-linux", "32", "", triple); 697ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2", 698ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i386-redhat-linux","", "", triple); 699ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Fedora 9 700ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0", 701ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner "x86_64-redhat-linux", "32", "", triple); 702ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0", 703ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i386-redhat-linux", "", "", triple); 704ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Fedora 8 705ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2", 706ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "x86_64-redhat-linux", "", "", triple); 707ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2", 708ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i386-redhat-linux", "", "", triple); 709ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner 710ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m //===------------------------------------------------------------------===// 711ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner 712ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // Exherbo (2010-01-25) 713ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", 714ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "x86_64-pc-linux-gnu", "32", "", triple); 715ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3", 716ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m "i686-pc-linux-gnu", "", "", triple); 717ea00f847a0e1771b1fcfe683d3506940dc2de1ecChris Lattner 718e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // openSUSE 11.1 32 bit 719e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", 720ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i586-suse-linux", "", "", triple); 721e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // openSUSE 11.1 64 bit 722e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3", 723ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "x86_64-suse-linux", "32", "", triple); 724e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // openSUSE 11.2 725e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", 726ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i586-suse-linux", "", "", triple); 727e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4", 728ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "x86_64-suse-linux", "", "", triple); 7299d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola 7309d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola // openSUSE 11.4 7319d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", 7329d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola "i586-suse-linux", "", "", triple); 7339d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5", 7349d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola "x86_64-suse-linux", "", "", triple); 7359d2c06001b0c09fdb0f973cd6f8fa5555aea1b5fRafael Espindola 736e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Arch Linux 2008-06-24 737e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", 738ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i686-pc-linux-gnu", "", "", triple); 739e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1", 740ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "x86_64-unknown-linux-gnu", "", "", triple); 7410d155a5e1d6406d27df5779d0c9fb98d49a713a0Nuno Lopes // Gentoo x86 2010.0 stable 7420d155a5e1d6406d27df5779d0c9fb98d49a713a0Nuno Lopes AddGnuCPlusPlusIncludePaths( 7430d155a5e1d6406d27df5779d0c9fb98d49a713a0Nuno Lopes "/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4", 7440d155a5e1d6406d27df5779d0c9fb98d49a713a0Nuno Lopes "i686-pc-linux-gnu", "", "", triple); 745e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Gentoo x86 2009.1 stable 746e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths( 74740d1bb6383c14d5f8249d0640e8088a91b694c66John Thompson "/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4", 748ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i686-pc-linux-gnu", "", "", triple); 749e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Gentoo x86 2009.0 stable 750e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths( 75140d1bb6383c14d5f8249d0640e8088a91b694c66John Thompson "/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4", 752ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i686-pc-linux-gnu", "", "", triple); 753e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Gentoo x86 2008.0 stable 754e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths( 75540d1bb6383c14d5f8249d0640e8088a91b694c66John Thompson "/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4", 756ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i686-pc-linux-gnu", "", "", triple); 757fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth 758fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth // Gentoo amd64 gcc 4.4.5 759e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths( 760fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4", 761fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "x86_64-pc-linux-gnu", "32", "", triple); 762fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth // Gentoo amd64 gcc 4.4.4 76370d9d4196e6531926ca18b2ca850eb218041488dEric Christopher AddGnuCPlusPlusIncludePaths( 764fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4", 765fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "x86_64-pc-linux-gnu", "32", "", triple); 76670d9d4196e6531926ca18b2ca850eb218041488dEric Christopher // Gentoo amd64 gcc 4.4.3 76770d9d4196e6531926ca18b2ca850eb218041488dEric Christopher AddGnuCPlusPlusIncludePaths( 76870d9d4196e6531926ca18b2ca850eb218041488dEric Christopher "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4", 76970d9d4196e6531926ca18b2ca850eb218041488dEric Christopher "x86_64-pc-linux-gnu", "32", "", triple); 770fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth // Gentoo amd64 gcc 4.3.2 7718ad8a1cc1e39d70345d45ef1b8564ec6cbf49471Nico Weber AddGnuCPlusPlusIncludePaths( 772fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4", 773fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "x86_64-pc-linux-gnu", "", "", triple); 774fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth // Gentoo amd64 stable 775fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth AddGnuCPlusPlusIncludePaths( 776fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4", 777fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth "i686-pc-linux-gnu", "", "", triple); 7788ad8a1cc1e39d70345d45ef1b8564ec6cbf49471Nico Weber 7796693534adb31fdd13b1ee873df3e90c99f916ad5Nick Lewycky // Gentoo amd64 llvm-gcc trunk 7806693534adb31fdd13b1ee873df3e90c99f916ad5Nick Lewycky AddGnuCPlusPlusIncludePaths( 7816693534adb31fdd13b1ee873df3e90c99f916ad5Nick Lewycky "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1", 7826693534adb31fdd13b1ee873df3e90c99f916ad5Nick Lewycky "x86_64-pc-linux-gnu", "", "", triple); 783fbfdb202405df65e054db4ad2111393c1b581d2dChandler Carruth 784e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 785e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::FreeBSD: 786ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // FreeBSD 8.0 787ac78b7a7af0e67f2f4f45d9d94393c281ff4417bmike-m // FreeBSD 7.3 788afe859a9a6217f177daf42ebab294a90bfe8a6abNuno Lopes AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2", "", "", "", triple); 789e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 790ab079419ff2e52652be349e949202a2470f8d253Anton Korobeynikov case llvm::Triple::NetBSD: 791ab079419ff2e52652be349e949202a2470f8d253Anton Korobeynikov AddGnuCPlusPlusIncludePaths("/usr/include/g++", "", "", "", triple); 792ab079419ff2e52652be349e949202a2470f8d253Anton Korobeynikov break; 79395c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar case llvm::Triple::OpenBSD: { 79495c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar std::string t = triple.getTriple(); 79595c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar if (t.substr(0, 6) == "x86_64") 79695c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar t.replace(0, 6, "amd64"); 79795c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar AddGnuCPlusPlusIncludePaths("/usr/include/g++", 79895c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar t, "", "", triple); 79995c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar break; 80095c0457054518102af6250e718a13a5b2ee5dbeaDaniel Dunbar } 80138e317d6dce161b249508686cc67eb7176958762Chris Lattner case llvm::Triple::Minix: 80238e317d6dce161b249508686cc67eb7176958762Chris Lattner AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3", 80338e317d6dce161b249508686cc67eb7176958762Chris Lattner "", "", "", triple); 80438e317d6dce161b249508686cc67eb7176958762Chris Lattner break; 805e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::Solaris: 806e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // Solaris - Fall though.. 807e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola case llvm::Triple::AuroraUX: 808e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola // AuroraUX 809e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4", 810ab7ae95c46f288ac52974aa60334a9575f9a850cRafael Espindola "i386-pc-solaris2.11", "", "", triple); 811e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 812e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola default: 813e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola break; 814e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola } 815e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola} 816e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola 817e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindolavoid InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang, 8184c2bcad7b843c10fd4a2ffd43da40bfefb4dc8baDouglas Gregor const llvm::Triple &triple, 81979bc57c074cb91f574fba19215f95b63dcf6b04bmike-m const HeaderSearchOptions &HSOpts) { 8200bb208c91e91e2fe91e0f487b00ff4b5b30c8cc2Joerg Sonnenberger if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes) 8210bb208c91e91e2fe91e0f487b00ff4b5b30c8cc2Joerg Sonnenberger AddDefaultCPlusPlusIncludePaths(triple); 8226ec18a3f86c702004af66cce6ff979999a736898Rafael Espindola 82379bc57c074cb91f574fba19215f95b63dcf6b04bmike-m AddDefaultCIncludePaths(triple, HSOpts); 824e166582f8f36f4db8f4ea157538fab7fe6bf2658Daniel Dunbar 825e166582f8f36f4db8f4ea157538fab7fe6bf2658Daniel Dunbar // Add the default framework include paths on Darwin. 826e166582f8f36f4db8f4ea157538fab7fe6bf2658Daniel Dunbar if (triple.getOS() == llvm::Triple::Darwin) { 827e166582f8f36f4db8f4ea157538fab7fe6bf2658Daniel Dunbar AddPath("/System/Library/Frameworks", System, true, false, true); 828e166582f8f36f4db8f4ea157538fab7fe6bf2658Daniel Dunbar AddPath("/Library/Frameworks", System, true, false, true); 829e166582f8f36f4db8f4ea157538fab7fe6bf2658Daniel Dunbar } 830e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola} 831e4b255c80a786c6f16d3f0362ecb7e1b1e959f63Rafael Espindola 8320fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber/// RemoveDuplicates - If there are duplicate directory entries in the specified 8330fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber/// search list, remove the later (dead) ones. 8340fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weberstatic void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList, 8352df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger unsigned First, bool Verbose) { 8360fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenDirs; 8370fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenFrameworkDirs; 8380fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber llvm::SmallPtrSet<const HeaderMap *, 8> SeenHeaderMaps; 8392df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger for (unsigned i = First; i != SearchList.size(); ++i) { 8407a739401983eb9bc25c9b4b25177e116f5e5ba92Chris Lattner unsigned DirToRemove = i; 8411eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 84243eee07270bf1966ea7289310066aa670c4b647fChris Lattner const DirectoryLookup &CurEntry = SearchList[i]; 8431eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 84443eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (CurEntry.isNormalDir()) { 8450fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // If this isn't the first time we've seen this dir, remove it. 84643eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (SeenDirs.insert(CurEntry.getDir())) 8470fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber continue; 84843eee07270bf1966ea7289310066aa670c4b647fChris Lattner } else if (CurEntry.isFramework()) { 8490fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // If this isn't the first time we've seen this framework dir, remove it. 85043eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (SeenFrameworkDirs.insert(CurEntry.getFrameworkDir())) 8510fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber continue; 8520fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } else { 85343eee07270bf1966ea7289310066aa670c4b647fChris Lattner assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?"); 8540fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // If this isn't the first time we've seen this headermap, remove it. 85543eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (SeenHeaderMaps.insert(CurEntry.getHeaderMap())) 8560fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber continue; 85730f05b553db067c994966daca37e75324ee7b424Chris Lattner } 8581eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 85930f05b553db067c994966daca37e75324ee7b424Chris Lattner // If we have a normal #include dir/framework/headermap that is shadowed 86030f05b553db067c994966daca37e75324ee7b424Chris Lattner // later in the chain by a system include location, we actually want to 86130f05b553db067c994966daca37e75324ee7b424Chris Lattner // ignore the user's request and drop the user dir... keeping the system 86230f05b553db067c994966daca37e75324ee7b424Chris Lattner // dir. This is weird, but required to emulate GCC's search path correctly. 86330f05b553db067c994966daca37e75324ee7b424Chris Lattner // 86430f05b553db067c994966daca37e75324ee7b424Chris Lattner // Since dupes of system dirs are rare, just rescan to find the original 86530f05b553db067c994966daca37e75324ee7b424Chris Lattner // that we're nuking instead of using a DenseMap. 86643eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (CurEntry.getDirCharacteristic() != SrcMgr::C_User) { 86730f05b553db067c994966daca37e75324ee7b424Chris Lattner // Find the dir that this is the same of. 86830f05b553db067c994966daca37e75324ee7b424Chris Lattner unsigned FirstDir; 86930f05b553db067c994966daca37e75324ee7b424Chris Lattner for (FirstDir = 0; ; ++FirstDir) { 87030f05b553db067c994966daca37e75324ee7b424Chris Lattner assert(FirstDir != i && "Didn't find dupe?"); 8711eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 87243eee07270bf1966ea7289310066aa670c4b647fChris Lattner const DirectoryLookup &SearchEntry = SearchList[FirstDir]; 87343eee07270bf1966ea7289310066aa670c4b647fChris Lattner 87430f05b553db067c994966daca37e75324ee7b424Chris Lattner // If these are different lookup types, then they can't be the dupe. 87543eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (SearchEntry.getLookupType() != CurEntry.getLookupType()) 87630f05b553db067c994966daca37e75324ee7b424Chris Lattner continue; 8771eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 87830f05b553db067c994966daca37e75324ee7b424Chris Lattner bool isSame; 87943eee07270bf1966ea7289310066aa670c4b647fChris Lattner if (CurEntry.isNormalDir()) 88043eee07270bf1966ea7289310066aa670c4b647fChris Lattner isSame = SearchEntry.getDir() == CurEntry.getDir(); 88143eee07270bf1966ea7289310066aa670c4b647fChris Lattner else if (CurEntry.isFramework()) 88243eee07270bf1966ea7289310066aa670c4b647fChris Lattner isSame = SearchEntry.getFrameworkDir() == CurEntry.getFrameworkDir(); 88330f05b553db067c994966daca37e75324ee7b424Chris Lattner else { 88443eee07270bf1966ea7289310066aa670c4b647fChris Lattner assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?"); 88543eee07270bf1966ea7289310066aa670c4b647fChris Lattner isSame = SearchEntry.getHeaderMap() == CurEntry.getHeaderMap(); 88630f05b553db067c994966daca37e75324ee7b424Chris Lattner } 8871eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 88830f05b553db067c994966daca37e75324ee7b424Chris Lattner if (isSame) 88930f05b553db067c994966daca37e75324ee7b424Chris Lattner break; 89030f05b553db067c994966daca37e75324ee7b424Chris Lattner } 8911eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 89230f05b553db067c994966daca37e75324ee7b424Chris Lattner // If the first dir in the search path is a non-system dir, zap it 89330f05b553db067c994966daca37e75324ee7b424Chris Lattner // instead of the system one. 89430f05b553db067c994966daca37e75324ee7b424Chris Lattner if (SearchList[FirstDir].getDirCharacteristic() == SrcMgr::C_User) 89530f05b553db067c994966daca37e75324ee7b424Chris Lattner DirToRemove = FirstDir; 89630f05b553db067c994966daca37e75324ee7b424Chris Lattner } 89730f05b553db067c994966daca37e75324ee7b424Chris Lattner 89830f05b553db067c994966daca37e75324ee7b424Chris Lattner if (Verbose) { 899e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar llvm::errs() << "ignoring duplicate directory \"" 900e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar << CurEntry.getName() << "\"\n"; 90130f05b553db067c994966daca37e75324ee7b424Chris Lattner if (DirToRemove != i) 902e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar llvm::errs() << " as it is a non-system directory that duplicates " 903e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar << "a system directory\n"; 9040fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 9051eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 9067a739401983eb9bc25c9b4b25177e116f5e5ba92Chris Lattner // This is reached if the current entry is a duplicate. Remove the 9077a739401983eb9bc25c9b4b25177e116f5e5ba92Chris Lattner // DirToRemove (usually the current dir). 9087a739401983eb9bc25c9b4b25177e116f5e5ba92Chris Lattner SearchList.erase(SearchList.begin()+DirToRemove); 9090fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber --i; 9100fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 9110fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber} 9120fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 9130fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 9142df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenbergervoid InitHeaderSearch::Realize(const LangOptions &Lang) { 9150fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // Concatenate ANGLE+SYSTEM+AFTER chains together into SearchList. 9160fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber std::vector<DirectoryLookup> SearchList; 9172df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger SearchList.reserve(IncludePath.size()); 9181eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 9192df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger /* Quoted arguments go first. */ 9202df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger for (path_iterator it = IncludePath.begin(), ie = IncludePath.end(); 9212df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger it != ie; ++it) { 9222df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger if (it->first == Quoted) 9232df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger SearchList.push_back(it->second); 9242df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger } 9252df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger /* Deduplicate and remember index */ 9262df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger RemoveDuplicates(SearchList, 0, Verbose); 9272df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger unsigned quoted = SearchList.size(); 9282df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger 9292df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger for (path_iterator it = IncludePath.begin(), ie = IncludePath.end(); 9302df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger it != ie; ++it) { 9312df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger if (it->first == Angled) 9322df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger SearchList.push_back(it->second); 9332df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger } 9342df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger 9352df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger for (path_iterator it = IncludePath.begin(), ie = IncludePath.end(); 9362df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger it != ie; ++it) { 9372df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger if (it->first == System || (Lang.CPlusPlus && it->first == CXXSystem)) 9382df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger SearchList.push_back(it->second); 9392df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger } 9402df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger 9412df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger for (path_iterator it = IncludePath.begin(), ie = IncludePath.end(); 9422df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger it != ie; ++it) { 9432df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger if (it->first == After) 9442df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger SearchList.push_back(it->second); 9452df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger } 9461eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump 9472df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger RemoveDuplicates(SearchList, quoted, Verbose); 9480fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 9490fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber bool DontSearchCurDir = false; // TODO: set to true if -I- is set? 9502df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger Headers.SetSearchPaths(SearchList, quoted, DontSearchCurDir); 9510fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber 9520fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber // If verbose, print the list of directories that will be searched. 9530fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber if (Verbose) { 954e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar llvm::errs() << "#include \"...\" search starts here:\n"; 9550fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber for (unsigned i = 0, e = SearchList.size(); i != e; ++i) { 9562df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger if (i == quoted) 957e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar llvm::errs() << "#include <...> search starts here:\n"; 9580fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber const char *Name = SearchList[i].getName(); 9590fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber const char *Suffix; 9600fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber if (SearchList[i].isNormalDir()) 9610fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber Suffix = ""; 9620fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber else if (SearchList[i].isFramework()) 9630fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber Suffix = " (framework directory)"; 9640fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber else { 9650fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup"); 9660fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber Suffix = " (headermap)"; 9670fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 968e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar llvm::errs() << " " << Name << Suffix << "\n"; 9690fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 970e7cb7e4570842297f698bd7fd8d85520fc008acdDaniel Dunbar llvm::errs() << "End of search list.\n"; 9710fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber } 9720fca022d77b89100e746f4d659b84ed5b1ee0158Nico Weber} 97363c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar 9745814e657c9ad9ef6049a2a4af0d2aad248a8a15cDaniel Dunbarvoid clang::ApplyHeaderSearchOptions(HeaderSearch &HS, 9755814e657c9ad9ef6049a2a4af0d2aad248a8a15cDaniel Dunbar const HeaderSearchOptions &HSOpts, 9765814e657c9ad9ef6049a2a4af0d2aad248a8a15cDaniel Dunbar const LangOptions &Lang, 97763c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar const llvm::Triple &Triple) { 97863c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar InitHeaderSearch Init(HS, HSOpts.Verbose, HSOpts.Sysroot); 97963c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar 98063c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar // Add the user defined entries. 98163c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) { 98263c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i]; 9831b483e70ad3f670f6dd0bc62dbe0921a28195f24Daniel Dunbar Init.AddPath(E.Path, E.Group, false, E.IsUserSupplied, E.IsFramework, 98423637beead1fce7dac755890c9482bcdce538b87Chris Lattner !E.IsSysRootRelative); 98563c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar } 98663c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar 98763c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar // Add entries from CPATH and friends. 9889e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer Init.AddDelimitedPaths(HSOpts.EnvIncPath); 989c363cb1929c7908c8c8c4b77d025c2ccb09284aeDaniel Dunbar if (Lang.CPlusPlus && Lang.ObjC1) 9909e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer Init.AddDelimitedPaths(HSOpts.ObjCXXEnvIncPath); 991c363cb1929c7908c8c8c4b77d025c2ccb09284aeDaniel Dunbar else if (Lang.CPlusPlus) 9929e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer Init.AddDelimitedPaths(HSOpts.CXXEnvIncPath); 993c363cb1929c7908c8c8c4b77d025c2ccb09284aeDaniel Dunbar else if (Lang.ObjC1) 9949e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer Init.AddDelimitedPaths(HSOpts.ObjCEnvIncPath); 995c363cb1929c7908c8c8c4b77d025c2ccb09284aeDaniel Dunbar else 9969e9ddf6100fd50ca2f9f9d0106b856e20b43300fBenjamin Kramer Init.AddDelimitedPaths(HSOpts.CEnvIncPath); 99763c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar 998dd35ce9a783dea7e6660f9cb1d973742f3b3c73fDaniel Dunbar if (HSOpts.UseStandardIncludes) 99979bc57c074cb91f574fba19215f95b63dcf6b04bmike-m Init.AddDefaultSystemIncludePaths(Lang, Triple, HSOpts); 100063c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar 10012df6647847af283302834dadae5d9dcefa7e0ad4Joerg Sonnenberger Init.Realize(Lang); 100263c8b77334f90472260d2f48df2742ed5067261eDaniel Dunbar} 1003