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;
266 unsigned angledDirIdx,
unsigned systemDirIdx,
267 bool noCurDirSearch) {
268 assert(angledDirIdx <= systemDirIdx && systemDirIdx <= dirs.size() &&
269 "Directory indicies are unordered");
271 AngledDirIdx = angledDirIdx;
272 SystemDirIdx = systemDirIdx;
273 NoCurDirSearch = noCurDirSearch;
279 unsigned idx = isAngled ? SystemDirIdx : AngledDirIdx;
280 SearchDirs.insert(SearchDirs.begin() + idx, dir);
288 SystemHeaderPrefixes.assign(
P.begin(),
P.end());
300 IncludeAliases.reset(
new IncludeAliasMap);
301 (*IncludeAliases)[Source] = Dest;
309 assert(IncludeAliases &&
"Trying to map headers when there's no map");
312 IncludeAliasMap::const_iterator Iter = IncludeAliases->find(Source);
313 if (Iter != IncludeAliases->end())
320 ModuleCachePath = CachePath;
328 DirectoryHasModuleMap[Dir] =
true;
337 ExternalLookup = EPS;
341 return ExternalLookup;
383 ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>> Includers,
386 bool SkipCache =
false);
402 return FrameworkMap[FWName];
411 bool isImport,
Module *CorrespondingModule);
436 bool IsCompiledModuleHeader);
567 bool findUsableModuleForHeader(
const FileEntry *File,
571 bool IsSystemHeaderDir);
578 bool findUsableModuleForFrameworkHeader(
579 const FileEntry *File, StringRef FrameworkDir,
Module *RequestingModule,
585 getFileAndSuggestModule(StringRef FileName,
const DirectoryEntry *Dir,
586 bool IsSystemHeaderDir,
Module *RequestingModule,
607 bool WantExternal =
true)
const;
616 return SearchDirs.begin();
619 return SearchDirs.begin() + AngledDirIdx;
623 return SearchDirs.begin() + AngledDirIdx;
626 return SearchDirs.begin() + SystemDirIdx;
630 return SearchDirs.begin() + SystemDirIdx;
646 enum LoadModuleMapResult {
658 LoadModuleMapResult loadModuleMapFileImpl(
const FileEntry *File,
660 const DirectoryEntry *Dir);
683 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.