1 //===--- InitHeaderSearch.cpp - Initialize header search paths ------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the InitHeaderSearch class.
12 //===----------------------------------------------------------------------===//
14 #ifdef HAVE_CLANG_CONFIG_H
15 # include "clang/Config/config.h"
18 #include "clang/Frontend/Utils.h"
19 #include "clang/Basic/FileManager.h"
20 #include "clang/Basic/LangOptions.h"
21 #include "clang/Basic/Version.h"
22 #include "clang/Frontend/HeaderSearchOptions.h"
23 #include "clang/Lex/HeaderSearch.h"
24 #include "llvm/ADT/SmallString.h"
25 #include "llvm/ADT/SmallPtrSet.h"
26 #include "llvm/ADT/SmallVector.h"
27 #include "llvm/ADT/StringExtras.h"
28 #include "llvm/ADT/Triple.h"
29 #include "llvm/ADT/Twine.h"
30 #include "llvm/Support/raw_ostream.h"
31 #include "llvm/Support/Path.h"
32 #include "llvm/Config/config.h"
34 #define WIN32_LEAN_AND_MEAN 1
40 using namespace clang;
41 using namespace clang::frontend;
45 /// InitHeaderSearch - This class makes it easier to set the search paths of
46 /// a HeaderSearch object. InitHeaderSearch stores several search path lists
47 /// internally, which can be sent to a HeaderSearch object in one swoop.
48 class InitHeaderSearch {
49 std::vector<std::pair<IncludeDirGroup, DirectoryLookup> > IncludePath;
50 typedef std::vector<std::pair<IncludeDirGroup,
51 DirectoryLookup> >::const_iterator path_iterator;
52 HeaderSearch &Headers;
54 std::string IncludeSysroot;
55 bool IsNotEmptyOrRoot;
59 InitHeaderSearch(HeaderSearch &HS, bool verbose, llvm::StringRef sysroot)
60 : Headers(HS), Verbose(verbose), IncludeSysroot(sysroot),
61 IsNotEmptyOrRoot(!(sysroot.empty() || sysroot == "/")) {
64 /// AddPath - Add the specified path to the specified group list.
65 void AddPath(const llvm::Twine &Path, IncludeDirGroup Group,
66 bool isCXXAware, bool isUserSupplied,
67 bool isFramework, bool IgnoreSysRoot = false);
69 /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu
71 void AddGnuCPlusPlusIncludePaths(llvm::StringRef Base,
72 llvm::StringRef ArchDir,
73 llvm::StringRef Dir32,
74 llvm::StringRef Dir64,
75 const llvm::Triple &triple);
77 /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW
79 void AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base,
81 llvm::StringRef Version);
83 /// AddMinGW64CXXPaths - Add the necessary paths to support
84 /// libstdc++ of x86_64-w64-mingw32 aka mingw-w64.
85 void AddMinGW64CXXPaths(llvm::StringRef Base,
86 llvm::StringRef Version);
88 /// AddDelimitedPaths - Add a list of paths delimited by the system PATH
89 /// separator. The processing follows that of the CPATH variable for gcc.
90 void AddDelimitedPaths(llvm::StringRef String);
92 // AddDefaultCIncludePaths - Add paths that should always be searched.
93 void AddDefaultCIncludePaths(const llvm::Triple &triple,
94 const HeaderSearchOptions &HSOpts);
96 // AddDefaultCPlusPlusIncludePaths - Add paths that should be searched when
98 void AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple,
99 const HeaderSearchOptions &HSOpts);
101 /// AddDefaultSystemIncludePaths - Adds the default system include paths so
102 /// that e.g. stdio.h is found.
103 void AddDefaultSystemIncludePaths(const LangOptions &Lang,
104 const llvm::Triple &triple,
105 const HeaderSearchOptions &HSOpts);
107 /// Realize - Merges all search path lists into one list and send it to
109 void Realize(const LangOptions &Lang);
112 } // end anonymous namespace.
114 void InitHeaderSearch::AddPath(const llvm::Twine &Path,
115 IncludeDirGroup Group, bool isCXXAware,
116 bool isUserSupplied, bool isFramework,
117 bool IgnoreSysRoot) {
118 assert(!Path.isTriviallyEmpty() && "can't handle empty path here");
119 FileManager &FM = Headers.getFileMgr();
121 // Compute the actual path, taking into consideration -isysroot.
122 llvm::SmallString<256> MappedPathStorage;
123 llvm::StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
126 if ((Group == System || Group == CXXSystem) && !IgnoreSysRoot &&
128 !MappedPathStr.empty() &&
129 llvm::sys::path::is_separator(MappedPathStr[0]) &&
131 llvm::sys::path::is_absolute(MappedPathStr) &&
134 MappedPathStorage.clear();
136 (IncludeSysroot + Path).toStringRef(MappedPathStorage);
139 // Compute the DirectoryLookup type.
140 SrcMgr::CharacteristicKind Type;
141 if (Group == Quoted || Group == Angled)
142 Type = SrcMgr::C_User;
144 Type = SrcMgr::C_System;
146 Type = SrcMgr::C_ExternCSystem;
149 // If the directory exists, add it.
150 if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr)) {
151 IncludePath.push_back(std::make_pair(Group, DirectoryLookup(DE, Type,
152 isUserSupplied, isFramework)));
156 // Check to see if this is an apple-style headermap (which are not allowed to
159 if (const FileEntry *FE = FM.getFile(MappedPathStr)) {
160 if (const HeaderMap *HM = Headers.CreateHeaderMap(FE)) {
161 // It is a headermap, add it to the search path.
162 IncludePath.push_back(std::make_pair(Group, DirectoryLookup(HM, Type,
170 llvm::errs() << "ignoring nonexistent directory \""
171 << MappedPathStr << "\"\n";
175 void InitHeaderSearch::AddDelimitedPaths(llvm::StringRef at) {
176 if (at.empty()) // Empty string should not add '.' path.
179 llvm::StringRef::size_type delim;
180 while ((delim = at.find(llvm::sys::PathSeparator)) != llvm::StringRef::npos) {
182 AddPath(".", Angled, false, true, false);
184 AddPath(at.substr(0, delim), Angled, false, true, false);
185 at = at.substr(delim + 1);
189 AddPath(".", Angled, false, true, false);
191 AddPath(at, Angled, false, true, false);
194 void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(llvm::StringRef Base,
195 llvm::StringRef ArchDir,
196 llvm::StringRef Dir32,
197 llvm::StringRef Dir64,
198 const llvm::Triple &triple) {
200 AddPath(Base, CXXSystem, true, false, false);
202 // Add the multilib dirs
203 llvm::Triple::ArchType arch = triple.getArch();
204 bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
206 AddPath(Base + "/" + ArchDir + "/" + Dir64, CXXSystem, true, false, false);
208 AddPath(Base + "/" + ArchDir + "/" + Dir32, CXXSystem, true, false, false);
210 // Add the backward dir
211 AddPath(Base + "/backward", CXXSystem, true, false, false);
214 void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(llvm::StringRef Base,
215 llvm::StringRef Arch,
216 llvm::StringRef Version) {
217 AddPath(Base + "/" + Arch + "/" + Version + "/include/c++",
218 CXXSystem, true, false, false);
219 AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/" + Arch,
220 CXXSystem, true, false, false);
221 AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/backward",
222 CXXSystem, true, false, false);
225 void InitHeaderSearch::AddMinGW64CXXPaths(llvm::StringRef Base,
226 llvm::StringRef Version) {
227 // Assumes Base is HeaderSearchOpts' ResourceDir
228 AddPath(Base + "/../../../include/c++/" + Version,
229 CXXSystem, true, false, false);
230 AddPath(Base + "/../../../include/c++/" + Version + "/x86_64-w64-mingw32",
231 CXXSystem, true, false, false);
232 AddPath(Base + "/../../../include/c++/" + Version + "/i686-w64-mingw32",
233 CXXSystem, true, false, false);
234 AddPath(Base + "/../../../include/c++/" + Version + "/backward",
235 CXXSystem, true, false, false);
238 // FIXME: This probably should goto to some platform utils place.
241 // Read registry string.
242 // This also supports a means to look for high-versioned keys by use
243 // of a $VERSION placeholder in the key path.
244 // $VERSION in the key path is a placeholder for the version number,
245 // causing the highest value path to be searched for and used.
246 // I.e. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION".
247 // There can be additional characters in the component. Only the numberic
248 // characters are compared.
249 static bool getSystemRegistryString(const char *keyPath, const char *valueName,
250 char *value, size_t maxLength) {
251 HKEY hRootKey = NULL;
253 const char* subKey = NULL;
255 DWORD valueSize = maxLength - 1;
257 bool returnValue = false;
259 if (strncmp(keyPath, "HKEY_CLASSES_ROOT\\", 18) == 0) {
260 hRootKey = HKEY_CLASSES_ROOT;
261 subKey = keyPath + 18;
262 } else if (strncmp(keyPath, "HKEY_USERS\\", 11) == 0) {
263 hRootKey = HKEY_USERS;
264 subKey = keyPath + 11;
265 } else if (strncmp(keyPath, "HKEY_LOCAL_MACHINE\\", 19) == 0) {
266 hRootKey = HKEY_LOCAL_MACHINE;
267 subKey = keyPath + 19;
268 } else if (strncmp(keyPath, "HKEY_CURRENT_USER\\", 18) == 0) {
269 hRootKey = HKEY_CURRENT_USER;
270 subKey = keyPath + 18;
275 const char *placeHolder = strstr(subKey, "$VERSION");
278 // If we have a $VERSION placeholder, do the highest-version search.
280 const char *keyEnd = placeHolder - 1;
281 const char *nextKey = placeHolder;
282 // Find end of previous key.
283 while ((keyEnd > subKey) && (*keyEnd != '\\'))
285 // Find end of key containing $VERSION.
286 while (*nextKey && (*nextKey != '\\'))
288 size_t partialKeyLength = keyEnd - subKey;
289 char partialKey[256];
290 if (partialKeyLength > sizeof(partialKey))
291 partialKeyLength = sizeof(partialKey);
292 strncpy(partialKey, subKey, partialKeyLength);
293 partialKey[partialKeyLength] = '\0';
295 lResult = RegOpenKeyEx(hRootKey, partialKey, 0, KEY_READ, &hTopKey);
296 if (lResult == ERROR_SUCCESS) {
299 double bestValue = 0.0;
300 DWORD index, size = sizeof(keyName) - 1;
301 for (index = 0; RegEnumKeyEx(hTopKey, index, keyName, &size, NULL,
302 NULL, NULL, NULL) == ERROR_SUCCESS; index++) {
303 const char *sp = keyName;
304 while (*sp && !isdigit(*sp))
308 const char *ep = sp + 1;
309 while (*ep && (isdigit(*ep) || (*ep == '.')))
312 strncpy(numBuf, sp, sizeof(numBuf) - 1);
313 numBuf[sizeof(numBuf) - 1] = '\0';
314 double value = strtod(numBuf, NULL);
315 if (value > bestValue) {
316 bestIndex = (int)index;
318 strcpy(bestName, keyName);
320 size = sizeof(keyName) - 1;
322 // If we found the highest versioned key, open the key and get the value.
323 if (bestIndex != -1) {
324 // Append rest of key.
325 strncat(bestName, nextKey, sizeof(bestName) - 1);
326 bestName[sizeof(bestName) - 1] = '\0';
327 // Open the chosen key path remainder.
328 lResult = RegOpenKeyEx(hTopKey, bestName, 0, KEY_READ, &hKey);
329 if (lResult == ERROR_SUCCESS) {
330 lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
331 (LPBYTE)value, &valueSize);
332 if (lResult == ERROR_SUCCESS)
337 RegCloseKey(hTopKey);
341 lResult = RegOpenKeyEx(hRootKey, subKey, 0, KEY_READ, &hKey);
342 if (lResult == ERROR_SUCCESS) {
343 lResult = RegQueryValueEx(hKey, valueName, NULL, &valueType,
344 (LPBYTE)value, &valueSize);
345 if (lResult == ERROR_SUCCESS)
353 // Read registry string.
354 static bool getSystemRegistryString(const char*, const char*, char*, size_t) {
359 // Get Visual Studio installation directory.
360 static bool getVisualStudioDir(std::string &path) {
361 // First check the environment variables that vsvars32.bat sets.
362 const char* vcinstalldir = getenv("VCINSTALLDIR");
364 char *p = const_cast<char *>(strstr(vcinstalldir, "\\VC"));
371 char vsIDEInstallDir[256];
372 char vsExpressIDEInstallDir[256];
373 // Then try the windows registry.
374 bool hasVCDir = getSystemRegistryString(
375 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\$VERSION",
376 "InstallDir", vsIDEInstallDir, sizeof(vsIDEInstallDir) - 1);
377 bool hasVCExpressDir = getSystemRegistryString(
378 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\$VERSION",
379 "InstallDir", vsExpressIDEInstallDir, sizeof(vsExpressIDEInstallDir) - 1);
380 // If we have both vc80 and vc90, pick version we were compiled with.
381 if (hasVCDir && vsIDEInstallDir[0]) {
382 char *p = (char*)strstr(vsIDEInstallDir, "\\Common7\\IDE");
385 path = vsIDEInstallDir;
389 if (hasVCExpressDir && vsExpressIDEInstallDir[0]) {
390 char *p = (char*)strstr(vsExpressIDEInstallDir, "\\Common7\\IDE");
393 path = vsExpressIDEInstallDir;
397 // Try the environment.
398 const char *vs100comntools = getenv("VS100COMNTOOLS");
399 const char *vs90comntools = getenv("VS90COMNTOOLS");
400 const char *vs80comntools = getenv("VS80COMNTOOLS");
401 const char *vscomntools = NULL;
403 // Try to find the version that we were compiled with
405 #if (_MSC_VER >= 1600) // VC100
406 else if(vs100comntools) {
407 vscomntools = vs100comntools;
409 #elif (_MSC_VER == 1500) // VC80
410 else if(vs90comntools) {
411 vscomntools = vs90comntools;
413 #elif (_MSC_VER == 1400) // VC80
414 else if(vs80comntools) {
415 vscomntools = vs80comntools;
418 // Otherwise find any version we can
419 else if (vs100comntools)
420 vscomntools = vs100comntools;
421 else if (vs90comntools)
422 vscomntools = vs90comntools;
423 else if (vs80comntools)
424 vscomntools = vs80comntools;
426 if (vscomntools && *vscomntools) {
427 const char *p = strstr(vscomntools, "\\Common7\\Tools");
428 path = p ? std::string(vscomntools, p) : vscomntools;
434 // Get Windows SDK installation directory.
435 static bool getWindowsSDKDir(std::string &path) {
436 char windowsSDKInstallDir[256];
437 // Try the Windows registry.
438 bool hasSDKDir = getSystemRegistryString(
439 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION",
440 "InstallationFolder",
441 windowsSDKInstallDir,
442 sizeof(windowsSDKInstallDir) - 1);
443 // If we have both vc80 and vc90, pick version we were compiled with.
444 if (hasSDKDir && windowsSDKInstallDir[0]) {
445 path = windowsSDKInstallDir;
451 void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
452 const HeaderSearchOptions &HSOpts) {
453 llvm::Triple::OSType os = triple.getOS();
456 case llvm::Triple::FreeBSD:
457 case llvm::Triple::NetBSD:
460 // FIXME: temporary hack: hard-coded paths.
461 AddPath("/usr/local/include", System, true, false, false);
465 // Builtin includes use #include_next directives and should be positioned
466 // just prior C include dirs.
467 if (HSOpts.UseBuiltinIncludes) {
468 // Ignore the sys root, we *always* look for clang headers relative to
470 llvm::sys::Path P(HSOpts.ResourceDir);
471 P.appendComponent("include");
472 AddPath(P.str(), System, false, false, false, /*IgnoreSysRoot=*/ true);
475 // Add dirs specified via 'configure --with-c-include-dirs'.
476 llvm::StringRef CIncludeDirs(C_INCLUDE_DIRS);
477 if (CIncludeDirs != "") {
478 llvm::SmallVector<llvm::StringRef, 5> dirs;
479 CIncludeDirs.split(dirs, ":");
480 for (llvm::SmallVectorImpl<llvm::StringRef>::iterator i = dirs.begin();
483 AddPath(*i, System, false, false, false);
488 case llvm::Triple::Win32: {
490 std::string WindowsSDKDir;
491 if (getVisualStudioDir(VSDir)) {
492 AddPath(VSDir + "\\VC\\include", System, false, false, false);
493 if (getWindowsSDKDir(WindowsSDKDir))
494 AddPath(WindowsSDKDir + "\\include", System, false, false, false);
496 AddPath(VSDir + "\\VC\\PlatformSDK\\Include",
497 System, false, false, false);
499 // Default install paths.
500 AddPath("C:/Program Files/Microsoft Visual Studio 10.0/VC/include",
501 System, false, false, false);
502 AddPath("C:/Program Files/Microsoft Visual Studio 9.0/VC/include",
503 System, false, false, false);
505 "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include",
506 System, false, false, false);
507 AddPath("C:/Program Files/Microsoft Visual Studio 8/VC/include",
508 System, false, false, false);
510 "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include",
511 System, false, false, false);
515 case llvm::Triple::Haiku:
516 AddPath("/boot/common/include", System, true, false, false);
517 AddPath("/boot/develop/headers/os", System, true, false, false);
518 AddPath("/boot/develop/headers/os/app", System, true, false, false);
519 AddPath("/boot/develop/headers/os/arch", System, true, false, false);
520 AddPath("/boot/develop/headers/os/device", System, true, false, false);
521 AddPath("/boot/develop/headers/os/drivers", System, true, false, false);
522 AddPath("/boot/develop/headers/os/game", System, true, false, false);
523 AddPath("/boot/develop/headers/os/interface", System, true, false, false);
524 AddPath("/boot/develop/headers/os/kernel", System, true, false, false);
525 AddPath("/boot/develop/headers/os/locale", System, true, false, false);
526 AddPath("/boot/develop/headers/os/mail", System, true, false, false);
527 AddPath("/boot/develop/headers/os/media", System, true, false, false);
528 AddPath("/boot/develop/headers/os/midi", System, true, false, false);
529 AddPath("/boot/develop/headers/os/midi2", System, true, false, false);
530 AddPath("/boot/develop/headers/os/net", System, true, false, false);
531 AddPath("/boot/develop/headers/os/storage", System, true, false, false);
532 AddPath("/boot/develop/headers/os/support", System, true, false, false);
533 AddPath("/boot/develop/headers/os/translation",
534 System, true, false, false);
535 AddPath("/boot/develop/headers/os/add-ons/graphics",
536 System, true, false, false);
537 AddPath("/boot/develop/headers/os/add-ons/input_server",
538 System, true, false, false);
539 AddPath("/boot/develop/headers/os/add-ons/screen_saver",
540 System, true, false, false);
541 AddPath("/boot/develop/headers/os/add-ons/tracker",
542 System, true, false, false);
543 AddPath("/boot/develop/headers/os/be_apps/Deskbar",
544 System, true, false, false);
545 AddPath("/boot/develop/headers/os/be_apps/NetPositive",
546 System, true, false, false);
547 AddPath("/boot/develop/headers/os/be_apps/Tracker",
548 System, true, false, false);
549 AddPath("/boot/develop/headers/cpp", System, true, false, false);
550 AddPath("/boot/develop/headers/cpp/i586-pc-haiku",
551 System, true, false, false);
552 AddPath("/boot/develop/headers/3rdparty", System, true, false, false);
553 AddPath("/boot/develop/headers/bsd", System, true, false, false);
554 AddPath("/boot/develop/headers/glibc", System, true, false, false);
555 AddPath("/boot/develop/headers/posix", System, true, false, false);
556 AddPath("/boot/develop/headers", System, true, false, false);
558 case llvm::Triple::RTEMS:
560 case llvm::Triple::Cygwin:
561 AddPath("/usr/include/w32api", System, true, false, false);
563 case llvm::Triple::MinGW32: {
564 // mingw-w64 crt include paths
565 llvm::sys::Path P(HSOpts.ResourceDir);
566 P.appendComponent("../../../i686-w64-mingw32/include"); // <sysroot>/i686-w64-mingw32/include
567 AddPath(P.str(), System, true, false, false);
568 P = llvm::sys::Path(HSOpts.ResourceDir);
569 P.appendComponent("../../../x86_64-w64-mingw32/include"); // <sysroot>/x86_64-w64-mingw32/include
570 AddPath(P.str(), System, true, false, false);
571 // mingw.org crt include paths
572 P = llvm::sys::Path(HSOpts.ResourceDir);
573 P.appendComponent("../../../include"); // <sysroot>/include
574 AddPath(P.str(), System, true, false, false);
575 AddPath("/mingw/include", System, true, false, false);
576 AddPath("c:/mingw/include", System, true, false, false);
579 case llvm::Triple::FreeBSD:
580 AddPath(CLANG_PREFIX "/usr/include/clang/" CLANG_VERSION_STRING,
581 System, false, false, false);
584 case llvm::Triple::Linux:
585 // Generic Debian multiarch support:
586 if (triple.getArch() == llvm::Triple::x86_64) {
587 AddPath("/usr/include/x86_64-linux-gnu", System, false, false, false);
588 AddPath("/usr/include/i686-linux-gnu/64", System, false, false, false);
589 AddPath("/usr/include/i486-linux-gnu/64", System, false, false, false);
590 } else if (triple.getArch() == llvm::Triple::x86) {
591 AddPath("/usr/include/x86_64-linux-gnu/32", System, false, false, false);
592 AddPath("/usr/include/i686-linux-gnu", System, false, false, false);
593 AddPath("/usr/include/i486-linux-gnu", System, false, false, false);
594 } else if (triple.getArch() == llvm::Triple::arm) {
595 AddPath("/usr/include/arm-linux-gnueabi", System, false, false, false);
601 if ( os != llvm::Triple::RTEMS )
602 AddPath(CLANG_PREFIX "/usr/include", System, false, false, false);
605 void InitHeaderSearch::
606 AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) {
607 llvm::Triple::OSType os = triple.getOS();
608 llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
609 if (CxxIncludeRoot != "") {
610 llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH);
611 if (CxxIncludeArch == "")
612 AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(),
613 CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
616 AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH,
617 CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
621 // FIXME: temporary hack: hard-coded paths.
623 if (triple.isOSDarwin()) {
624 switch (triple.getArch()) {
627 case llvm::Triple::ppc:
628 case llvm::Triple::ppc64:
629 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
630 "powerpc-apple-darwin10", "", "ppc64",
632 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
633 "powerpc-apple-darwin10", "", "ppc64",
637 case llvm::Triple::x86:
638 case llvm::Triple::x86_64:
639 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
640 "i686-apple-darwin10", "", "x86_64", triple);
641 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
642 "i686-apple-darwin8", "", "", triple);
645 case llvm::Triple::arm:
646 case llvm::Triple::thumb:
647 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
648 "arm-apple-darwin10", "v7", "", triple);
649 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
650 "arm-apple-darwin10", "v6", "", triple);
657 case llvm::Triple::Cygwin:
659 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
660 // g++-4 / Cygwin-1.5
661 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
662 // FIXME: Do we support g++-3.4.4?
663 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
665 case llvm::Triple::MinGW32:
666 // mingw-w64 C++ include paths (i686-w64-mingw32 and x86_64-w64-mingw32)
667 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.0");
668 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.1");
669 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.2");
670 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.3");
671 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.0");
672 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.1");
673 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.2");
674 AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.0");
675 // mingw.org C++ include paths
676 AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2"); //MSYS
677 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0");
678 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
679 AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");
681 case llvm::Triple::DragonFly:
682 AddPath("/usr/include/c++/4.1", CXXSystem, true, false, false);
684 case llvm::Triple::Linux:
685 //===------------------------------------------------------------------===//
686 // Debian based distros.
687 // Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y
688 //===------------------------------------------------------------------===//
690 // Ubuntu 11.11 "Oneiric Ocelot" -- gcc-4.6.0
691 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
692 "x86_64-linux-gnu", "32", "", triple);
693 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
694 "i686-linux-gnu", "", "64", triple);
695 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
696 "i486-linux-gnu", "", "64", triple);
697 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
698 "arm-linux-gnueabi", "", "", triple);
700 // Ubuntu 11.04 "Natty Narwhal" -- gcc-4.5.2
701 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
702 "x86_64-linux-gnu", "32", "", triple);
703 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
704 "i686-linux-gnu", "", "64", triple);
705 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
706 "i486-linux-gnu", "", "64", triple);
707 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
708 "arm-linux-gnueabi", "", "", triple);
710 // Ubuntu 10.10 "Maverick Meerkat" -- gcc-4.4.5
711 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
712 "i686-linux-gnu", "", "64", triple);
713 // The rest of 10.10 is the same as previous versions.
715 // Ubuntu 10.04 LTS "Lucid Lynx" -- gcc-4.4.3
716 // Ubuntu 9.10 "Karmic Koala" -- gcc-4.4.1
717 // Debian 6.0 "squeeze" -- gcc-4.4.2
718 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
719 "x86_64-linux-gnu", "32", "", triple);
720 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
721 "i486-linux-gnu", "", "64", triple);
722 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
723 "arm-linux-gnueabi", "", "", triple);
724 // Ubuntu 9.04 "Jaunty Jackalope" -- gcc-4.3.3
725 // Ubuntu 8.10 "Intrepid Ibex" -- gcc-4.3.2
726 // Debian 5.0 "lenny" -- gcc-4.3.2
727 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
728 "x86_64-linux-gnu", "32", "", triple);
729 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
730 "i486-linux-gnu", "", "64", triple);
731 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
732 "arm-linux-gnueabi", "", "", triple);
733 // Ubuntu 8.04.4 LTS "Hardy Heron" -- gcc-4.2.4
734 // Ubuntu 8.04.[0-3] LTS "Hardy Heron" -- gcc-4.2.3
735 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2",
736 "x86_64-linux-gnu", "32", "", triple);
737 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2",
738 "i486-linux-gnu", "", "64", triple);
739 // Ubuntu 7.10 "Gutsy Gibbon" -- gcc-4.1.3
740 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1",
741 "x86_64-linux-gnu", "32", "", triple);
742 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1",
743 "i486-linux-gnu", "", "64", triple);
745 //===------------------------------------------------------------------===//
746 // Redhat based distros.
747 //===------------------------------------------------------------------===//
749 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
750 "x86_64-redhat-linux", "32", "", triple);
751 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
752 "i686-redhat-linux", "", "", triple);
754 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1",
755 "x86_64-redhat-linux", "32", "", triple);
756 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5.1",
757 "i686-redhat-linux", "", "", triple);
759 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
760 "x86_64-redhat-linux6E", "32", "", triple);
762 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
763 "x86_64-redhat-linux", "32", "", triple);
764 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.4",
765 "i686-redhat-linux","", "", triple);
767 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
768 "x86_64-redhat-linux", "32", "", triple);
769 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
770 "i686-redhat-linux","", "", triple);
771 // Fedora 12 (pre-FEB-2010)
772 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
773 "x86_64-redhat-linux", "32", "", triple);
774 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
775 "i686-redhat-linux","", "", triple);
777 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
778 "x86_64-redhat-linux", "32", "", triple);
779 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
780 "i586-redhat-linux","", "", triple);
782 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
783 "x86_64-redhat-linux", "32", "", triple);
784 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
785 "i386-redhat-linux","", "", triple);
787 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
788 "x86_64-redhat-linux", "32", "", triple);
789 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
790 "i386-redhat-linux", "", "", triple);
792 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
793 "x86_64-redhat-linux", "", "", triple);
794 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
795 "i386-redhat-linux", "", "", triple);
798 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.1",
799 "x86_64-redhat-linux", "32", "", triple);
800 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.1",
801 "i386-redhat-linux", "", "", triple);
804 //===------------------------------------------------------------------===//
806 // Exherbo (2010-01-25)
807 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
808 "x86_64-pc-linux-gnu", "32", "", triple);
809 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
810 "i686-pc-linux-gnu", "", "", triple);
812 // openSUSE 11.1 32 bit
813 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
814 "i586-suse-linux", "", "", triple);
815 // openSUSE 11.1 64 bit
816 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
817 "x86_64-suse-linux", "32", "", triple);
819 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
820 "i586-suse-linux", "", "", triple);
821 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
822 "x86_64-suse-linux", "", "", triple);
825 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
826 "i586-suse-linux", "", "", triple);
827 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
828 "x86_64-suse-linux", "", "", triple);
831 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
832 "i586-suse-linux", "", "", triple);
833 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
834 "x86_64-suse-linux", "", "", triple);
835 // Arch Linux 2008-06-24
836 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
837 "i686-pc-linux-gnu", "", "", triple);
838 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.1",
839 "x86_64-unknown-linux-gnu", "", "", triple);
841 // Arch Linux gcc 4.6
842 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1",
843 "i686-pc-linux-gnu", "", "", triple);
844 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.1",
845 "x86_64-unknown-linux-gnu", "", "", triple);
846 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
847 "i686-pc-linux-gnu", "", "", triple);
848 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6.0",
849 "x86_64-unknown-linux-gnu", "", "", triple);
851 // Gentoo x86 gcc 4.5.2
852 AddGnuCPlusPlusIncludePaths(
853 "/usr/lib/gcc/i686-pc-linux-gnu/4.5.2/include/g++-v4",
854 "i686-pc-linux-gnu", "", "", triple);
855 // Gentoo x86 gcc 4.4.5
856 AddGnuCPlusPlusIncludePaths(
857 "/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/include/g++-v4",
858 "i686-pc-linux-gnu", "", "", triple);
859 // Gentoo x86 gcc 4.4.4
860 AddGnuCPlusPlusIncludePaths(
861 "/usr/lib/gcc/i686-pc-linux-gnu/4.4.4/include/g++-v4",
862 "i686-pc-linux-gnu", "", "", triple);
863 // Gentoo x86 2010.0 stable
864 AddGnuCPlusPlusIncludePaths(
865 "/usr/lib/gcc/i686-pc-linux-gnu/4.4.3/include/g++-v4",
866 "i686-pc-linux-gnu", "", "", triple);
867 // Gentoo x86 2009.1 stable
868 AddGnuCPlusPlusIncludePaths(
869 "/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/include/g++-v4",
870 "i686-pc-linux-gnu", "", "", triple);
871 // Gentoo x86 2009.0 stable
872 AddGnuCPlusPlusIncludePaths(
873 "/usr/lib/gcc/i686-pc-linux-gnu/4.3.2/include/g++-v4",
874 "i686-pc-linux-gnu", "", "", triple);
875 // Gentoo x86 2008.0 stable
876 AddGnuCPlusPlusIncludePaths(
877 "/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4",
878 "i686-pc-linux-gnu", "", "", triple);
879 // Gentoo x86 llvm-gcc trunk
880 AddGnuCPlusPlusIncludePaths(
881 "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1",
882 "i686-pc-linux-gnu", "", "", triple);
884 // Gentoo amd64 gcc 4.5.2
885 AddGnuCPlusPlusIncludePaths(
886 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4",
887 "x86_64-pc-linux-gnu", "32", "", triple);
888 // Gentoo amd64 gcc 4.4.5
889 AddGnuCPlusPlusIncludePaths(
890 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/include/g++-v4",
891 "x86_64-pc-linux-gnu", "32", "", triple);
892 // Gentoo amd64 gcc 4.4.4
893 AddGnuCPlusPlusIncludePaths(
894 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.4/include/g++-v4",
895 "x86_64-pc-linux-gnu", "32", "", triple);
896 // Gentoo amd64 gcc 4.4.3
897 AddGnuCPlusPlusIncludePaths(
898 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.3/include/g++-v4",
899 "x86_64-pc-linux-gnu", "32", "", triple);
900 // Gentoo amd64 gcc 4.3.2
901 AddGnuCPlusPlusIncludePaths(
902 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/include/g++-v4",
903 "x86_64-pc-linux-gnu", "", "", triple);
904 // Gentoo amd64 stable
905 AddGnuCPlusPlusIncludePaths(
906 "/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4",
907 "x86_64-pc-linux-gnu", "", "", triple);
909 // Gentoo amd64 llvm-gcc trunk
910 AddGnuCPlusPlusIncludePaths(
911 "/usr/lib/llvm-gcc-4.2-9999/include/c++/4.2.1",
912 "x86_64-pc-linux-gnu", "", "", triple);
915 case llvm::Triple::FreeBSD:
918 AddGnuCPlusPlusIncludePaths(CLANG_PREFIX "/usr/include/c++/4.2",
920 AddGnuCPlusPlusIncludePaths(CLANG_PREFIX "/usr/include/c++/4.2/backward",
923 case llvm::Triple::NetBSD:
924 AddGnuCPlusPlusIncludePaths("/usr/include/g++", "", "", "", triple);
926 case llvm::Triple::OpenBSD: {
927 std::string t = triple.getTriple();
928 if (t.substr(0, 6) == "x86_64")
929 t.replace(0, 6, "amd64");
930 AddGnuCPlusPlusIncludePaths("/usr/include/g++",
934 case llvm::Triple::Minix:
935 AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3",
938 case llvm::Triple::Solaris:
939 // Solaris - Fall though..
940 case llvm::Triple::AuroraUX:
942 AddGnuCPlusPlusIncludePaths("/opt/gcc4/include/c++/4.2.4",
943 "i386-pc-solaris2.11", "", "", triple);
950 void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang,
951 const llvm::Triple &triple,
952 const HeaderSearchOptions &HSOpts) {
953 if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes) {
954 if (HSOpts.UseLibcxx)
955 AddPath("/usr/include/c++/v1", CXXSystem, true, false, false);
957 AddDefaultCPlusPlusIncludePaths(triple, HSOpts);
960 AddDefaultCIncludePaths(triple, HSOpts);
962 // Add the default framework include paths on Darwin.
963 if (triple.isOSDarwin()) {
964 AddPath("/System/Library/Frameworks", System, true, false, true);
965 AddPath("/Library/Frameworks", System, true, false, true);
969 /// RemoveDuplicates - If there are duplicate directory entries in the specified
970 /// search list, remove the later (dead) ones.
971 static void RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
972 unsigned First, bool Verbose) {
973 llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenDirs;
974 llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenFrameworkDirs;
975 llvm::SmallPtrSet<const HeaderMap *, 8> SeenHeaderMaps;
976 for (unsigned i = First; i != SearchList.size(); ++i) {
977 unsigned DirToRemove = i;
979 const DirectoryLookup &CurEntry = SearchList[i];
981 if (CurEntry.isNormalDir()) {
982 // If this isn't the first time we've seen this dir, remove it.
983 if (SeenDirs.insert(CurEntry.getDir()))
985 } else if (CurEntry.isFramework()) {
986 // If this isn't the first time we've seen this framework dir, remove it.
987 if (SeenFrameworkDirs.insert(CurEntry.getFrameworkDir()))
990 assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?");
991 // If this isn't the first time we've seen this headermap, remove it.
992 if (SeenHeaderMaps.insert(CurEntry.getHeaderMap()))
996 // If we have a normal #include dir/framework/headermap that is shadowed
997 // later in the chain by a system include location, we actually want to
998 // ignore the user's request and drop the user dir... keeping the system
999 // dir. This is weird, but required to emulate GCC's search path correctly.
1001 // Since dupes of system dirs are rare, just rescan to find the original
1002 // that we're nuking instead of using a DenseMap.
1003 if (CurEntry.getDirCharacteristic() != SrcMgr::C_User) {
1004 // Find the dir that this is the same of.
1006 for (FirstDir = 0; ; ++FirstDir) {
1007 assert(FirstDir != i && "Didn't find dupe?");
1009 const DirectoryLookup &SearchEntry = SearchList[FirstDir];
1011 // If these are different lookup types, then they can't be the dupe.
1012 if (SearchEntry.getLookupType() != CurEntry.getLookupType())
1016 if (CurEntry.isNormalDir())
1017 isSame = SearchEntry.getDir() == CurEntry.getDir();
1018 else if (CurEntry.isFramework())
1019 isSame = SearchEntry.getFrameworkDir() == CurEntry.getFrameworkDir();
1021 assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?");
1022 isSame = SearchEntry.getHeaderMap() == CurEntry.getHeaderMap();
1029 // If the first dir in the search path is a non-system dir, zap it
1030 // instead of the system one.
1031 if (SearchList[FirstDir].getDirCharacteristic() == SrcMgr::C_User)
1032 DirToRemove = FirstDir;
1036 llvm::errs() << "ignoring duplicate directory \""
1037 << CurEntry.getName() << "\"\n";
1038 if (DirToRemove != i)
1039 llvm::errs() << " as it is a non-system directory that duplicates "
1040 << "a system directory\n";
1043 // This is reached if the current entry is a duplicate. Remove the
1044 // DirToRemove (usually the current dir).
1045 SearchList.erase(SearchList.begin()+DirToRemove);
1051 void InitHeaderSearch::Realize(const LangOptions &Lang) {
1052 // Concatenate ANGLE+SYSTEM+AFTER chains together into SearchList.
1053 std::vector<DirectoryLookup> SearchList;
1054 SearchList.reserve(IncludePath.size());
1056 // Quoted arguments go first.
1057 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
1059 if (it->first == Quoted)
1060 SearchList.push_back(it->second);
1062 // Deduplicate and remember index.
1063 RemoveDuplicates(SearchList, 0, Verbose);
1064 unsigned NumQuoted = SearchList.size();
1066 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
1068 if (it->first == Angled)
1069 SearchList.push_back(it->second);
1072 RemoveDuplicates(SearchList, NumQuoted, Verbose);
1073 unsigned NumAngled = SearchList.size();
1075 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
1077 if (it->first == System || (Lang.CPlusPlus && it->first == CXXSystem))
1078 SearchList.push_back(it->second);
1081 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
1083 if (it->first == After)
1084 SearchList.push_back(it->second);
1087 // Remove duplicates across both the Angled and System directories. GCC does
1088 // this and failing to remove duplicates across these two groups breaks
1090 RemoveDuplicates(SearchList, NumQuoted, Verbose);
1092 bool DontSearchCurDir = false; // TODO: set to true if -I- is set?
1093 Headers.SetSearchPaths(SearchList, NumQuoted, NumAngled, DontSearchCurDir);
1095 // If verbose, print the list of directories that will be searched.
1097 llvm::errs() << "#include \"...\" search starts here:\n";
1098 for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
1100 llvm::errs() << "#include <...> search starts here:\n";
1101 const char *Name = SearchList[i].getName();
1103 if (SearchList[i].isNormalDir())
1105 else if (SearchList[i].isFramework())
1106 Suffix = " (framework directory)";
1108 assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup");
1109 Suffix = " (headermap)";
1111 llvm::errs() << " " << Name << Suffix << "\n";
1113 llvm::errs() << "End of search list.\n";
1117 void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
1118 const HeaderSearchOptions &HSOpts,
1119 const LangOptions &Lang,
1120 const llvm::Triple &Triple) {
1121 InitHeaderSearch Init(HS, HSOpts.Verbose, HSOpts.Sysroot);
1123 // Add the user defined entries.
1124 for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) {
1125 const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i];
1126 Init.AddPath(E.Path, E.Group, false, E.IsUserSupplied, E.IsFramework,
1130 // Add entries from CPATH and friends.
1131 Init.AddDelimitedPaths(HSOpts.EnvIncPath);
1132 if (Lang.CPlusPlus && Lang.ObjC1)
1133 Init.AddDelimitedPaths(HSOpts.ObjCXXEnvIncPath);
1134 else if (Lang.CPlusPlus)
1135 Init.AddDelimitedPaths(HSOpts.CXXEnvIncPath);
1136 else if (Lang.ObjC1)
1137 Init.AddDelimitedPaths(HSOpts.ObjCEnvIncPath);
1139 Init.AddDelimitedPaths(HSOpts.CEnvIncPath);
1141 if (HSOpts.UseStandardIncludes)
1142 Init.AddDefaultSystemIncludePaths(Lang, Triple, HSOpts);