1 //===--- HeaderSearchOptions.h ----------------------------------*- C++ -*-===//
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 #ifndef LLVM_CLANG_FRONTEND_HEADERSEARCHOPTIONS_H
11 #define LLVM_CLANG_FRONTEND_HEADERSEARCHOPTIONS_H
13 #include "llvm/ADT/StringRef.h"
19 /// IncludeDirGroup - Identifiers the group a include entry belongs to, which
20 /// represents its relative positive in the search list. A #include of a ""
21 /// path starts at the -iquote group, then searches the Angled group, then
22 /// searches the system group, etc.
23 enum IncludeDirGroup {
24 Quoted = 0, ///< '#include ""' paths, added by'gcc -iquote'.
25 Angled, ///< Paths for '#include <>' added by '-I'.
26 IndexHeaderMap, ///< Like Angled, but marks header maps used when
27 /// building frameworks.
28 System, ///< Like Angled, but marks system directories.
29 CSystem, ///< Like System, but only used for C.
30 CXXSystem, ///< Like System, but only used for C++.
31 ObjCSystem, ///< Like System, but only used for ObjC.
32 ObjCXXSystem, ///< Like System, but only used for ObjC++.
33 After ///< Like System, but searched after the system directories.
37 /// HeaderSearchOptions - Helper class for storing options related to the
38 /// initialization of the HeaderSearch object.
39 class HeaderSearchOptions {
43 frontend::IncludeDirGroup Group;
44 unsigned IsUserSupplied : 1;
45 unsigned IsFramework : 1;
47 /// IgnoreSysRoot - This is false if an absolute path should be treated
48 /// relative to the sysroot, or true if it should always be the absolute
50 unsigned IgnoreSysRoot : 1;
52 Entry(StringRef path, frontend::IncludeDirGroup group,
53 bool isUserSupplied, bool isFramework, bool ignoreSysRoot)
54 : Path(path), Group(group), IsUserSupplied(isUserSupplied),
55 IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot) {}
58 /// If non-empty, the directory to use as a "virtual system root" for include
62 /// User specified include entries.
63 std::vector<Entry> UserEntries;
65 /// The directory which holds the compiler resource files (builtin includes,
67 std::string ResourceDir;
69 /// \brief The directory used for the module cache.
70 std::string ModuleCachePath;
72 /// \brief Whether we should disable the use of the hash string within the
75 /// Note: Only used for testing!
76 unsigned DisableModuleHash : 1;
78 /// Include the compiler builtin includes.
79 unsigned UseBuiltinIncludes : 1;
81 /// Include the system standard include search directories.
82 unsigned UseStandardSystemIncludes : 1;
84 /// Include the system standard C++ library include search directories.
85 unsigned UseStandardCXXIncludes : 1;
87 /// Use libc++ instead of the default libstdc++.
88 unsigned UseLibcxx : 1;
90 /// Whether header search information should be output as for -v.
94 HeaderSearchOptions(StringRef _Sysroot = "/")
95 : Sysroot(_Sysroot), DisableModuleHash(0), UseBuiltinIncludes(true),
96 UseStandardSystemIncludes(true), UseStandardCXXIncludes(true),
97 UseLibcxx(false), Verbose(false) {}
99 /// AddPath - Add the \arg Path path to the specified \arg Group list.
100 void AddPath(StringRef Path, frontend::IncludeDirGroup Group,
101 bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot) {
102 UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework,
107 } // end namespace clang