1 //===-- Path.cpp - Implement OS Path Concept ------------------------------===//
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 operating system Path API.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/Support/Path.h"
15 #include "llvm/Support/Endian.h"
16 #include "llvm/Support/ErrorHandling.h"
17 #include "llvm/Support/FileSystem.h"
18 #include "llvm/Support/Process.h"
24 #if !defined(_MSC_VER) && !defined(__MINGW32__)
31 using llvm::StringRef;
32 using llvm::sys::path::is_separator;
35 const char *separators = "\\/";
36 const char preferred_separator = '\\';
38 const char separators = '/';
39 const char preferred_separator = '/';
42 StringRef find_first_component(StringRef path) {
43 // Look for this first component in the following order.
44 // * empty (in this case we return an empty string)
45 // * either C: or {//,\\}net.
48 // * {file,directory}name
55 if (path.size() >= 2 && std::isalpha(static_cast<unsigned char>(path[0])) &&
57 return path.substr(0, 2);
61 if ((path.size() > 2) &&
62 is_separator(path[0]) &&
64 !is_separator(path[2])) {
65 // Find the next directory separator.
66 size_t end = path.find_first_of(separators, 2);
67 return path.substr(0, end);
71 if (is_separator(path[0]))
72 return path.substr(0, 1);
74 if (path.startswith(".."))
75 return path.substr(0, 2);
78 return path.substr(0, 1);
80 // * {file,directory}name
81 size_t end = path.find_first_of(separators);
82 return path.substr(0, end);
85 size_t filename_pos(StringRef str) {
86 if (str.size() == 2 &&
87 is_separator(str[0]) &&
91 if (str.size() > 0 && is_separator(str[str.size() - 1]))
92 return str.size() - 1;
94 size_t pos = str.find_last_of(separators, str.size() - 1);
97 if (pos == StringRef::npos)
98 pos = str.find_last_of(':', str.size() - 2);
101 if (pos == StringRef::npos ||
102 (pos == 1 && is_separator(str[0])))
108 size_t root_dir_start(StringRef str) {
111 if (str.size() > 2 &&
113 is_separator(str[2]))
118 if (str.size() == 2 &&
119 is_separator(str[0]) &&
121 return StringRef::npos;
124 if (str.size() > 3 &&
125 is_separator(str[0]) &&
127 !is_separator(str[2])) {
128 return str.find_first_of(separators, 2);
132 if (str.size() > 0 && is_separator(str[0]))
135 return StringRef::npos;
138 size_t parent_path_end(StringRef path) {
139 size_t end_pos = filename_pos(path);
141 bool filename_was_sep = path.size() > 0 && is_separator(path[end_pos]);
143 // Skip separators except for root dir.
144 size_t root_dir_pos = root_dir_start(path.substr(0, end_pos));
147 (end_pos - 1) != root_dir_pos &&
148 is_separator(path[end_pos - 1]))
151 if (end_pos == 1 && root_dir_pos == 0 && filename_was_sep)
152 return StringRef::npos;
156 } // end unnamed namespace
164 // Implemented in Unix/Path.inc and Windows/Path.inc.
165 static llvm::error_code
166 createUniqueEntity(const llvm::Twine &Model, int &ResultFD,
167 llvm::SmallVectorImpl<char> &ResultPath,
168 bool MakeAbsolute, unsigned Mode, FSEntity Type);
174 const_iterator begin(StringRef path) {
177 i.Component = find_first_component(path);
182 const_iterator end(StringRef path) {
185 i.Position = path.size();
189 const_iterator &const_iterator::operator++() {
190 assert(Position < Path.size() && "Tried to increment past end!");
192 // Increment Position to past the current component
193 Position += Component.size();
196 if (Position == Path.size()) {
197 Component = StringRef();
201 // Both POSIX and Windows treat paths that begin with exactly two separators
203 bool was_net = Component.size() > 2 &&
204 is_separator(Component[0]) &&
205 Component[1] == Component[0] &&
206 !is_separator(Component[2]);
208 // Handle separators.
209 if (is_separator(Path[Position])) {
214 || Component.endswith(":")
217 Component = Path.substr(Position, 1);
221 // Skip extra separators.
222 while (Position != Path.size() &&
223 is_separator(Path[Position])) {
227 // Treat trailing '/' as a '.'.
228 if (Position == Path.size()) {
235 // Find next component.
236 size_t end_pos = Path.find_first_of(separators, Position);
237 Component = Path.slice(Position, end_pos);
242 const_iterator &const_iterator::operator--() {
243 // If we're at the end and the previous char was a '/', return '.'.
244 if (Position == Path.size() &&
246 is_separator(Path[Position - 1])
248 && Path[Position - 2] != ':'
256 // Skip separators unless it's the root directory.
257 size_t root_dir_pos = root_dir_start(Path);
258 size_t end_pos = Position;
261 (end_pos - 1) != root_dir_pos &&
262 is_separator(Path[end_pos - 1]))
265 // Find next separator.
266 size_t start_pos = filename_pos(Path.substr(0, end_pos));
267 Component = Path.slice(start_pos, end_pos);
268 Position = start_pos;
272 bool const_iterator::operator==(const const_iterator &RHS) const {
273 return Path.begin() == RHS.Path.begin() &&
274 Position == RHS.Position;
277 bool const_iterator::operator!=(const const_iterator &RHS) const {
278 return !(*this == RHS);
281 ptrdiff_t const_iterator::operator-(const const_iterator &RHS) const {
282 return Position - RHS.Position;
285 const StringRef root_path(StringRef path) {
286 const_iterator b = begin(path),
290 bool has_net = b->size() > 2 && is_separator((*b)[0]) && (*b)[1] == (*b)[0];
298 if (has_net || has_drive) {
299 if ((++pos != e) && is_separator((*pos)[0])) {
300 // {C:/,//net/}, so get the first two components.
301 return path.substr(0, b->size() + pos->size());
303 // just {C:,//net}, return the first component.
308 // POSIX style root directory.
309 if (is_separator((*b)[0])) {
317 const StringRef root_name(StringRef path) {
318 const_iterator b = begin(path),
321 bool has_net = b->size() > 2 && is_separator((*b)[0]) && (*b)[1] == (*b)[0];
329 if (has_net || has_drive) {
330 // just {C:,//net}, return the first component.
335 // No path or no name.
339 const StringRef root_directory(StringRef path) {
340 const_iterator b = begin(path),
344 bool has_net = b->size() > 2 && is_separator((*b)[0]) && (*b)[1] == (*b)[0];
352 if ((has_net || has_drive) &&
353 // {C:,//net}, skip to the next component.
354 (++pos != e) && is_separator((*pos)[0])) {
358 // POSIX style root directory.
359 if (!has_net && is_separator((*b)[0])) {
364 // No path or no root.
368 const StringRef relative_path(StringRef path) {
369 StringRef root = root_path(path);
370 return path.substr(root.size());
373 void append(SmallVectorImpl<char> &path, const Twine &a,
377 SmallString<32> a_storage;
378 SmallString<32> b_storage;
379 SmallString<32> c_storage;
380 SmallString<32> d_storage;
382 SmallVector<StringRef, 4> components;
383 if (!a.isTriviallyEmpty()) components.push_back(a.toStringRef(a_storage));
384 if (!b.isTriviallyEmpty()) components.push_back(b.toStringRef(b_storage));
385 if (!c.isTriviallyEmpty()) components.push_back(c.toStringRef(c_storage));
386 if (!d.isTriviallyEmpty()) components.push_back(d.toStringRef(d_storage));
388 for (SmallVectorImpl<StringRef>::const_iterator i = components.begin(),
389 e = components.end();
391 bool path_has_sep = !path.empty() && is_separator(path[path.size() - 1]);
392 bool component_has_sep = !i->empty() && is_separator((*i)[0]);
393 bool is_root_name = has_root_name(*i);
396 // Strip separators from beginning of component.
397 size_t loc = i->find_first_not_of(separators);
398 StringRef c = i->substr(loc);
401 path.append(c.begin(), c.end());
405 if (!component_has_sep && !(path.empty() || is_root_name)) {
407 path.push_back(preferred_separator);
410 path.append(i->begin(), i->end());
414 void append(SmallVectorImpl<char> &path,
415 const_iterator begin, const_iterator end) {
416 for (; begin != end; ++begin)
417 path::append(path, *begin);
420 const StringRef parent_path(StringRef path) {
421 size_t end_pos = parent_path_end(path);
422 if (end_pos == StringRef::npos)
425 return path.substr(0, end_pos);
428 void remove_filename(SmallVectorImpl<char> &path) {
429 size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()));
430 if (end_pos != StringRef::npos)
431 path.set_size(end_pos);
434 void replace_extension(SmallVectorImpl<char> &path, const Twine &extension) {
435 StringRef p(path.begin(), path.size());
436 SmallString<32> ext_storage;
437 StringRef ext = extension.toStringRef(ext_storage);
439 // Erase existing extension.
440 size_t pos = p.find_last_of('.');
441 if (pos != StringRef::npos && pos >= filename_pos(p))
444 // Append '.' if needed.
445 if (ext.size() > 0 && ext[0] != '.')
449 path.append(ext.begin(), ext.end());
452 void native(const Twine &path, SmallVectorImpl<char> &result) {
453 assert((!path.isSingleStringRef() ||
454 path.getSingleStringRef().data() != result.data()) &&
455 "path and result are not allowed to overlap!");
458 path.toVector(result);
462 void native(SmallVectorImpl<char> &path) {
464 std::replace(path.begin(), path.end(), '/', '\\');
468 const StringRef filename(StringRef path) {
469 return *(--end(path));
472 const StringRef stem(StringRef path) {
473 StringRef fname = filename(path);
474 size_t pos = fname.find_last_of('.');
475 if (pos == StringRef::npos)
478 if ((fname.size() == 1 && fname == ".") ||
479 (fname.size() == 2 && fname == ".."))
482 return fname.substr(0, pos);
485 const StringRef extension(StringRef path) {
486 StringRef fname = filename(path);
487 size_t pos = fname.find_last_of('.');
488 if (pos == StringRef::npos)
491 if ((fname.size() == 1 && fname == ".") ||
492 (fname.size() == 2 && fname == ".."))
495 return fname.substr(pos);
498 bool is_separator(char value) {
501 case '\\': // fall through
503 case '/': return true;
504 default: return false;
508 void system_temp_directory(bool erasedOnReboot, SmallVectorImpl<char> &result) {
511 #if defined(_CS_DARWIN_USER_TEMP_DIR) && defined(_CS_DARWIN_USER_CACHE_DIR)
512 // On Darwin, use DARWIN_USER_TEMP_DIR or DARWIN_USER_CACHE_DIR.
513 // macros defined in <unistd.h> on darwin >= 9
514 int ConfName = erasedOnReboot? _CS_DARWIN_USER_TEMP_DIR
515 : _CS_DARWIN_USER_CACHE_DIR;
516 size_t ConfLen = confstr(ConfName, 0, 0);
519 result.resize(ConfLen);
520 ConfLen = confstr(ConfName, result.data(), result.size());
521 } while (ConfLen > 0 && ConfLen != result.size());
524 assert(result.back() == 0);
533 // Check whether the temporary directory is specified by an environment
535 const char *EnvironmentVariable;
537 EnvironmentVariable = "TEMP";
539 EnvironmentVariable = "TMPDIR";
541 if (char *RequestedDir = getenv(EnvironmentVariable)) {
542 result.append(RequestedDir, RequestedDir + strlen(RequestedDir));
546 // Fall back to a system default.
547 const char *DefaultResult;
549 (void)erasedOnReboot;
550 DefaultResult = "C:\\TEMP";
553 DefaultResult = "/tmp";
555 DefaultResult = "/var/tmp";
557 result.append(DefaultResult, DefaultResult + strlen(DefaultResult));
560 bool has_root_name(const Twine &path) {
561 SmallString<128> path_storage;
562 StringRef p = path.toStringRef(path_storage);
564 return !root_name(p).empty();
567 bool has_root_directory(const Twine &path) {
568 SmallString<128> path_storage;
569 StringRef p = path.toStringRef(path_storage);
571 return !root_directory(p).empty();
574 bool has_root_path(const Twine &path) {
575 SmallString<128> path_storage;
576 StringRef p = path.toStringRef(path_storage);
578 return !root_path(p).empty();
581 bool has_relative_path(const Twine &path) {
582 SmallString<128> path_storage;
583 StringRef p = path.toStringRef(path_storage);
585 return !relative_path(p).empty();
588 bool has_filename(const Twine &path) {
589 SmallString<128> path_storage;
590 StringRef p = path.toStringRef(path_storage);
592 return !filename(p).empty();
595 bool has_parent_path(const Twine &path) {
596 SmallString<128> path_storage;
597 StringRef p = path.toStringRef(path_storage);
599 return !parent_path(p).empty();
602 bool has_stem(const Twine &path) {
603 SmallString<128> path_storage;
604 StringRef p = path.toStringRef(path_storage);
606 return !stem(p).empty();
609 bool has_extension(const Twine &path) {
610 SmallString<128> path_storage;
611 StringRef p = path.toStringRef(path_storage);
613 return !extension(p).empty();
616 bool is_absolute(const Twine &path) {
617 SmallString<128> path_storage;
618 StringRef p = path.toStringRef(path_storage);
620 bool rootDir = has_root_directory(p),
622 rootName = has_root_name(p);
627 return rootDir && rootName;
630 bool is_relative(const Twine &path) {
631 return !is_absolute(path);
634 } // end namespace path
638 error_code getUniqueID(const Twine Path, UniqueID &Result) {
640 error_code EC = status(Path, Status);
643 Result = Status.getUniqueID();
644 return error_code::success();
647 error_code createUniqueFile(const Twine &Model, int &ResultFd,
648 SmallVectorImpl<char> &ResultPath, unsigned Mode) {
649 return createUniqueEntity(Model, ResultFd, ResultPath, false, Mode, FS_File);
652 error_code createUniqueFile(const Twine &Model,
653 SmallVectorImpl<char> &ResultPath) {
655 return createUniqueEntity(Model, Dummy, ResultPath, false, 0, FS_Name);
658 static error_code createTemporaryFile(const Twine &Model, int &ResultFD,
659 llvm::SmallVectorImpl<char> &ResultPath,
661 SmallString<128> Storage;
662 StringRef P = Model.toNullTerminatedStringRef(Storage);
663 assert(P.find_first_of(separators) == StringRef::npos &&
664 "Model must be a simple filename.");
665 // Use P.begin() so that createUniqueEntity doesn't need to recreate Storage.
666 return createUniqueEntity(P.begin(), ResultFD, ResultPath,
667 true, owner_read | owner_write, Type);
671 createTemporaryFile(const Twine &Prefix, StringRef Suffix, int &ResultFD,
672 llvm::SmallVectorImpl<char> &ResultPath,
674 const char *Middle = Suffix.empty() ? "-%%%%%%" : "-%%%%%%.";
675 return createTemporaryFile(Prefix + Middle + Suffix, ResultFD, ResultPath,
680 error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
682 SmallVectorImpl<char> &ResultPath) {
683 return createTemporaryFile(Prefix, Suffix, ResultFD, ResultPath, FS_File);
686 error_code createTemporaryFile(const Twine &Prefix, StringRef Suffix,
687 SmallVectorImpl<char> &ResultPath) {
689 return createTemporaryFile(Prefix, Suffix, Dummy, ResultPath, FS_Name);
693 // This is a mkdtemp with a different pattern. We use createUniqueEntity mostly
694 // for consistency. We should try using mkdtemp.
695 error_code createUniqueDirectory(const Twine &Prefix,
696 SmallVectorImpl<char> &ResultPath) {
698 return createUniqueEntity(Prefix + "-%%%%%%", Dummy, ResultPath,
702 error_code make_absolute(SmallVectorImpl<char> &path) {
703 StringRef p(path.data(), path.size());
705 bool rootDirectory = path::has_root_directory(p),
707 rootName = path::has_root_name(p);
713 if (rootName && rootDirectory)
714 return error_code::success();
716 // All of the following conditions will need the current directory.
717 SmallString<128> current_dir;
718 if (error_code ec = current_path(current_dir)) return ec;
720 // Relative path. Prepend the current directory.
721 if (!rootName && !rootDirectory) {
722 // Append path to the current directory.
723 path::append(current_dir, p);
724 // Set path to the result.
725 path.swap(current_dir);
726 return error_code::success();
729 if (!rootName && rootDirectory) {
730 StringRef cdrn = path::root_name(current_dir);
731 SmallString<128> curDirRootName(cdrn.begin(), cdrn.end());
732 path::append(curDirRootName, p);
733 // Set path to the result.
734 path.swap(curDirRootName);
735 return error_code::success();
738 if (rootName && !rootDirectory) {
739 StringRef pRootName = path::root_name(p);
740 StringRef bRootDirectory = path::root_directory(current_dir);
741 StringRef bRelativePath = path::relative_path(current_dir);
742 StringRef pRelativePath = path::relative_path(p);
744 SmallString<128> res;
745 path::append(res, pRootName, bRootDirectory, bRelativePath, pRelativePath);
747 return error_code::success();
750 llvm_unreachable("All rootName and rootDirectory combinations should have "
754 error_code create_directories(const Twine &Path, bool IgnoreExisting) {
755 SmallString<128> PathStorage;
756 StringRef P = Path.toStringRef(PathStorage);
758 // Be optimistic and try to create the directory
759 error_code EC = create_directory(P, IgnoreExisting);
760 // If we succeeded, or had any error other than the parent not existing, just
762 if (EC != errc::no_such_file_or_directory)
765 // We failed because of a no_such_file_or_directory, try to create the
767 StringRef Parent = path::parent_path(P);
771 if ((EC = create_directories(Parent)))
774 return create_directory(P, IgnoreExisting);
777 bool exists(file_status status) {
778 return status_known(status) && status.type() != file_type::file_not_found;
781 bool status_known(file_status s) {
782 return s.type() != file_type::status_error;
785 bool is_directory(file_status status) {
786 return status.type() == file_type::directory_file;
789 error_code is_directory(const Twine &path, bool &result) {
791 if (error_code ec = status(path, st))
793 result = is_directory(st);
794 return error_code::success();
797 bool is_regular_file(file_status status) {
798 return status.type() == file_type::regular_file;
801 error_code is_regular_file(const Twine &path, bool &result) {
803 if (error_code ec = status(path, st))
805 result = is_regular_file(st);
806 return error_code::success();
809 bool is_symlink(file_status status) {
810 return status.type() == file_type::symlink_file;
813 error_code is_symlink(const Twine &path, bool &result) {
815 if (error_code ec = status(path, st))
817 result = is_symlink(st);
818 return error_code::success();
821 bool is_other(file_status status) {
822 return exists(status) &&
823 !is_regular_file(status) &&
824 !is_directory(status) &&
828 void directory_entry::replace_filename(const Twine &filename, file_status st) {
829 SmallString<128> path(Path.begin(), Path.end());
830 path::remove_filename(path);
831 path::append(path, filename);
836 error_code has_magic(const Twine &path, const Twine &magic, bool &result) {
837 SmallString<32> MagicStorage;
838 StringRef Magic = magic.toStringRef(MagicStorage);
839 SmallString<32> Buffer;
841 if (error_code ec = get_magic(path, Magic.size(), Buffer)) {
842 if (ec == errc::value_too_large) {
843 // Magic.size() > file_size(Path).
845 return error_code::success();
850 result = Magic == Buffer;
851 return error_code::success();
854 /// @brief Identify the magic in magic.
855 file_magic identify_magic(StringRef Magic) {
856 if (Magic.size() < 4)
857 return file_magic::unknown;
858 switch ((unsigned char)Magic[0]) {
860 // COFF short import library file
861 if (Magic[1] == (char)0x00 && Magic[2] == (char)0xff &&
862 Magic[3] == (char)0xff)
863 return file_magic::coff_import_library;
864 // Windows resource file
865 const char Expected[] = { 0, 0, 0, 0, '\x20', 0, 0, 0, '\xff' };
866 if (Magic.size() >= sizeof(Expected) &&
867 memcmp(Magic.data(), Expected, sizeof(Expected)) == 0)
868 return file_magic::windows_resource;
869 // 0x0000 = COFF unknown machine type
871 return file_magic::coff_object;
874 case 0xDE: // 0x0B17C0DE = BC wraper
875 if (Magic[1] == (char)0xC0 && Magic[2] == (char)0x17 &&
876 Magic[3] == (char)0x0B)
877 return file_magic::bitcode;
880 if (Magic[1] == 'C' && Magic[2] == (char)0xC0 && Magic[3] == (char)0xDE)
881 return file_magic::bitcode;
884 if (Magic.size() >= 8)
885 if (memcmp(Magic.data(),"!<arch>\n",8) == 0)
886 return file_magic::archive;
890 if (Magic.size() >= 18 && Magic[1] == 'E' && Magic[2] == 'L' &&
892 bool Data2MSB = Magic[5] == 2;
893 unsigned high = Data2MSB ? 16 : 17;
894 unsigned low = Data2MSB ? 17 : 16;
895 if (Magic[high] == 0)
896 switch (Magic[low]) {
898 case 1: return file_magic::elf_relocatable;
899 case 2: return file_magic::elf_executable;
900 case 3: return file_magic::elf_shared_object;
901 case 4: return file_magic::elf_core;
907 if (Magic[1] == char(0xFE) && Magic[2] == char(0xBA) &&
908 Magic[3] == char(0xBE)) {
909 // This is complicated by an overlap with Java class files.
910 // See the Mach-O section in /usr/share/file/magic for details.
911 if (Magic.size() >= 8 && Magic[7] < 43)
912 return file_magic::macho_universal_binary;
916 // The two magic numbers for mach-o are:
917 // 0xfeedface - 32-bit mach-o
918 // 0xfeedfacf - 64-bit mach-o
923 if (Magic[0] == char(0xFE) && Magic[1] == char(0xED) &&
924 Magic[2] == char(0xFA) &&
925 (Magic[3] == char(0xCE) || Magic[3] == char(0xCF))) {
927 if (Magic.size() >= 16) type = Magic[14] << 8 | Magic[15];
928 } else if ((Magic[0] == char(0xCE) || Magic[0] == char(0xCF)) &&
929 Magic[1] == char(0xFA) && Magic[2] == char(0xED) &&
930 Magic[3] == char(0xFE)) {
932 if (Magic.size() >= 14) type = Magic[13] << 8 | Magic[12];
936 case 1: return file_magic::macho_object;
937 case 2: return file_magic::macho_executable;
938 case 3: return file_magic::macho_fixed_virtual_memory_shared_lib;
939 case 4: return file_magic::macho_core;
940 case 5: return file_magic::macho_preload_executable;
941 case 6: return file_magic::macho_dynamically_linked_shared_lib;
942 case 7: return file_magic::macho_dynamic_linker;
943 case 8: return file_magic::macho_bundle;
944 case 9: return file_magic::macho_dynamic_linker;
945 case 10: return file_magic::macho_dsym_companion;
949 case 0xF0: // PowerPC Windows
950 case 0x83: // Alpha 32-bit
951 case 0x84: // Alpha 64-bit
952 case 0x66: // MPS R4000 Windows
954 case 0x4c: // 80386 Windows
955 if (Magic[1] == 0x01)
956 return file_magic::coff_object;
958 case 0x90: // PA-RISC Windows
959 case 0x68: // mc68K Windows
960 if (Magic[1] == 0x02)
961 return file_magic::coff_object;
964 case 0x4d: // Possible MS-DOS stub on Windows PE file
965 if (Magic[1] == 0x5a) {
967 *reinterpret_cast<const support::ulittle32_t*>(Magic.data() + 0x3c);
968 // PE/COFF file, either EXE or DLL.
969 if (off < Magic.size() && memcmp(Magic.data() + off, "PE\0\0",4) == 0)
970 return file_magic::pecoff_executable;
974 case 0x64: // x86-64 Windows.
975 if (Magic[1] == char(0x86))
976 return file_magic::coff_object;
982 return file_magic::unknown;
985 error_code identify_magic(const Twine &path, file_magic &result) {
986 SmallString<32> Magic;
987 error_code ec = get_magic(path, Magic.capacity(), Magic);
988 if (ec && ec != errc::value_too_large)
991 result = identify_magic(Magic);
992 return error_code::success();
995 error_code directory_entry::status(file_status &result) const {
996 return fs::status(Path, result);
999 } // end namespace fs
1000 } // end namespace sys
1001 } // end namespace llvm
1003 // Include the truly platform-specific parts.
1004 #if defined(LLVM_ON_UNIX)
1005 #include "Unix/Path.inc"
1007 #if defined(LLVM_ON_WIN32)
1008 #include "Windows/Path.inc"