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 System, ///< Like Angled, but marks system directories.
27 CXXSystem, ///< Like System, but only used for C++.
28 After ///< Like System, but searched after the system directories.
32 /// HeaderSearchOptions - Helper class for storing options related to the
33 /// initialization of the HeaderSearch object.
34 class HeaderSearchOptions {
38 frontend::IncludeDirGroup Group;
39 unsigned IsUserSupplied : 1;
40 unsigned IsFramework : 1;
42 /// IgnoreSysRoot - This is false if an absolute path should be treated
43 /// relative to the sysroot, or true if it should always be the absolute
45 unsigned IgnoreSysRoot : 1;
47 Entry(llvm::StringRef path, frontend::IncludeDirGroup group,
48 bool isUserSupplied, bool isFramework, bool ignoreSysRoot)
49 : Path(path), Group(group), IsUserSupplied(isUserSupplied),
50 IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot) {}
53 /// If non-empty, the directory to use as a "virtual system root" for include
57 /// User specified include entries.
58 std::vector<Entry> UserEntries;
60 /// A (system-path) delimited list of include paths to be added from the
61 /// environment following the user specified includes (but prior to builtin
62 /// and standard includes). This is parsed in the same manner as the CPATH
63 /// environment variable for gcc.
64 std::string EnvIncPath;
66 /// Per-language environmental include paths, see \see EnvIncPath.
67 std::string CEnvIncPath;
68 std::string ObjCEnvIncPath;
69 std::string CXXEnvIncPath;
70 std::string ObjCXXEnvIncPath;
72 /// The directory which holds the compiler resource files (builtin includes,
74 std::string ResourceDir;
76 /// Include the compiler builtin includes.
77 unsigned UseBuiltinIncludes : 1;
79 /// Include the system standard include search directories.
80 unsigned UseStandardIncludes : 1;
82 /// Include the system standard C++ library include search directories.
83 unsigned UseStandardCXXIncludes : 1;
85 /// Use libc++ instead of the default libstdc++.
86 unsigned UseLibcxx : 1;
88 /// Whether header search information should be output as for -v.
92 HeaderSearchOptions(llvm::StringRef _Sysroot = "/")
93 : Sysroot(_Sysroot), UseBuiltinIncludes(true),
94 UseStandardIncludes(true), UseStandardCXXIncludes(true), UseLibcxx(false),
97 /// AddPath - Add the \arg Path path to the specified \arg Group list.
98 void AddPath(llvm::StringRef Path, frontend::IncludeDirGroup Group,
99 bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot) {
100 UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework,
105 } // end namespace clang