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 #include "clang/Frontend/Utils.h"
15 #include "clang/Basic/FileManager.h"
16 #include "clang/Basic/LangOptions.h"
17 #include "clang/Config/config.h" // C_INCLUDE_DIRS
18 #include "clang/Lex/HeaderSearch.h"
19 #include "clang/Lex/HeaderSearchOptions.h"
20 #include "llvm/ADT/SmallPtrSet.h"
21 #include "llvm/ADT/SmallString.h"
22 #include "llvm/ADT/SmallVector.h"
23 #include "llvm/ADT/StringExtras.h"
24 #include "llvm/ADT/Triple.h"
25 #include "llvm/ADT/Twine.h"
26 #include "llvm/Support/ErrorHandling.h"
27 #include "llvm/Support/FileSystem.h"
28 #include "llvm/Support/Path.h"
29 #include "llvm/Support/raw_ostream.h"
31 using namespace clang;
32 using namespace clang::frontend;
36 /// InitHeaderSearch - This class makes it easier to set the search paths of
37 /// a HeaderSearch object. InitHeaderSearch stores several search path lists
38 /// internally, which can be sent to a HeaderSearch object in one swoop.
39 class InitHeaderSearch {
40 std::vector<std::pair<IncludeDirGroup, DirectoryLookup> > IncludePath;
41 typedef std::vector<std::pair<IncludeDirGroup,
42 DirectoryLookup> >::const_iterator path_iterator;
43 std::vector<std::pair<std::string, bool> > SystemHeaderPrefixes;
44 HeaderSearch &Headers;
46 std::string IncludeSysroot;
51 InitHeaderSearch(HeaderSearch &HS, bool verbose, StringRef sysroot)
52 : Headers(HS), Verbose(verbose), IncludeSysroot(sysroot),
53 HasSysroot(!(sysroot.empty() || sysroot == "/")) {
56 /// AddPath - Add the specified path to the specified group list, prefixing
57 /// the sysroot if used.
58 void AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework);
60 /// AddUnmappedPath - Add the specified path to the specified group list,
61 /// without performing any sysroot remapping.
62 void AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
65 /// AddSystemHeaderPrefix - Add the specified prefix to the system header
67 void AddSystemHeaderPrefix(StringRef Prefix, bool IsSystemHeader) {
68 SystemHeaderPrefixes.emplace_back(Prefix, IsSystemHeader);
71 /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu
73 void AddGnuCPlusPlusIncludePaths(StringRef Base,
77 const llvm::Triple &triple);
79 /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW
81 void AddMinGWCPlusPlusIncludePaths(StringRef Base,
85 // AddDefaultCIncludePaths - Add paths that should always be searched.
86 void AddDefaultCIncludePaths(const llvm::Triple &triple,
87 const HeaderSearchOptions &HSOpts);
89 // AddDefaultCPlusPlusIncludePaths - Add paths that should be searched when
91 void AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple,
92 const HeaderSearchOptions &HSOpts);
94 /// AddDefaultSystemIncludePaths - Adds the default system include paths so
95 /// that e.g. stdio.h is found.
96 void AddDefaultIncludePaths(const LangOptions &Lang,
97 const llvm::Triple &triple,
98 const HeaderSearchOptions &HSOpts);
100 /// Realize - Merges all search path lists into one list and send it to
102 void Realize(const LangOptions &Lang);
105 } // end anonymous namespace.
107 static bool CanPrefixSysroot(StringRef Path) {
108 #if defined(LLVM_ON_WIN32)
109 return !Path.empty() && llvm::sys::path::is_separator(Path[0]);
111 return llvm::sys::path::is_absolute(Path);
115 void InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group,
117 // Add the path with sysroot prepended, if desired and this is a system header
120 SmallString<256> MappedPathStorage;
121 StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
122 if (CanPrefixSysroot(MappedPathStr)) {
123 AddUnmappedPath(IncludeSysroot + Path, Group, isFramework);
128 AddUnmappedPath(Path, Group, isFramework);
131 void InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group,
133 assert(!Path.isTriviallyEmpty() && "can't handle empty path here");
135 FileManager &FM = Headers.getFileMgr();
136 SmallString<256> MappedPathStorage;
137 StringRef MappedPathStr = Path.toStringRef(MappedPathStorage);
139 // Compute the DirectoryLookup type.
140 SrcMgr::CharacteristicKind Type;
141 if (Group == Quoted || Group == Angled || Group == IndexHeaderMap) {
142 Type = SrcMgr::C_User;
143 } else if (Group == ExternCSystem) {
144 Type = SrcMgr::C_ExternCSystem;
146 Type = SrcMgr::C_System;
149 // If the directory exists, add it.
150 if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr)) {
151 IncludePath.push_back(
152 std::make_pair(Group, DirectoryLookup(DE, Type, 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(
163 std::make_pair(Group,
164 DirectoryLookup(HM, Type, Group == IndexHeaderMap)));
171 llvm::errs() << "ignoring nonexistent directory \""
172 << MappedPathStr << "\"\n";
175 void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(StringRef Base,
179 const llvm::Triple &triple) {
181 AddPath(Base, CXXSystem, false);
183 // Add the multilib dirs
184 llvm::Triple::ArchType arch = triple.getArch();
185 bool is64bit = arch == llvm::Triple::ppc64 || arch == llvm::Triple::x86_64;
187 AddPath(Base + "/" + ArchDir + "/" + Dir64, CXXSystem, false);
189 AddPath(Base + "/" + ArchDir + "/" + Dir32, CXXSystem, false);
191 // Add the backward dir
192 AddPath(Base + "/backward", CXXSystem, false);
195 void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(StringRef Base,
198 AddPath(Base + "/" + Arch + "/" + Version + "/include/c++",
200 AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/" + Arch,
202 AddPath(Base + "/" + Arch + "/" + Version + "/include/c++/backward",
206 void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
207 const HeaderSearchOptions &HSOpts) {
208 llvm::Triple::OSType os = triple.getOS();
210 if (HSOpts.UseStandardSystemIncludes) {
212 case llvm::Triple::CloudABI:
213 case llvm::Triple::FreeBSD:
214 case llvm::Triple::NetBSD:
215 case llvm::Triple::OpenBSD:
216 case llvm::Triple::Bitrig:
217 case llvm::Triple::NaCl:
219 case llvm::Triple::Win32:
220 if (triple.getEnvironment() != llvm::Triple::Cygnus)
223 // FIXME: temporary hack: hard-coded paths.
224 AddPath("/usr/local/include", System, false);
229 // Builtin includes use #include_next directives and should be positioned
230 // just prior C include dirs.
231 if (HSOpts.UseBuiltinIncludes) {
232 // Ignore the sys root, we *always* look for clang headers relative to
234 SmallString<128> P = StringRef(HSOpts.ResourceDir);
235 llvm::sys::path::append(P, "include");
236 AddUnmappedPath(P, ExternCSystem, false);
239 // All remaining additions are for system include directories, early exit if
240 // we aren't using them.
241 if (!HSOpts.UseStandardSystemIncludes)
244 // Add dirs specified via 'configure --with-c-include-dirs'.
245 StringRef CIncludeDirs(C_INCLUDE_DIRS);
246 if (CIncludeDirs != "") {
247 SmallVector<StringRef, 5> dirs;
248 CIncludeDirs.split(dirs, ":");
249 for (SmallVectorImpl<StringRef>::iterator i = dirs.begin();
252 AddPath(*i, ExternCSystem, false);
257 case llvm::Triple::Linux:
258 llvm_unreachable("Include management is handled in the driver.");
260 case llvm::Triple::CloudABI: {
261 // <sysroot>/<triple>/include
262 SmallString<128> P = StringRef(HSOpts.ResourceDir);
263 llvm::sys::path::append(P, "../../..", triple.str(), "include");
264 AddPath(P, System, false);
268 case llvm::Triple::Haiku:
269 AddPath("/boot/common/include", System, false);
270 AddPath("/boot/develop/headers/os", System, false);
271 AddPath("/boot/develop/headers/os/app", System, false);
272 AddPath("/boot/develop/headers/os/arch", System, false);
273 AddPath("/boot/develop/headers/os/device", System, false);
274 AddPath("/boot/develop/headers/os/drivers", System, false);
275 AddPath("/boot/develop/headers/os/game", System, false);
276 AddPath("/boot/develop/headers/os/interface", System, false);
277 AddPath("/boot/develop/headers/os/kernel", System, false);
278 AddPath("/boot/develop/headers/os/locale", System, false);
279 AddPath("/boot/develop/headers/os/mail", System, false);
280 AddPath("/boot/develop/headers/os/media", System, false);
281 AddPath("/boot/develop/headers/os/midi", System, false);
282 AddPath("/boot/develop/headers/os/midi2", System, false);
283 AddPath("/boot/develop/headers/os/net", System, false);
284 AddPath("/boot/develop/headers/os/storage", System, false);
285 AddPath("/boot/develop/headers/os/support", System, false);
286 AddPath("/boot/develop/headers/os/translation", System, false);
287 AddPath("/boot/develop/headers/os/add-ons/graphics", System, false);
288 AddPath("/boot/develop/headers/os/add-ons/input_server", System, false);
289 AddPath("/boot/develop/headers/os/add-ons/screen_saver", System, false);
290 AddPath("/boot/develop/headers/os/add-ons/tracker", System, false);
291 AddPath("/boot/develop/headers/os/be_apps/Deskbar", System, false);
292 AddPath("/boot/develop/headers/os/be_apps/NetPositive", System, false);
293 AddPath("/boot/develop/headers/os/be_apps/Tracker", System, false);
294 AddPath("/boot/develop/headers/cpp", System, false);
295 AddPath("/boot/develop/headers/cpp/i586-pc-haiku", System, false);
296 AddPath("/boot/develop/headers/3rdparty", System, false);
297 AddPath("/boot/develop/headers/bsd", System, false);
298 AddPath("/boot/develop/headers/glibc", System, false);
299 AddPath("/boot/develop/headers/posix", System, false);
300 AddPath("/boot/develop/headers", System, false);
302 case llvm::Triple::RTEMS:
304 case llvm::Triple::Win32:
305 switch (triple.getEnvironment()) {
306 default: llvm_unreachable("Include management is handled in the driver.");
307 case llvm::Triple::Cygnus:
308 AddPath("/usr/include/w32api", System, false);
310 case llvm::Triple::GNU:
319 case llvm::Triple::CloudABI:
320 case llvm::Triple::RTEMS:
321 case llvm::Triple::NaCl:
324 AddPath("/usr/include", ExternCSystem, false);
329 void InitHeaderSearch::
330 AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) {
331 llvm::Triple::OSType os = triple.getOS();
332 // FIXME: temporary hack: hard-coded paths.
334 if (triple.isOSDarwin()) {
335 switch (triple.getArch()) {
338 case llvm::Triple::ppc:
339 case llvm::Triple::ppc64:
340 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
341 "powerpc-apple-darwin10", "", "ppc64",
343 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
344 "powerpc-apple-darwin10", "", "ppc64",
348 case llvm::Triple::x86:
349 case llvm::Triple::x86_64:
350 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
351 "i686-apple-darwin10", "", "x86_64", triple);
352 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
353 "i686-apple-darwin8", "", "", triple);
356 case llvm::Triple::arm:
357 case llvm::Triple::thumb:
358 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
359 "arm-apple-darwin10", "v7", "", triple);
360 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
361 "arm-apple-darwin10", "v6", "", triple);
364 case llvm::Triple::aarch64:
365 AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
366 "arm64-apple-darwin10", "", "", triple);
373 case llvm::Triple::Linux:
374 llvm_unreachable("Include management is handled in the driver.");
376 case llvm::Triple::Win32:
377 switch (triple.getEnvironment()) {
378 default: llvm_unreachable("Include management is handled in the driver.");
379 case llvm::Triple::Cygnus:
381 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.7.3");
382 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.5.3");
383 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
384 // g++-4 / Cygwin-1.5
385 AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
389 case llvm::Triple::DragonFly:
390 if (llvm::sys::fs::exists("/usr/lib/gcc47"))
391 AddPath("/usr/include/c++/4.7", CXXSystem, false);
393 AddPath("/usr/include/c++/4.4", CXXSystem, false);
395 case llvm::Triple::OpenBSD: {
396 std::string t = triple.getTriple();
397 if (t.substr(0, 6) == "x86_64")
398 t.replace(0, 6, "amd64");
399 AddGnuCPlusPlusIncludePaths("/usr/include/g++",
403 case llvm::Triple::Minix:
404 AddGnuCPlusPlusIncludePaths("/usr/gnu/include/c++/4.4.3",
407 case llvm::Triple::Solaris:
408 AddGnuCPlusPlusIncludePaths("/usr/gcc/4.5/include/c++/4.5.2/",
409 "i386-pc-solaris2.11", "", "", triple);
416 void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang,
417 const llvm::Triple &triple,
418 const HeaderSearchOptions &HSOpts) {
419 // NB: This code path is going away. All of the logic is moving into the
420 // driver which has the information necessary to do target-specific
421 // selections of default include paths. Each target which moves there will be
422 // exempted from this logic here until we can delete the entire pile of code.
423 switch (triple.getOS()) {
425 break; // Everything else continues to use this routine's logic.
427 case llvm::Triple::Linux:
430 case llvm::Triple::Win32:
431 if (triple.getEnvironment() != llvm::Triple::Cygnus ||
432 triple.isOSBinFormatMachO())
437 if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes &&
438 HSOpts.UseStandardSystemIncludes) {
439 if (HSOpts.UseLibcxx) {
440 if (triple.isOSDarwin()) {
441 // On Darwin, libc++ may be installed alongside the compiler in
443 if (!HSOpts.ResourceDir.empty()) {
444 // Remove version from foo/lib/clang/version
445 StringRef NoVer = llvm::sys::path::parent_path(HSOpts.ResourceDir);
446 // Remove clang from foo/lib/clang
447 StringRef Lib = llvm::sys::path::parent_path(NoVer);
448 // Remove lib from foo/lib
449 SmallString<128> P = llvm::sys::path::parent_path(Lib);
451 // Get foo/include/c++/v1
452 llvm::sys::path::append(P, "include", "c++", "v1");
453 AddUnmappedPath(P, CXXSystem, false);
456 // On Solaris, include the support directory for things like xlocale and
457 // fudged system headers.
458 if (triple.getOS() == llvm::Triple::Solaris)
459 AddPath("/usr/include/c++/v1/support/solaris", CXXSystem, false);
461 AddPath("/usr/include/c++/v1", CXXSystem, false);
463 AddDefaultCPlusPlusIncludePaths(triple, HSOpts);
467 AddDefaultCIncludePaths(triple, HSOpts);
469 // Add the default framework include paths on Darwin.
470 if (HSOpts.UseStandardSystemIncludes) {
471 if (triple.isOSDarwin()) {
472 AddPath("/System/Library/Frameworks", System, true);
473 AddPath("/Library/Frameworks", System, true);
478 /// RemoveDuplicates - If there are duplicate directory entries in the specified
479 /// search list, remove the later (dead) ones. Returns the number of non-system
480 /// headers removed, which is used to update NumAngled.
481 static unsigned RemoveDuplicates(std::vector<DirectoryLookup> &SearchList,
482 unsigned First, bool Verbose) {
483 llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenDirs;
484 llvm::SmallPtrSet<const DirectoryEntry *, 8> SeenFrameworkDirs;
485 llvm::SmallPtrSet<const HeaderMap *, 8> SeenHeaderMaps;
486 unsigned NonSystemRemoved = 0;
487 for (unsigned i = First; i != SearchList.size(); ++i) {
488 unsigned DirToRemove = i;
490 const DirectoryLookup &CurEntry = SearchList[i];
492 if (CurEntry.isNormalDir()) {
493 // If this isn't the first time we've seen this dir, remove it.
494 if (SeenDirs.insert(CurEntry.getDir()).second)
496 } else if (CurEntry.isFramework()) {
497 // If this isn't the first time we've seen this framework dir, remove it.
498 if (SeenFrameworkDirs.insert(CurEntry.getFrameworkDir()).second)
501 assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?");
502 // If this isn't the first time we've seen this headermap, remove it.
503 if (SeenHeaderMaps.insert(CurEntry.getHeaderMap()).second)
507 // If we have a normal #include dir/framework/headermap that is shadowed
508 // later in the chain by a system include location, we actually want to
509 // ignore the user's request and drop the user dir... keeping the system
510 // dir. This is weird, but required to emulate GCC's search path correctly.
512 // Since dupes of system dirs are rare, just rescan to find the original
513 // that we're nuking instead of using a DenseMap.
514 if (CurEntry.getDirCharacteristic() != SrcMgr::C_User) {
515 // Find the dir that this is the same of.
517 for (FirstDir = 0; ; ++FirstDir) {
518 assert(FirstDir != i && "Didn't find dupe?");
520 const DirectoryLookup &SearchEntry = SearchList[FirstDir];
522 // If these are different lookup types, then they can't be the dupe.
523 if (SearchEntry.getLookupType() != CurEntry.getLookupType())
527 if (CurEntry.isNormalDir())
528 isSame = SearchEntry.getDir() == CurEntry.getDir();
529 else if (CurEntry.isFramework())
530 isSame = SearchEntry.getFrameworkDir() == CurEntry.getFrameworkDir();
532 assert(CurEntry.isHeaderMap() && "Not a headermap or normal dir?");
533 isSame = SearchEntry.getHeaderMap() == CurEntry.getHeaderMap();
540 // If the first dir in the search path is a non-system dir, zap it
541 // instead of the system one.
542 if (SearchList[FirstDir].getDirCharacteristic() == SrcMgr::C_User)
543 DirToRemove = FirstDir;
547 llvm::errs() << "ignoring duplicate directory \""
548 << CurEntry.getName() << "\"\n";
549 if (DirToRemove != i)
550 llvm::errs() << " as it is a non-system directory that duplicates "
551 << "a system directory\n";
553 if (DirToRemove != i)
556 // This is reached if the current entry is a duplicate. Remove the
557 // DirToRemove (usually the current dir).
558 SearchList.erase(SearchList.begin()+DirToRemove);
561 return NonSystemRemoved;
565 void InitHeaderSearch::Realize(const LangOptions &Lang) {
566 // Concatenate ANGLE+SYSTEM+AFTER chains together into SearchList.
567 std::vector<DirectoryLookup> SearchList;
568 SearchList.reserve(IncludePath.size());
570 // Quoted arguments go first.
571 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
573 if (it->first == Quoted)
574 SearchList.push_back(it->second);
576 // Deduplicate and remember index.
577 RemoveDuplicates(SearchList, 0, Verbose);
578 unsigned NumQuoted = SearchList.size();
580 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
582 if (it->first == Angled || it->first == IndexHeaderMap)
583 SearchList.push_back(it->second);
586 RemoveDuplicates(SearchList, NumQuoted, Verbose);
587 unsigned NumAngled = SearchList.size();
589 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
591 if (it->first == System || it->first == ExternCSystem ||
592 (!Lang.ObjC1 && !Lang.CPlusPlus && it->first == CSystem) ||
593 (/*FIXME !Lang.ObjC1 && */Lang.CPlusPlus && it->first == CXXSystem) ||
594 (Lang.ObjC1 && !Lang.CPlusPlus && it->first == ObjCSystem) ||
595 (Lang.ObjC1 && Lang.CPlusPlus && it->first == ObjCXXSystem))
596 SearchList.push_back(it->second);
599 for (path_iterator it = IncludePath.begin(), ie = IncludePath.end();
601 if (it->first == After)
602 SearchList.push_back(it->second);
605 // Remove duplicates across both the Angled and System directories. GCC does
606 // this and failing to remove duplicates across these two groups breaks
608 unsigned NonSystemRemoved = RemoveDuplicates(SearchList, NumQuoted, Verbose);
609 NumAngled -= NonSystemRemoved;
611 bool DontSearchCurDir = false; // TODO: set to true if -I- is set?
612 Headers.SetSearchPaths(SearchList, NumQuoted, NumAngled, DontSearchCurDir);
614 Headers.SetSystemHeaderPrefixes(SystemHeaderPrefixes);
616 // If verbose, print the list of directories that will be searched.
618 llvm::errs() << "#include \"...\" search starts here:\n";
619 for (unsigned i = 0, e = SearchList.size(); i != e; ++i) {
621 llvm::errs() << "#include <...> search starts here:\n";
622 const char *Name = SearchList[i].getName();
624 if (SearchList[i].isNormalDir())
626 else if (SearchList[i].isFramework())
627 Suffix = " (framework directory)";
629 assert(SearchList[i].isHeaderMap() && "Unknown DirectoryLookup");
630 Suffix = " (headermap)";
632 llvm::errs() << " " << Name << Suffix << "\n";
634 llvm::errs() << "End of search list.\n";
638 void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
639 const HeaderSearchOptions &HSOpts,
640 const LangOptions &Lang,
641 const llvm::Triple &Triple) {
642 InitHeaderSearch Init(HS, HSOpts.Verbose, HSOpts.Sysroot);
644 // Add the user defined entries.
645 for (unsigned i = 0, e = HSOpts.UserEntries.size(); i != e; ++i) {
646 const HeaderSearchOptions::Entry &E = HSOpts.UserEntries[i];
647 if (E.IgnoreSysRoot) {
648 Init.AddUnmappedPath(E.Path, E.Group, E.IsFramework);
650 Init.AddPath(E.Path, E.Group, E.IsFramework);
654 Init.AddDefaultIncludePaths(Lang, Triple, HSOpts);
656 for (unsigned i = 0, e = HSOpts.SystemHeaderPrefixes.size(); i != e; ++i)
657 Init.AddSystemHeaderPrefix(HSOpts.SystemHeaderPrefixes[i].Prefix,
658 HSOpts.SystemHeaderPrefixes[i].IsSystemHeader);
660 if (HSOpts.UseBuiltinIncludes) {
661 // Set up the builtin include directory in the module map.
662 SmallString<128> P = StringRef(HSOpts.ResourceDir);
663 llvm::sys::path::append(P, "include");
664 if (const DirectoryEntry *Dir = HS.getFileMgr().getDirectory(P))
665 HS.getModuleMap().setBuiltinIncludeDir(Dir);