| Daniel Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 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 | |
| Daniel Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 13 | #include "llvm/ADT/StringRef.h" |
| 14 | |
| 15 | namespace clang { |
| 16 | |
| Daniel Dunbar | 2cdafa8 | 2009-11-09 23:02:47 +0000 | [diff] [blame^] | 17 | namespace 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 Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 28 | /// HeaderSearchOptions - Helper class for storing options related to the |
| 29 | /// initialization of the HeaderSearch object. |
| 30 | class HeaderSearchOptions { |
| 31 | public: |
| 32 | struct Entry { |
| 33 | std::string Path; |
| Daniel Dunbar | 2cdafa8 | 2009-11-09 23:02:47 +0000 | [diff] [blame^] | 34 | frontend::IncludeDirGroup Group; |
| Daniel Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 35 | unsigned IsCXXAware : 1; |
| 36 | unsigned IsUserSupplied : 1; |
| 37 | unsigned IsFramework : 1; |
| 38 | unsigned IgnoreSysRoot : 1; |
| 39 | |
| Daniel Dunbar | 2cdafa8 | 2009-11-09 23:02:47 +0000 | [diff] [blame^] | 40 | Entry(llvm::StringRef _Path, frontend::IncludeDirGroup _Group, |
| Daniel Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 41 | 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 | |
| 77 | public: |
| Daniel Dunbar | 0f25ae8 | 2009-11-09 22:46:04 +0000 | [diff] [blame] | 78 | HeaderSearchOptions(llvm::StringRef _Sysroot = "") |
| Daniel Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 79 | : Sysroot(_Sysroot), UseStandardIncludes(true) {} |
| 80 | |
| 81 | /// AddPath - Add the \arg Path path to the specified \arg Group list. |
| Daniel Dunbar | 2cdafa8 | 2009-11-09 23:02:47 +0000 | [diff] [blame^] | 82 | void AddPath(llvm::StringRef Path, frontend::IncludeDirGroup Group, |
| Daniel Dunbar | 63c8b77 | 2009-11-07 04:20:50 +0000 | [diff] [blame] | 83 | 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 |