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.
21 enum IncludeDirGroup {
22 Quoted = 0, ///< `#include ""` paths. Thing `gcc -iquote`.
23 Angled, ///< Paths for both `#include ""` and `#include <>`. (`-I`)
24 System, ///< Like Angled, but marks system directories.
25 CXXSystem, ///< Like System, but only used for C++.
26 After ///< Like System, but searched after the system directories.
30 /// HeaderSearchOptions - Helper class for storing options related to the
31 /// initialization of the HeaderSearch object.
32 class HeaderSearchOptions {
36 frontend::IncludeDirGroup Group;
37 unsigned IsUserSupplied : 1;
38 unsigned IsFramework : 1;
40 /// IsSysRootRelative - This is true if an absolute path should be treated
41 /// relative to the sysroot, or false if it should always be the absolute
43 unsigned IsSysRootRelative : 1;
45 Entry(llvm::StringRef path, frontend::IncludeDirGroup group,
46 bool isUserSupplied, bool isFramework, bool isSysRootRelative)
47 : Path(path), Group(group), IsUserSupplied(isUserSupplied),
48 IsFramework(isFramework), IsSysRootRelative(isSysRootRelative) {}
51 /// If non-empty, the directory to use as a "virtual system root" for include
55 /// User specified include entries.
56 std::vector<Entry> UserEntries;
58 /// A (system-path) delimited list of include paths to be added from the
59 /// environment following the user specified includes (but prior to builtin
60 /// and standard includes). This is parsed in the same manner as the CPATH
61 /// environment variable for gcc.
62 std::string EnvIncPath;
64 /// Per-language environmental include paths, see \see EnvIncPath.
65 std::string CEnvIncPath;
66 std::string ObjCEnvIncPath;
67 std::string CXXEnvIncPath;
68 std::string ObjCXXEnvIncPath;
70 /// The directory which holds the compiler resource files (builtin includes,
72 std::string ResourceDir;
74 /// Include the compiler builtin includes.
75 unsigned UseBuiltinIncludes : 1;
77 /// Include the system standard include search directories.
78 unsigned UseStandardIncludes : 1;
80 /// Include the system standard C++ library include search directories.
81 unsigned UseStandardCXXIncludes : 1;
83 /// Whether header search information should be output as for -v.
87 HeaderSearchOptions(llvm::StringRef _Sysroot = "/")
88 : Sysroot(_Sysroot), UseBuiltinIncludes(true),
89 UseStandardIncludes(true), UseStandardCXXIncludes(true),
92 /// AddPath - Add the \arg Path path to the specified \arg Group list.
93 void AddPath(llvm::StringRef Path, frontend::IncludeDirGroup Group,
94 bool IsUserSupplied, bool IsFramework, bool IsSysRootRelative) {
95 UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework,
100 } // end namespace clang