blob: ee8c60e8b01b71f2c8ac2b574506e5190f99c472 [file] [log] [blame]
Daniel Dunbar63c8b772009-11-07 04:20:50 +00001//===--- HeaderSearchOptions.h ----------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLVM_CLANG_FRONTEND_HEADERSEARCHOPTIONS_H
11#define LLVM_CLANG_FRONTEND_HEADERSEARCHOPTIONS_H
12
Daniel Dunbar63c8b772009-11-07 04:20:50 +000013#include "llvm/ADT/StringRef.h"
14
15namespace clang {
16
Daniel Dunbar2cdafa82009-11-09 23:02:47 +000017namespace frontend {
18 /// IncludeDirGroup - Identifiers the group a include entry belongs to, which
19 /// represents its relative positive in the search list.
20 enum IncludeDirGroup {
21 Quoted = 0, ///< `#include ""` paths. Thing `gcc -iquote`.
22 Angled, ///< Paths for both `#include ""` and `#include <>`. (`-I`)
23 System, ///< Like Angled, but marks system directories.
24 After ///< Like System, but searched after the system directories.
25 };
26}
27
Daniel Dunbar63c8b772009-11-07 04:20:50 +000028/// HeaderSearchOptions - Helper class for storing options related to the
29/// initialization of the HeaderSearch object.
30class HeaderSearchOptions {
31public:
32 struct Entry {
33 std::string Path;
Daniel Dunbar2cdafa82009-11-09 23:02:47 +000034 frontend::IncludeDirGroup Group;
Daniel Dunbar63c8b772009-11-07 04:20:50 +000035 unsigned IsCXXAware : 1;
36 unsigned IsUserSupplied : 1;
37 unsigned IsFramework : 1;
38 unsigned IgnoreSysRoot : 1;
39
Daniel Dunbar2cdafa82009-11-09 23:02:47 +000040 Entry(llvm::StringRef _Path, frontend::IncludeDirGroup _Group,
Daniel Dunbar63c8b772009-11-07 04:20:50 +000041 bool _IsCXXAware, bool _IsUserSupplied, bool _IsFramework,
42 bool _IgnoreSysRoot)
43 : Path(_Path), Group(_Group), IsCXXAware(_IsCXXAware),
44 IsUserSupplied(_IsUserSupplied), IsFramework(_IsFramework),
45 IgnoreSysRoot(_IgnoreSysRoot) {}
46 };
47
48 /// If non-empty, the directory to use as a "virtual system root" for include
49 /// paths.
50 std::string Sysroot;
51
52 /// User specified include entries.
53 std::vector<Entry> UserEntries;
54
55 /// A (system-path) delimited list of include paths to be added from the
56 /// environment following the user specified includes (but prior to builtin
57 /// and standard includes). This is parsed in the same manner as the CPATH
58 /// environment variable for gcc.
59 std::string EnvIncPath;
60
61 /// A (system-path) delimited list of include paths to be added from the
62 /// environment following the user specified includes and the \see EnvIncPath
63 /// includes (but prior to builtin and standard includes). This is parsed in
64 /// the same manner as the CPATH environment variable for gcc.
65 std::string LangEnvIncPath;
66
67 /// If non-empty, the path to the compiler builtin include directory, which
68 /// will be searched following the user and environment includes.
69 std::string BuiltinIncludePath;
70
71 /// Include the system standard include search directories.
72 unsigned UseStandardIncludes : 1;
73
74 /// Whether header search information should be output as for -v.
75 unsigned Verbose : 1;
76
77public:
Daniel Dunbar0f25ae82009-11-09 22:46:04 +000078 HeaderSearchOptions(llvm::StringRef _Sysroot = "")
Daniel Dunbar63c8b772009-11-07 04:20:50 +000079 : Sysroot(_Sysroot), UseStandardIncludes(true) {}
80
81 /// AddPath - Add the \arg Path path to the specified \arg Group list.
Daniel Dunbar2cdafa82009-11-09 23:02:47 +000082 void AddPath(llvm::StringRef Path, frontend::IncludeDirGroup Group,
Daniel Dunbar63c8b772009-11-07 04:20:50 +000083 bool IsCXXAware, bool IsUserSupplied,
84 bool IsFramework, bool IgnoreSysRoot = false) {
85 UserEntries.push_back(Entry(Path, Group, IsCXXAware, IsUserSupplied,
86 IsFramework, IgnoreSysRoot));
87 }
88};
89
90} // end namespace clang
91
92#endif