]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Frontend/HeaderSearchOptions.h
Update packet filter (pf) code to OpenBSD 4.5.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Frontend / HeaderSearchOptions.h
1 //===--- 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
13 #include "llvm/ADT/StringRef.h"
14 #include <vector>
15
16 namespace clang {
17
18 namespace frontend {
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.
27   };
28 }
29
30 /// HeaderSearchOptions - Helper class for storing options related to the
31 /// initialization of the HeaderSearch object.
32 class HeaderSearchOptions {
33 public:
34   struct Entry {
35     std::string Path;
36     frontend::IncludeDirGroup Group;
37     unsigned IsUserSupplied : 1;
38     unsigned IsFramework : 1;
39     
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
42     /// path.
43     unsigned IsSysRootRelative : 1;
44
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) {}
49   };
50
51   /// If non-empty, the directory to use as a "virtual system root" for include
52   /// paths.
53   std::string Sysroot;
54
55   /// User specified include entries.
56   std::vector<Entry> UserEntries;
57
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;
63
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;
69
70   /// The directory which holds the compiler resource files (builtin includes,
71   /// etc.).
72   std::string ResourceDir;
73
74   /// Include the compiler builtin includes.
75   unsigned UseBuiltinIncludes : 1;
76
77   /// Include the system standard include search directories.
78   unsigned UseStandardIncludes : 1;
79
80   /// Include the system standard C++ library include search directories.
81   unsigned UseStandardCXXIncludes : 1;
82
83   /// Whether header search information should be output as for -v.
84   unsigned Verbose : 1;
85
86 public:
87   HeaderSearchOptions(llvm::StringRef _Sysroot = "/")
88     : Sysroot(_Sysroot), UseBuiltinIncludes(true),
89       UseStandardIncludes(true), UseStandardCXXIncludes(true),
90       Verbose(false) {}
91
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,
96                                 IsSysRootRelative));
97   }
98 };
99
100 } // end namespace clang
101
102 #endif