]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/blob - contrib/llvm/tools/clang/include/clang/Frontend/HeaderSearchOptions.h
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
[FreeBSD/stable/9.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.  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.
29   };
30 }
31
32 /// HeaderSearchOptions - Helper class for storing options related to the
33 /// initialization of the HeaderSearch object.
34 class HeaderSearchOptions {
35 public:
36   struct Entry {
37     std::string Path;
38     frontend::IncludeDirGroup Group;
39     unsigned IsUserSupplied : 1;
40     unsigned IsFramework : 1;
41     
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
44     /// path.
45     unsigned IgnoreSysRoot : 1;
46
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) {}
51   };
52
53   /// If non-empty, the directory to use as a "virtual system root" for include
54   /// paths.
55   std::string Sysroot;
56
57   /// User specified include entries.
58   std::vector<Entry> UserEntries;
59
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;
65
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;
71
72   /// The directory which holds the compiler resource files (builtin includes,
73   /// etc.).
74   std::string ResourceDir;
75
76   /// Include the compiler builtin includes.
77   unsigned UseBuiltinIncludes : 1;
78
79   /// Include the system standard include search directories.
80   unsigned UseStandardIncludes : 1;
81
82   /// Include the system standard C++ library include search directories.
83   unsigned UseStandardCXXIncludes : 1;
84
85   /// Use libc++ instead of the default libstdc++.
86   unsigned UseLibcxx : 1;
87
88   /// Whether header search information should be output as for -v.
89   unsigned Verbose : 1;
90
91 public:
92   HeaderSearchOptions(llvm::StringRef _Sysroot = "/")
93     : Sysroot(_Sysroot), UseBuiltinIncludes(true),
94       UseStandardIncludes(true), UseStandardCXXIncludes(true), UseLibcxx(false),
95       Verbose(false) {}
96
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,
101                                 IgnoreSysRoot));
102   }
103 };
104
105 } // end namespace clang
106
107 #endif