14 #ifndef LLVM_CLANG_LEX_HEADERSEARCH_H
15 #define LLVM_CLANG_LEX_HEADERSEARCH_H
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/IntrusiveRefCntPtr.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/ADT/StringSet.h"
23 #include "llvm/Support/Allocator.h"
29 class DiagnosticsEngine;
30 class ExternalPreprocessorSource;
33 class HeaderSearchOptions;
139 struct FrameworkCacheEntry {
146 bool IsUserSpecifiedSystemFramework;
160 std::vector<DirectoryLookup> SearchDirs;
161 unsigned AngledDirIdx;
162 unsigned SystemDirIdx;
171 std::vector<std::pair<std::string, bool> > SystemHeaderPrefixes;
174 std::string ModuleCachePath;
178 mutable std::vector<HeaderFileInfo> FileInfo;
181 struct LookupFileCacheInfo {
190 const char *MappedName;
193 LookupFileCacheInfo(): StartIdx(0), HitIdx(0), MappedName(
nullptr) {}
195 void reset(
unsigned StartIdx) {
196 this->StartIdx = StartIdx;
197 this->MappedName =
nullptr;
200 llvm::StringMap<LookupFileCacheInfo, llvm::BumpPtrAllocator> LookupFileCache;
204 llvm::StringMap<FrameworkCacheEntry, llvm::BumpPtrAllocator> FrameworkMap;
209 typedef llvm::StringMap<std::string, llvm::BumpPtrAllocator>
211 std::unique_ptr<IncludeAliasMap> IncludeAliases;
215 std::vector<std::pair<const FileEntry*, const HeaderMap*> > HeaderMaps;
221 llvm::DenseMap<const DirectoryEntry *, bool> DirectoryHasModuleMap;
225 llvm::DenseMap<const FileEntry *, bool> LoadedModuleMaps;
229 llvm::StringSet<llvm::BumpPtrAllocator> FrameworkNames;
240 unsigned NumIncluded;
241 unsigned NumMultiIncludeFileOptzn;
242 unsigned NumFrameworkLookups, NumSubFrameworkLookups;
264 unsigned angledDirIdx,
unsigned systemDirIdx,
265 bool noCurDirSearch) {
266 assert(angledDirIdx <= systemDirIdx && systemDirIdx <= dirs.size() &&
267 "Directory indicies are unordered");
269 AngledDirIdx = angledDirIdx;
270 SystemDirIdx = systemDirIdx;
271 NoCurDirSearch = noCurDirSearch;
277 unsigned idx = isAngled ? SystemDirIdx : AngledDirIdx;
278 SearchDirs.insert(SearchDirs.begin() + idx, dir);
286 SystemHeaderPrefixes.assign(
P.begin(),
P.end());
298 IncludeAliases.reset(
new IncludeAliasMap);
299 (*IncludeAliases)[Source] = Dest;
307 assert(IncludeAliases &&
"Trying to map headers when there's no map");
310 IncludeAliasMap::const_iterator Iter = IncludeAliases->find(Source);
311 if (Iter != IncludeAliases->end())
318 ModuleCachePath = CachePath;
326 DirectoryHasModuleMap[Dir] =
true;
335 ExternalLookup = EPS;
339 return ExternalLookup;
381 ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>> Includers,
384 bool SkipCache =
false,
bool BuildSystemModule =
false);
400 return FrameworkMap[FWName];
409 bool isImport,
Module *CorrespondingModule);
434 bool IsCompiledModuleHeader);
565 bool findUsableModuleForHeader(
const FileEntry *File,
569 bool IsSystemHeaderDir);
576 bool findUsableModuleForFrameworkHeader(
577 const FileEntry *File, StringRef FrameworkDir,
Module *RequestingModule,
606 bool WantExternal =
true)
const;
615 return SearchDirs.begin();
618 return SearchDirs.begin() + AngledDirIdx;
622 return SearchDirs.begin() + AngledDirIdx;
625 return SearchDirs.begin() + SystemDirIdx;
629 return SearchDirs.begin() + SystemDirIdx;
642 bool *IsSystem =
nullptr);
650 enum LoadModuleMapResult {
662 LoadModuleMapResult loadModuleMapFileImpl(
const FileEntry *File,
664 const DirectoryEntry *Dir);
687 bool IsSystem,
bool IsFramework);
Implements support for file system lookup, file system caching, and directory search management...
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
One of these records is kept for each identifier that is lexed.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Describes a module or submodule.
Concrete class used by the front-end to report problems and issues.
ModuleHeaderRole
Flags describing the role of a module header.
Exposes information about the current target.
Abstract interface for external sources of preprocessor information.
DirectoryLookup - This class represents one entry in the search list that specifies the search order ...
Encodes a location in the source.
Cached information about one file (either on disk or in the virtual file system). ...
Cached information about one directory (either on disk or in the virtual file system).
This class handles loading and caching of source files into memory.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.