clang 20.0.0git
HeaderSearch.h
Go to the documentation of this file.
1//===- HeaderSearch.h - Resolve Header File Locations -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the HeaderSearch interface.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LEX_HEADERSEARCH_H
14#define LLVM_CLANG_LEX_HEADERSEARCH_H
15
20#include "clang/Lex/HeaderMap.h"
21#include "clang/Lex/ModuleMap.h"
22#include "llvm/ADT/ArrayRef.h"
23#include "llvm/ADT/DenseMap.h"
24#include "llvm/ADT/SmallString.h"
25#include "llvm/ADT/StringMap.h"
26#include "llvm/ADT/StringRef.h"
27#include "llvm/ADT/StringSet.h"
28#include "llvm/Support/Allocator.h"
29#include <cassert>
30#include <cstddef>
31#include <memory>
32#include <string>
33#include <utility>
34#include <vector>
35
36namespace llvm {
37
38class Triple;
39
40} // namespace llvm
41
42namespace clang {
43
44class DiagnosticsEngine;
45class DirectoryEntry;
46class ExternalPreprocessorSource;
47class FileEntry;
48class FileManager;
49class HeaderSearch;
50class HeaderSearchOptions;
51class IdentifierInfo;
52class LangOptions;
53class Module;
54class Preprocessor;
55class TargetInfo;
56
57/// The preprocessor keeps track of this information for each
58/// file that is \#included.
60 // TODO: Whether the file was included is not a property of the file itself.
61 // It's a preprocessor state, move it there.
62 /// True if this file has been included (or imported) **locally**.
63 LLVM_PREFERRED_TYPE(bool)
65
66 // TODO: Whether the file was imported is not a property of the file itself.
67 // It's a preprocessor state, move it there.
68 /// True if this is a \#import'd file.
69 LLVM_PREFERRED_TYPE(bool)
70 unsigned isImport : 1;
71
72 /// True if this is a \#pragma once file.
73 LLVM_PREFERRED_TYPE(bool)
74 unsigned isPragmaOnce : 1;
75
76 /// Keep track of whether this is a system header, and if so,
77 /// whether it is C++ clean or not. This can be set by the include paths or
78 /// by \#pragma gcc system_header. This is an instance of
79 /// SrcMgr::CharacteristicKind.
80 LLVM_PREFERRED_TYPE(SrcMgr::CharacteristicKind)
81 unsigned DirInfo : 3;
82
83 /// Whether this header file info was supplied by an external source,
84 /// and has not changed since.
85 LLVM_PREFERRED_TYPE(bool)
86 unsigned External : 1;
87
88 /// Whether this header is part of and built with a module. i.e. it is listed
89 /// in a module map, and is not `excluded` or `textual`. (same meaning as
90 /// `ModuleMap::isModular()`).
91 LLVM_PREFERRED_TYPE(bool)
92 unsigned isModuleHeader : 1;
93
94 /// Whether this header is a `textual header` in a module. If a header is
95 /// textual in one module and normal in another module, this bit will not be
96 /// set, only `isModuleHeader`.
97 LLVM_PREFERRED_TYPE(bool)
99
100 /// Whether this header is part of the module that we are building, even if it
101 /// doesn't build with the module. i.e. this will include `excluded` and
102 /// `textual` headers as well as normal headers.
103 LLVM_PREFERRED_TYPE(bool)
105
106 /// Whether this structure is considered to already have been
107 /// "resolved", meaning that it was loaded from the external source.
108 LLVM_PREFERRED_TYPE(bool)
109 unsigned Resolved : 1;
110
111 /// Whether this file has been looked up as a header.
112 LLVM_PREFERRED_TYPE(bool)
113 unsigned IsValid : 1;
114
115 /// If this file has a \#ifndef XXX (or equivalent) guard that
116 /// protects the entire contents of the file, this is the identifier
117 /// for the macro that controls whether or not it has any effect.
118 ///
119 /// Note: Most clients should use getControllingMacro() to access
120 /// the controlling macro of this header, since
121 /// getControllingMacro() is able to load a controlling macro from
122 /// external storage.
124
127 DirInfo(SrcMgr::C_User), External(false), isModuleHeader(false),
130
131 /// Retrieve the controlling macro for this header file, if
132 /// any.
133 const IdentifierInfo *
135
136 /// Update the module membership bits based on the header role.
137 ///
138 /// isModuleHeader will potentially be set, but not cleared.
139 /// isTextualModuleHeader will be set or cleared based on the role update.
141};
142
143static_assert(sizeof(HeaderFileInfo) <= 16);
144
145/// An external source of header file information, which may supply
146/// information about header files already included.
148public:
150
151 /// Retrieve the header file information for the given file entry.
152 ///
153 /// \returns Header file information for the given file entry, with the
154 /// \c External bit set. If the file entry is not known, return a
155 /// default-constructed \c HeaderFileInfo.
157};
158
159/// This structure is used to record entries in our framework cache.
161 /// The directory entry which should be used for the cached framework.
163
164 /// Whether this framework has been "user-specified" to be treated as if it
165 /// were a system framework (even if it was found outside a system framework
166 /// directory).
168};
169
170namespace detail {
171template <bool Const, typename T>
172using Qualified = std::conditional_t<Const, const T, T>;
173
174/// Forward iterator over the search directories of \c HeaderSearch.
175template <bool IsConst>
177 : llvm::iterator_facade_base<SearchDirIteratorImpl<IsConst>,
178 std::forward_iterator_tag,
179 Qualified<IsConst, DirectoryLookup>> {
180 /// Const -> non-const iterator conversion.
181 template <typename Enable = std::enable_if<IsConst, bool>>
183 : HS(Other.HS), Idx(Other.Idx) {}
184
186
188
189 bool operator==(const SearchDirIteratorImpl &RHS) const {
190 return HS == RHS.HS && Idx == RHS.Idx;
191 }
192
194 assert(*this && "Invalid iterator.");
195 ++Idx;
196 return *this;
197 }
198
200 assert(*this && "Invalid iterator.");
201 return HS->SearchDirs[Idx];
202 }
203
204 /// Creates an invalid iterator.
205 SearchDirIteratorImpl(std::nullptr_t) : HS(nullptr), Idx(0) {}
206
207 /// Checks whether the iterator is valid.
208 explicit operator bool() const { return HS != nullptr; }
209
210private:
211 /// The parent \c HeaderSearch. This is \c nullptr for invalid iterator.
213
214 /// The index of the current element.
215 size_t Idx;
216
217 /// The constructor that creates a valid iterator.
219 : HS(&HS), Idx(Idx) {}
220
221 /// Only HeaderSearch is allowed to instantiate valid iterators.
222 friend HeaderSearch;
223
224 /// Enables const -> non-const conversion.
225 friend SearchDirIteratorImpl<!IsConst>;
226};
227} // namespace detail
228
231
232using ConstSearchDirRange = llvm::iterator_range<ConstSearchDirIterator>;
233using SearchDirRange = llvm::iterator_range<SearchDirIterator>;
234
235/// Encapsulates the information needed to find the file referenced
236/// by a \#include or \#include_next, (sub-)framework lookup, etc.
238 friend class DirectoryLookup;
239
241 friend SearchDirIterator;
242
243 /// Header-search options used to initialize this header search.
244 std::shared_ptr<HeaderSearchOptions> HSOpts;
245
246 /// Mapping from SearchDir to HeaderSearchOptions::UserEntries indices.
247 llvm::DenseMap<unsigned, unsigned> SearchDirToHSEntry;
248
249 DiagnosticsEngine &Diags;
250 FileManager &FileMgr;
251
252 /// \#include search path information. Requests for \#include "x" search the
253 /// directory of the \#including file first, then each directory in SearchDirs
254 /// consecutively. Requests for <x> search the current dir first, then each
255 /// directory in SearchDirs, starting at AngledDirIdx, consecutively.
256 std::vector<DirectoryLookup> SearchDirs;
257 /// Whether the DirectoryLookup at the corresponding index in SearchDirs has
258 /// been successfully used to lookup a file.
259 std::vector<bool> SearchDirsUsage;
260 unsigned AngledDirIdx = 0;
261 unsigned SystemDirIdx = 0;
262
263 /// Maps HeaderMap keys to SearchDir indices. When HeaderMaps are used
264 /// heavily, SearchDirs can start with thousands of HeaderMaps, so this Index
265 /// lets us avoid scanning them all to find a match.
266 llvm::StringMap<unsigned, llvm::BumpPtrAllocator> SearchDirHeaderMapIndex;
267
268 /// The index of the first SearchDir that isn't a header map.
269 unsigned FirstNonHeaderMapSearchDirIdx = 0;
270
271 /// \#include prefixes for which the 'system header' property is
272 /// overridden.
273 ///
274 /// For a \#include "x" or \#include <x> directive, the last string in this
275 /// list which is a prefix of 'x' determines whether the file is treated as
276 /// a system header.
277 std::vector<std::pair<std::string, bool>> SystemHeaderPrefixes;
278
279 /// The hash used for module cache paths.
280 std::string ModuleHash;
281
282 /// The path to the module cache.
283 std::string ModuleCachePath;
284
285 /// All of the preprocessor-specific data about files that are
286 /// included, indexed by the FileEntry's UID.
287 mutable std::vector<HeaderFileInfo> FileInfo;
288
289 /// Keeps track of each lookup performed by LookupFile.
290 struct LookupFileCacheInfo {
291 // The requesting module for the lookup we cached.
292 const Module *RequestingModule = nullptr;
293
294 /// Starting search directory iterator that the cached search was performed
295 /// from. If there is a hit and this value doesn't match the current query,
296 /// the cache has to be ignored.
297 ConstSearchDirIterator StartIt = nullptr;
298
299 /// The search directory iterator that satisfied the query.
300 ConstSearchDirIterator HitIt = nullptr;
301
302 /// This is non-null if the original filename was mapped to a framework
303 /// include via a headermap.
304 const char *MappedName = nullptr;
305
306 /// Default constructor -- Initialize all members with zero.
307 LookupFileCacheInfo() = default;
308
309 void reset(const Module *NewRequestingModule,
310 ConstSearchDirIterator NewStartIt) {
311 RequestingModule = NewRequestingModule;
312 StartIt = NewStartIt;
313 MappedName = nullptr;
314 }
315 };
316 llvm::StringMap<LookupFileCacheInfo, llvm::BumpPtrAllocator> LookupFileCache;
317
318 /// Collection mapping a framework or subframework
319 /// name like "Carbon" to the Carbon.framework directory.
320 llvm::StringMap<FrameworkCacheEntry, llvm::BumpPtrAllocator> FrameworkMap;
321
322 /// Maps include file names (including the quotes or
323 /// angle brackets) to other include file names. This is used to support the
324 /// include_alias pragma for Microsoft compatibility.
325 using IncludeAliasMap =
326 llvm::StringMap<std::string, llvm::BumpPtrAllocator>;
327 std::unique_ptr<IncludeAliasMap> IncludeAliases;
328
329 /// This is a mapping from FileEntry -> HeaderMap, uniquing headermaps.
330 std::vector<std::pair<FileEntryRef, std::unique_ptr<HeaderMap>>> HeaderMaps;
331
332 /// The mapping between modules and headers.
333 mutable ModuleMap ModMap;
334
335 /// Describes whether a given directory has a module map in it.
336 llvm::DenseMap<const DirectoryEntry *, bool> DirectoryHasModuleMap;
337
338 /// Set of module map files we've already loaded, and a flag indicating
339 /// whether they were valid or not.
340 llvm::DenseMap<const FileEntry *, bool> LoadedModuleMaps;
341
342 // A map of discovered headers with their associated include file name.
343 llvm::DenseMap<const FileEntry *, llvm::SmallString<64>> IncludeNames;
344
345 /// Uniqued set of framework names, which is used to track which
346 /// headers were included as framework headers.
347 llvm::StringSet<llvm::BumpPtrAllocator> FrameworkNames;
348
349 /// Entity used to resolve the identifier IDs of controlling
350 /// macros into IdentifierInfo pointers, and keep the identifire up to date,
351 /// as needed.
352 ExternalPreprocessorSource *ExternalLookup = nullptr;
353
354 /// Entity used to look up stored header file information.
355 ExternalHeaderFileInfoSource *ExternalSource = nullptr;
356
357 /// Scan all of the header maps at the beginning of SearchDirs and
358 /// map their keys to the SearchDir index of their header map.
359 void indexInitialHeaderMaps();
360
361public:
362 HeaderSearch(std::shared_ptr<HeaderSearchOptions> HSOpts,
363 SourceManager &SourceMgr, DiagnosticsEngine &Diags,
364 const LangOptions &LangOpts, const TargetInfo *Target);
365 HeaderSearch(const HeaderSearch &) = delete;
367
368 /// Retrieve the header-search options with which this header search
369 /// was initialized.
370 HeaderSearchOptions &getHeaderSearchOpts() const { return *HSOpts; }
371
372 FileManager &getFileMgr() const { return FileMgr; }
373
374 DiagnosticsEngine &getDiags() const { return Diags; }
375
376 /// Interface for setting the file search paths.
377 void SetSearchPaths(std::vector<DirectoryLookup> dirs, unsigned angledDirIdx,
378 unsigned systemDirIdx,
379 llvm::DenseMap<unsigned, unsigned> searchDirToHSEntry);
380
381 /// Add an additional search path.
382 void AddSearchPath(const DirectoryLookup &dir, bool isAngled);
383
384 /// Add an additional system search path.
386 SearchDirs.push_back(dir);
387 SearchDirsUsage.push_back(false);
388 }
389
390 /// Set the list of system header prefixes.
391 void SetSystemHeaderPrefixes(ArrayRef<std::pair<std::string, bool>> P) {
392 SystemHeaderPrefixes.assign(P.begin(), P.end());
393 }
394
395 /// Checks whether the map exists or not.
396 bool HasIncludeAliasMap() const { return (bool)IncludeAliases; }
397
398 /// Map the source include name to the dest include name.
399 ///
400 /// The Source should include the angle brackets or quotes, the dest
401 /// should not. This allows for distinction between <> and "" headers.
402 void AddIncludeAlias(StringRef Source, StringRef Dest) {
403 if (!IncludeAliases)
404 IncludeAliases.reset(new IncludeAliasMap);
405 (*IncludeAliases)[Source] = std::string(Dest);
406 }
407
408 /// Maps one header file name to a different header
409 /// file name, for use with the include_alias pragma. Note that the source
410 /// file name should include the angle brackets or quotes. Returns StringRef
411 /// as null if the header cannot be mapped.
412 StringRef MapHeaderToIncludeAlias(StringRef Source) {
413 assert(IncludeAliases && "Trying to map headers when there's no map");
414
415 // Do any filename replacements before anything else
416 IncludeAliasMap::const_iterator Iter = IncludeAliases->find(Source);
417 if (Iter != IncludeAliases->end())
418 return Iter->second;
419 return {};
420 }
421
422 /// Set the hash to use for module cache paths.
423 void setModuleHash(StringRef Hash) { ModuleHash = std::string(Hash); }
424
425 /// Set the path to the module cache.
426 void setModuleCachePath(StringRef CachePath) {
427 ModuleCachePath = std::string(CachePath);
428 }
429
430 /// Retrieve the module hash.
431 StringRef getModuleHash() const { return ModuleHash; }
432
433 /// Retrieve the path to the module cache.
434 StringRef getModuleCachePath() const { return ModuleCachePath; }
435
436 /// Consider modules when including files from this directory.
438 DirectoryHasModuleMap[Dir] = true;
439 }
440
441 /// Forget everything we know about headers so far.
443 FileInfo.clear();
444 }
445
447 ExternalLookup = EPS;
448 }
449
451 return ExternalLookup;
452 }
453
454 /// Set the external source of header information.
456 ExternalSource = ES;
457 }
458
459 /// Set the target information for the header search, if not
460 /// already known.
461 void setTarget(const TargetInfo &Target);
462
463 /// Given a "foo" or <foo> reference, look up the indicated file,
464 /// return null on failure.
465 ///
466 /// \returns If successful, this returns 'UsedDir', the DirectoryLookup member
467 /// the file was found in, or null if not applicable.
468 ///
469 /// \param IncludeLoc Used for diagnostics if valid.
470 ///
471 /// \param isAngled indicates whether the file reference is a <> reference.
472 ///
473 /// \param CurDir If non-null, the file was found in the specified directory
474 /// search location. This is used to implement \#include_next.
475 ///
476 /// \param Includers Indicates where the \#including file(s) are, in case
477 /// relative searches are needed. In reverse order of inclusion.
478 ///
479 /// \param SearchPath If non-null, will be set to the search path relative
480 /// to which the file was found. If the include path is absolute, SearchPath
481 /// will be set to an empty string.
482 ///
483 /// \param RelativePath If non-null, will be set to the path relative to
484 /// SearchPath at which the file was found. This only differs from the
485 /// Filename for framework includes.
486 ///
487 /// \param SuggestedModule If non-null, and the file found is semantically
488 /// part of a known module, this will be set to the module that should
489 /// be imported instead of preprocessing/parsing the file found.
490 ///
491 /// \param IsMapped If non-null, and the search involved header maps, set to
492 /// true.
493 ///
494 /// \param IsFrameworkFound If non-null, will be set to true if a framework is
495 /// found in any of searched SearchDirs. Will be set to false if a framework
496 /// is found only through header maps. Doesn't guarantee the requested file is
497 /// found.
499 StringRef Filename, SourceLocation IncludeLoc, bool isAngled,
501 ArrayRef<std::pair<OptionalFileEntryRef, DirectoryEntryRef>> Includers,
502 SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
503 Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule,
504 bool *IsMapped, bool *IsFrameworkFound, bool SkipCache = false,
505 bool BuildSystemModule = false, bool OpenFile = true,
506 bool CacheFailures = true);
507
508 /// Look up a subframework for the specified \#include file.
509 ///
510 /// For example, if \#include'ing <HIToolbox/HIToolbox.h> from
511 /// within ".../Carbon.framework/Headers/Carbon.h", check to see if
512 /// HIToolbox is a subframework within Carbon.framework. If so, return
513 /// the FileEntry for the designated file, otherwise return null.
515 StringRef Filename, FileEntryRef ContextFileEnt,
516 SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
517 Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule);
518
519 /// Look up the specified framework name in our framework cache.
520 /// \returns The DirectoryEntry it is in if we know, null otherwise.
522 return FrameworkMap[FWName];
523 }
524
525 /// Mark the specified file as a target of a \#include,
526 /// \#include_next, or \#import directive.
527 ///
528 /// \return false if \#including the file will have no effect or true
529 /// if we should include it.
530 ///
531 /// \param M The module to which `File` belongs (this should usually be the
532 /// SuggestedModule returned by LookupFile/LookupSubframeworkHeader)
534 bool isImport, bool ModulesEnabled, Module *M,
535 bool &IsFirstIncludeOfFile);
536
537 /// Return whether the specified file is a normal header,
538 /// a system header, or a C++ friendly system header.
540 if (const HeaderFileInfo *HFI = getExistingFileInfo(File))
541 return (SrcMgr::CharacteristicKind)HFI->DirInfo;
543 }
544
545 /// Mark the specified file as a "once only" file due to
546 /// \#pragma once.
549 }
550
551 /// Mark the specified file as a system header, e.g. due to
552 /// \#pragma GCC system_header.
555 }
556
557 /// Mark the specified file as part of a module.
559 bool isCompilingModuleHeader);
560
561 /// Mark the specified file as having a controlling macro.
562 ///
563 /// This is used by the multiple-include optimization to eliminate
564 /// no-op \#includes.
566 const IdentifierInfo *ControllingMacro) {
567 getFileInfo(File).LazyControllingMacro = ControllingMacro;
568 }
569
570 /// Determine whether this file is intended to be safe from
571 /// multiple inclusions, e.g., it has \#pragma once or a controlling
572 /// macro.
573 ///
574 /// This routine does not consider the effect of \#import
576
577 /// Determine whether the given file is known to have ever been \#imported.
580 return FI && FI->isImport;
581 }
582
583 /// Determine which HeaderSearchOptions::UserEntries have been successfully
584 /// used so far and mark their index with 'true' in the resulting bit vector.
585 /// Note: implicit module maps don't contribute to entry usage.
586 std::vector<bool> computeUserEntryUsage() const;
587
588 /// Collect which HeaderSearchOptions::VFSOverlayFiles have been meaningfully
589 /// used so far and mark their index with 'true' in the resulting bit vector.
590 ///
591 /// Note: this ignores VFSs that redirect non-affecting files such as unused
592 /// modulemaps.
593 std::vector<bool> collectVFSUsageAndClear() const;
594
595 /// This method returns a HeaderMap for the specified
596 /// FileEntry, uniquing them through the 'HeaderMaps' datastructure.
598
599 /// Get filenames for all registered header maps.
601
602 /// Retrieve the name of the cached module file that should be used
603 /// to load the given module.
604 ///
605 /// \param Module The module whose module file name will be returned.
606 ///
607 /// \returns The name of the module file that corresponds to this module,
608 /// or an empty string if this module does not correspond to any module file.
610
611 /// Retrieve the name of the prebuilt module file that should be used
612 /// to load a module with the given name.
613 ///
614 /// \param ModuleName The module whose module file name will be returned.
615 ///
616 /// \param FileMapOnly If true, then only look in the explicit module name
617 // to file name map and skip the directory search.
618 ///
619 /// \returns The name of the module file that corresponds to this module,
620 /// or an empty string if this module does not correspond to any module file.
621 std::string getPrebuiltModuleFileName(StringRef ModuleName,
622 bool FileMapOnly = false);
623
624 /// Retrieve the name of the prebuilt module file that should be used
625 /// to load the given module.
626 ///
627 /// \param Module The module whose module file name will be returned.
628 ///
629 /// \returns The name of the module file that corresponds to this module,
630 /// or an empty string if this module does not correspond to any module file.
632
633 /// Retrieve the name of the (to-be-)cached module file that should
634 /// be used to load a module with the given name.
635 ///
636 /// \param ModuleName The module whose module file name will be returned.
637 ///
638 /// \param ModuleMapPath A path that when combined with \c ModuleName
639 /// uniquely identifies this module. See Module::ModuleMap.
640 ///
641 /// \returns The name of the module file that corresponds to this module,
642 /// or an empty string if this module does not correspond to any module file.
643 std::string getCachedModuleFileName(StringRef ModuleName,
644 StringRef ModuleMapPath);
645
646 /// Lookup a module Search for a module with the given name.
647 ///
648 /// \param ModuleName The name of the module we're looking for.
649 ///
650 /// \param ImportLoc Location of the module include/import.
651 ///
652 /// \param AllowSearch Whether we are allowed to search in the various
653 /// search directories to produce a module definition. If not, this lookup
654 /// will only return an already-known module.
655 ///
656 /// \param AllowExtraModuleMapSearch Whether we allow to search modulemaps
657 /// in subdirectories.
658 ///
659 /// \returns The module with the given name.
660 Module *lookupModule(StringRef ModuleName,
661 SourceLocation ImportLoc = SourceLocation(),
662 bool AllowSearch = true,
663 bool AllowExtraModuleMapSearch = false);
664
665 /// Try to find a module map file in the given directory, returning
666 /// \c nullopt if none is found.
668 bool IsFramework);
669
670 /// Determine whether there is a module map that may map the header
671 /// with the given file name to a (sub)module.
672 /// Always returns false if modules are disabled.
673 ///
674 /// \param Filename The name of the file.
675 ///
676 /// \param Root The "root" directory, at which we should stop looking for
677 /// module maps.
678 ///
679 /// \param IsSystem Whether the directories we're looking at are system
680 /// header directories.
681 bool hasModuleMap(StringRef Filename, const DirectoryEntry *Root,
682 bool IsSystem);
683
684 /// Retrieve the module that corresponds to the given file, if any.
685 ///
686 /// \param File The header that we wish to map to a module.
687 /// \param AllowTextual Whether we want to find textual headers too.
689 bool AllowTextual = false,
690 bool AllowExcluded = false) const;
691
692 /// Retrieve all the modules corresponding to the given file.
693 ///
694 /// \ref findModuleForHeader should typically be used instead of this.
697
698 /// Like \ref findAllModulesForHeader, but do not attempt to infer module
699 /// ownership from umbrella headers if we've not already done so.
702
703 /// Read the contents of the given module map file.
704 ///
705 /// \param File The module map file.
706 /// \param IsSystem Whether this file is in a system header directory.
707 /// \param ID If the module map file is already mapped (perhaps as part of
708 /// processing a preprocessed module), the ID of the file.
709 /// \param Offset [inout] An offset within ID to start parsing. On exit,
710 /// filled by the end of the parsed contents (either EOF or the
711 /// location of an end-of-module-map pragma).
712 /// \param OriginalModuleMapFile The original path to the module map file,
713 /// used to resolve paths within the module (this is required when
714 /// building the module from preprocessed source).
715 /// \returns true if an error occurred, false otherwise.
716 bool loadModuleMapFile(FileEntryRef File, bool IsSystem, FileID ID = FileID(),
717 unsigned *Offset = nullptr,
718 StringRef OriginalModuleMapFile = StringRef());
719
720 /// Collect the set of all known, top-level modules.
721 ///
722 /// \param Modules Will be filled with the set of known, top-level modules.
724
725 /// Load all known, top-level system modules.
727
728private:
729 /// Lookup a module with the given module name and search-name.
730 ///
731 /// \param ModuleName The name of the module we're looking for.
732 ///
733 /// \param SearchName The "search-name" to derive filesystem paths from
734 /// when looking for the module map; this is usually equal to ModuleName,
735 /// but for compatibility with some buggy frameworks, additional attempts
736 /// may be made to find the module under a related-but-different search-name.
737 ///
738 /// \param ImportLoc Location of the module include/import.
739 ///
740 /// \param AllowExtraModuleMapSearch Whether we allow to search modulemaps
741 /// in subdirectories.
742 ///
743 /// \returns The module named ModuleName.
744 Module *lookupModule(StringRef ModuleName, StringRef SearchName,
745 SourceLocation ImportLoc,
746 bool AllowExtraModuleMapSearch = false);
747
748 /// Retrieve the name of the (to-be-)cached module file that should
749 /// be used to load a module with the given name.
750 ///
751 /// \param ModuleName The module whose module file name will be returned.
752 ///
753 /// \param ModuleMapPath A path that when combined with \c ModuleName
754 /// uniquely identifies this module. See Module::ModuleMap.
755 ///
756 /// \param CachePath A path to the module cache.
757 ///
758 /// \returns The name of the module file that corresponds to this module,
759 /// or an empty string if this module does not correspond to any module file.
760 std::string getCachedModuleFileNameImpl(StringRef ModuleName,
761 StringRef ModuleMapPath,
762 StringRef CachePath);
763
764 /// Retrieve a module with the given name, which may be part of the
765 /// given framework.
766 ///
767 /// \param Name The name of the module to retrieve.
768 ///
769 /// \param Dir The framework directory (e.g., ModuleName.framework).
770 ///
771 /// \param IsSystem Whether the framework directory is part of the system
772 /// frameworks.
773 ///
774 /// \returns The module, if found; otherwise, null.
775 Module *loadFrameworkModule(StringRef Name, DirectoryEntryRef Dir,
776 bool IsSystem);
777
778 /// Load all of the module maps within the immediate subdirectories
779 /// of the given search directory.
780 void loadSubdirectoryModuleMaps(DirectoryLookup &SearchDir);
781
782 /// Find and suggest a usable module for the given file.
783 ///
784 /// \return \c true if the file can be used, \c false if we are not permitted to
785 /// find this file due to requirements from \p RequestingModule.
786 bool findUsableModuleForHeader(FileEntryRef File, const DirectoryEntry *Root,
787 Module *RequestingModule,
788 ModuleMap::KnownHeader *SuggestedModule,
789 bool IsSystemHeaderDir);
790
791 /// Find and suggest a usable module for the given file, which is part of
792 /// the specified framework.
793 ///
794 /// \return \c true if the file can be used, \c false if we are not permitted to
795 /// find this file due to requirements from \p RequestingModule.
796 bool findUsableModuleForFrameworkHeader(
797 FileEntryRef File, StringRef FrameworkName, Module *RequestingModule,
798 ModuleMap::KnownHeader *SuggestedModule, bool IsSystemFramework);
799
800 /// Look up the file with the specified name and determine its owning
801 /// module.
803 getFileAndSuggestModule(StringRef FileName, SourceLocation IncludeLoc,
804 const DirectoryEntry *Dir, bool IsSystemHeaderDir,
805 Module *RequestingModule,
806 ModuleMap::KnownHeader *SuggestedModule,
807 bool OpenFile = true, bool CacheFailures = true);
808
809 /// Cache the result of a successful lookup at the given include location
810 /// using the search path at \c HitIt.
811 void cacheLookupSuccess(LookupFileCacheInfo &CacheLookup,
813 SourceLocation IncludeLoc);
814
815 /// Note that a lookup at the given include location was successful using the
816 /// search path at index `HitIdx`.
817 void noteLookupUsage(unsigned HitIdx, SourceLocation IncludeLoc);
818
819public:
820 /// Retrieve the module map.
821 ModuleMap &getModuleMap() { return ModMap; }
822
823 /// Retrieve the module map.
824 const ModuleMap &getModuleMap() const { return ModMap; }
825
826 unsigned header_file_size() const { return FileInfo.size(); }
827
828 /// Return the HeaderFileInfo structure for the specified FileEntry, in
829 /// preparation for updating it in some way.
831
832 /// Return the HeaderFileInfo structure for the specified FileEntry, if it has
833 /// ever been filled in (either locally or externally).
835
836 /// Return the headerFileInfo structure for the specified FileEntry, if it has
837 /// ever been filled in locally.
839
840 SearchDirIterator search_dir_begin() { return {*this, 0}; }
841 SearchDirIterator search_dir_end() { return {*this, SearchDirs.size()}; }
843 return {search_dir_begin(), search_dir_end()};
844 }
845
848 assert(n < SearchDirs.size());
849 return {*this, n};
850 }
853 return {search_dir_begin(), search_dir_end()};
854 }
855
856 unsigned search_dir_size() const { return SearchDirs.size(); }
857
858 ConstSearchDirIterator quoted_dir_begin() const { return {*this, 0}; }
860
862 return {*this, AngledDirIdx};
863 }
865
867 return {*this, SystemDirIdx};
868 }
870 return {*this, SearchDirs.size()};
871 }
872
873 /// Get the index of the given search directory.
874 unsigned searchDirIdx(const DirectoryLookup &DL) const;
875
876 /// Retrieve a uniqued framework name.
877 StringRef getUniqueFrameworkName(StringRef Framework);
878
879 /// Retrieve the include name for the header.
880 ///
881 /// \param File The entry for a given header.
882 /// \returns The name of how the file was included when the header's location
883 /// was resolved.
884 StringRef getIncludeNameForHeader(const FileEntry *File) const;
885
886 /// Suggest a path by which the specified file could be found, for use in
887 /// diagnostics to suggest a #include. Returned path will only contain forward
888 /// slashes as separators. MainFile is the absolute path of the file that we
889 /// are generating the diagnostics for. It will try to shorten the path using
890 /// MainFile location, if none of the include search directories were prefix
891 /// of File.
892 ///
893 /// \param IsAngled If non-null, filled in to indicate whether the suggested
894 /// path should be referenced as <Header.h> instead of "Header.h".
896 llvm::StringRef MainFile,
897 bool *IsAngled = nullptr) const;
898
899 /// Suggest a path by which the specified file could be found, for use in
900 /// diagnostics to suggest a #include. Returned path will only contain forward
901 /// slashes as separators. MainFile is the absolute path of the file that we
902 /// are generating the diagnostics for. It will try to shorten the path using
903 /// MainFile location, if none of the include search directories were prefix
904 /// of File.
905 ///
906 /// \param WorkingDir If non-empty, this will be prepended to search directory
907 /// paths that are relative.
908 std::string suggestPathToFileForDiagnostics(llvm::StringRef File,
909 llvm::StringRef WorkingDir,
910 llvm::StringRef MainFile,
911 bool *IsAngled = nullptr) const;
912
913 void PrintStats();
914
915 size_t getTotalMemory() const;
916
917private:
918 /// Describes what happened when we tried to load a module map file.
919 enum LoadModuleMapResult {
920 /// The module map file had already been loaded.
921 LMM_AlreadyLoaded,
922
923 /// The module map file was loaded by this invocation.
924 LMM_NewlyLoaded,
925
926 /// There is was directory with the given name.
927 LMM_NoDirectory,
928
929 /// There was either no module map file or the module map file was
930 /// invalid.
931 LMM_InvalidModuleMap
932 };
933
934 LoadModuleMapResult loadModuleMapFileImpl(FileEntryRef File, bool IsSystem,
935 DirectoryEntryRef Dir,
936 FileID ID = FileID(),
937 unsigned *Offset = nullptr);
938
939 /// Try to load the module map file in the given directory.
940 ///
941 /// \param DirName The name of the directory where we will look for a module
942 /// map file.
943 /// \param IsSystem Whether this is a system header directory.
944 /// \param IsFramework Whether this is a framework directory.
945 ///
946 /// \returns The result of attempting to load the module map file from the
947 /// named directory.
948 LoadModuleMapResult loadModuleMapFile(StringRef DirName, bool IsSystem,
949 bool IsFramework);
950
951 /// Try to load the module map file in the given directory.
952 ///
953 /// \param Dir The directory where we will look for a module map file.
954 /// \param IsSystem Whether this is a system header directory.
955 /// \param IsFramework Whether this is a framework directory.
956 ///
957 /// \returns The result of attempting to load the module map file from the
958 /// named directory.
959 LoadModuleMapResult loadModuleMapFile(DirectoryEntryRef Dir, bool IsSystem,
960 bool IsFramework);
961};
962
963/// Apply the header search options to get given HeaderSearch object.
964void ApplyHeaderSearchOptions(HeaderSearch &HS,
965 const HeaderSearchOptions &HSOpts,
966 const LangOptions &Lang,
967 const llvm::Triple &triple);
968
969} // namespace clang
970
971#endif // LLVM_CLANG_LEX_HEADERSEARCH_H
StringRef P
static char ID
Definition: Arena.cpp:183
StringRef Filename
Definition: Format.cpp:3032
unsigned Iter
Definition: HTMLLogger.cpp:153
llvm::MachO::Target Target
Definition: MachO.h:51
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
#define bool
Definition: amdgpuintrin.h:20
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:231
A reference to a DirectoryEntry that includes the name of the directory as it was accessed by the Fil...
Cached information about one directory (either on disk or in the virtual file system).
DirectoryLookup - This class represents one entry in the search list that specifies the search order ...
An external source of header file information, which may supply information about header files alread...
Definition: HeaderSearch.h:147
virtual HeaderFileInfo GetHeaderFileInfo(FileEntryRef FE)=0
Retrieve the header file information for the given file entry.
Abstract interface for external sources of preprocessor information.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Definition: FileEntry.h:57
Cached information about one file (either on disk or in the virtual file system).
Definition: FileEntry.h:305
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
Definition: FileManager.h:53
This class represents an Apple concept known as a 'header map'.
Definition: HeaderMap.h:84
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
Encapsulates the information needed to find the file referenced by a #include or #include_next,...
Definition: HeaderSearch.h:237
StringRef getUniqueFrameworkName(StringRef Framework)
Retrieve a uniqued framework name.
void setDirectoryHasModuleMap(const DirectoryEntry *Dir)
Consider modules when including files from this directory.
Definition: HeaderSearch.h:437
void SetExternalSource(ExternalHeaderFileInfoSource *ES)
Set the external source of header information.
Definition: HeaderSearch.h:455
HeaderSearch & operator=(const HeaderSearch &)=delete
unsigned search_dir_size() const
Definition: HeaderSearch.h:856
std::vector< bool > collectVFSUsageAndClear() const
Collect which HeaderSearchOptions::VFSOverlayFiles have been meaningfully used so far and mark their ...
SrcMgr::CharacteristicKind getFileDirFlavor(FileEntryRef File)
Return whether the specified file is a normal header, a system header, or a C++ friendly system heade...
Definition: HeaderSearch.h:539
FileManager & getFileMgr() const
Definition: HeaderSearch.h:372
void AddSearchPath(const DirectoryLookup &dir, bool isAngled)
Add an additional search path.
ConstSearchDirIterator angled_dir_end() const
Definition: HeaderSearch.h:864
Module * lookupModule(StringRef ModuleName, SourceLocation ImportLoc=SourceLocation(), bool AllowSearch=true, bool AllowExtraModuleMapSearch=false)
Lookup a module Search for a module with the given name.
void SetFileControllingMacro(FileEntryRef File, const IdentifierInfo *ControllingMacro)
Mark the specified file as having a controlling macro.
Definition: HeaderSearch.h:565
DiagnosticsEngine & getDiags() const
Definition: HeaderSearch.h:374
void MarkFileIncludeOnce(FileEntryRef File)
Mark the specified file as a "once only" file due to #pragma once.
Definition: HeaderSearch.h:547
ConstSearchDirIterator system_dir_begin() const
Definition: HeaderSearch.h:866
HeaderSearch(const HeaderSearch &)=delete
bool hasModuleMap(StringRef Filename, const DirectoryEntry *Root, bool IsSystem)
Determine whether there is a module map that may map the header with the given file name to a (sub)mo...
std::string suggestPathToFileForDiagnostics(FileEntryRef File, llvm::StringRef MainFile, bool *IsAngled=nullptr) const
Suggest a path by which the specified file could be found, for use in diagnostics to suggest a #inclu...
const HeaderFileInfo * getExistingLocalFileInfo(FileEntryRef FE) const
Return the headerFileInfo structure for the specified FileEntry, if it has ever been filled in locall...
ConstSearchDirIterator search_dir_end() const
Definition: HeaderSearch.h:851
OptionalFileEntryRef LookupFile(StringRef Filename, SourceLocation IncludeLoc, bool isAngled, ConstSearchDirIterator FromDir, ConstSearchDirIterator *CurDir, ArrayRef< std::pair< OptionalFileEntryRef, DirectoryEntryRef > > Includers, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule, bool *IsMapped, bool *IsFrameworkFound, bool SkipCache=false, bool BuildSystemModule=false, bool OpenFile=true, bool CacheFailures=true)
Given a "foo" or <foo> reference, look up the indicated file, return null on failure.
void getHeaderMapFileNames(SmallVectorImpl< std::string > &Names) const
Get filenames for all registered header maps.
void MarkFileSystemHeader(FileEntryRef File)
Mark the specified file as a system header, e.g.
Definition: HeaderSearch.h:553
StringRef getIncludeNameForHeader(const FileEntry *File) const
Retrieve the include name for the header.
std::string getPrebuiltImplicitModuleFileName(Module *Module)
Retrieve the name of the prebuilt module file that should be used to load the given module.
StringRef getModuleCachePath() const
Retrieve the path to the module cache.
Definition: HeaderSearch.h:434
void setModuleHash(StringRef Hash)
Set the hash to use for module cache paths.
Definition: HeaderSearch.h:423
ConstSearchDirIterator angled_dir_begin() const
Definition: HeaderSearch.h:861
void SetSystemHeaderPrefixes(ArrayRef< std::pair< std::string, bool > > P)
Set the list of system header prefixes.
Definition: HeaderSearch.h:391
ArrayRef< ModuleMap::KnownHeader > findAllModulesForHeader(FileEntryRef File) const
Retrieve all the modules corresponding to the given file.
ConstSearchDirRange search_dir_range() const
Definition: HeaderSearch.h:852
bool hasFileBeenImported(FileEntryRef File) const
Determine whether the given file is known to have ever been #imported.
Definition: HeaderSearch.h:578
unsigned searchDirIdx(const DirectoryLookup &DL) const
Get the index of the given search directory.
bool isFileMultipleIncludeGuarded(FileEntryRef File) const
Determine whether this file is intended to be safe from multiple inclusions, e.g.,...
ConstSearchDirIterator quoted_dir_begin() const
Definition: HeaderSearch.h:858
ExternalPreprocessorSource * getExternalLookup() const
Definition: HeaderSearch.h:450
void setModuleCachePath(StringRef CachePath)
Set the path to the module cache.
Definition: HeaderSearch.h:426
ConstSearchDirIterator search_dir_nth(size_t n) const
Definition: HeaderSearch.h:847
void loadTopLevelSystemModules()
Load all known, top-level system modules.
SearchDirIterator search_dir_end()
Definition: HeaderSearch.h:841
FrameworkCacheEntry & LookupFrameworkCache(StringRef FWName)
Look up the specified framework name in our framework cache.
Definition: HeaderSearch.h:521
std::vector< bool > computeUserEntryUsage() const
Determine which HeaderSearchOptions::UserEntries have been successfully used so far and mark their in...
ConstSearchDirIterator quoted_dir_end() const
Definition: HeaderSearch.h:859
ArrayRef< ModuleMap::KnownHeader > findResolvedModulesForHeader(FileEntryRef File) const
Like findAllModulesForHeader, but do not attempt to infer module ownership from umbrella headers if w...
bool loadModuleMapFile(FileEntryRef File, bool IsSystem, FileID ID=FileID(), unsigned *Offset=nullptr, StringRef OriginalModuleMapFile=StringRef())
Read the contents of the given module map file.
void SetSearchPaths(std::vector< DirectoryLookup > dirs, unsigned angledDirIdx, unsigned systemDirIdx, llvm::DenseMap< unsigned, unsigned > searchDirToHSEntry)
Interface for setting the file search paths.
const ModuleMap & getModuleMap() const
Retrieve the module map.
Definition: HeaderSearch.h:824
void setTarget(const TargetInfo &Target)
Set the target information for the header search, if not already known.
const HeaderMap * CreateHeaderMap(FileEntryRef FE)
This method returns a HeaderMap for the specified FileEntry, uniquing them through the 'HeaderMaps' d...
ModuleMap::KnownHeader findModuleForHeader(FileEntryRef File, bool AllowTextual=false, bool AllowExcluded=false) const
Retrieve the module that corresponds to the given file, if any.
SearchDirRange search_dir_range()
Definition: HeaderSearch.h:842
std::string getCachedModuleFileName(Module *Module)
Retrieve the name of the cached module file that should be used to load the given module.
void collectAllModules(SmallVectorImpl< Module * > &Modules)
Collect the set of all known, top-level modules.
void MarkFileModuleHeader(FileEntryRef FE, ModuleMap::ModuleHeaderRole Role, bool isCompilingModuleHeader)
Mark the specified file as part of a module.
const HeaderFileInfo * getExistingFileInfo(FileEntryRef FE) const
Return the HeaderFileInfo structure for the specified FileEntry, if it has ever been filled in (eithe...
OptionalFileEntryRef LookupSubframeworkHeader(StringRef Filename, FileEntryRef ContextFileEnt, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, Module *RequestingModule, ModuleMap::KnownHeader *SuggestedModule)
Look up a subframework for the specified #include file.
HeaderFileInfo & getFileInfo(FileEntryRef FE)
Return the HeaderFileInfo structure for the specified FileEntry, in preparation for updating it in so...
void SetExternalLookup(ExternalPreprocessorSource *EPS)
Definition: HeaderSearch.h:446
OptionalFileEntryRef lookupModuleMapFile(DirectoryEntryRef Dir, bool IsFramework)
Try to find a module map file in the given directory, returning nullopt if none is found.
bool ShouldEnterIncludeFile(Preprocessor &PP, FileEntryRef File, bool isImport, bool ModulesEnabled, Module *M, bool &IsFirstIncludeOfFile)
Mark the specified file as a target of a #include, #include_next, or #import directive.
size_t getTotalMemory() const
ModuleMap & getModuleMap()
Retrieve the module map.
Definition: HeaderSearch.h:821
HeaderSearchOptions & getHeaderSearchOpts() const
Retrieve the header-search options with which this header search was initialized.
Definition: HeaderSearch.h:370
bool HasIncludeAliasMap() const
Checks whether the map exists or not.
Definition: HeaderSearch.h:396
std::string getPrebuiltModuleFileName(StringRef ModuleName, bool FileMapOnly=false)
Retrieve the name of the prebuilt module file that should be used to load a module with the given nam...
unsigned header_file_size() const
Definition: HeaderSearch.h:826
ConstSearchDirIterator system_dir_end() const
Definition: HeaderSearch.h:869
void ClearFileInfo()
Forget everything we know about headers so far.
Definition: HeaderSearch.h:442
StringRef getModuleHash() const
Retrieve the module hash.
Definition: HeaderSearch.h:431
ConstSearchDirIterator search_dir_begin() const
Definition: HeaderSearch.h:846
void AddIncludeAlias(StringRef Source, StringRef Dest)
Map the source include name to the dest include name.
Definition: HeaderSearch.h:402
StringRef MapHeaderToIncludeAlias(StringRef Source)
Maps one header file name to a different header file name, for use with the include_alias pragma.
Definition: HeaderSearch.h:412
SearchDirIterator search_dir_begin()
Definition: HeaderSearch.h:840
void AddSystemSearchPath(const DirectoryLookup &dir)
Add an additional system search path.
Definition: HeaderSearch.h:385
One of these records is kept for each identifier that is lexed.
A header that is known to reside within a given module, whether it was included or excluded.
Definition: ModuleMap.h:162
ModuleHeaderRole
Flags describing the role of a module header.
Definition: ModuleMap.h:130
Describes a module or submodule.
Definition: Module.h:115
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:138
Encodes a location in the source.
Exposes information about the current target.
Definition: TargetInfo.h:220
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
Definition: SourceManager.h:81
std::conditional_t< Const, const T, T > Qualified
Definition: HeaderSearch.h:172
@ HeaderSearch
Remove unused header search paths including header maps.
The JSON file list parser is used to communicate input to InstallAPI.
void ApplyHeaderSearchOptions(HeaderSearch &HS, const HeaderSearchOptions &HSOpts, const LangOptions &Lang, const llvm::Triple &triple)
Apply the header search options to get given HeaderSearch object.
llvm::iterator_range< SearchDirIterator > SearchDirRange
Definition: HeaderSearch.h:233
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
@ Other
Other implicit parameter.
llvm::iterator_range< ConstSearchDirIterator > ConstSearchDirRange
Definition: HeaderSearch.h:232
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
#define false
Definition: stdbool.h:26
This structure is used to record entries in our framework cache.
Definition: HeaderSearch.h:160
bool IsUserSpecifiedSystemFramework
Whether this framework has been "user-specified" to be treated as if it were a system framework (even...
Definition: HeaderSearch.h:167
OptionalDirectoryEntryRef Directory
The directory entry which should be used for the cached framework.
Definition: HeaderSearch.h:162
The preprocessor keeps track of this information for each file that is #included.
Definition: HeaderSearch.h:59
void mergeModuleMembership(ModuleMap::ModuleHeaderRole Role)
Update the module membership bits based on the header role.
LazyIdentifierInfoPtr LazyControllingMacro
If this file has a #ifndef XXX (or equivalent) guard that protects the entire contents of the file,...
Definition: HeaderSearch.h:123
unsigned DirInfo
Keep track of whether this is a system header, and if so, whether it is C++ clean or not.
Definition: HeaderSearch.h:81
unsigned isModuleHeader
Whether this header is part of and built with a module.
Definition: HeaderSearch.h:92
const IdentifierInfo * getControllingMacro(ExternalPreprocessorSource *External)
Retrieve the controlling macro for this header file, if any.
unsigned isTextualModuleHeader
Whether this header is a textual header in a module.
Definition: HeaderSearch.h:98
unsigned isPragmaOnce
True if this is a #pragma once file.
Definition: HeaderSearch.h:74
unsigned Resolved
Whether this structure is considered to already have been "resolved", meaning that it was loaded from...
Definition: HeaderSearch.h:109
unsigned isCompilingModuleHeader
Whether this header is part of the module that we are building, even if it doesn't build with the mod...
Definition: HeaderSearch.h:104
unsigned IsValid
Whether this file has been looked up as a header.
Definition: HeaderSearch.h:113
unsigned isImport
True if this is a #import'd file.
Definition: HeaderSearch.h:70
unsigned IsLocallyIncluded
True if this file has been included (or imported) locally.
Definition: HeaderSearch.h:64
unsigned External
Whether this header file info was supplied by an external source, and has not changed since.
Definition: HeaderSearch.h:86
Forward iterator over the search directories of HeaderSearch.
Definition: HeaderSearch.h:179
SearchDirIteratorImpl(std::nullptr_t)
Creates an invalid iterator.
Definition: HeaderSearch.h:205
Qualified< IsConst, DirectoryLookup > & operator*() const
Definition: HeaderSearch.h:199
bool operator==(const SearchDirIteratorImpl &RHS) const
Definition: HeaderSearch.h:189
SearchDirIteratorImpl(const SearchDirIteratorImpl< false > &Other)
Const -> non-const iterator conversion.
Definition: HeaderSearch.h:182
SearchDirIteratorImpl & operator++()
Definition: HeaderSearch.h:193
SearchDirIteratorImpl & operator=(const SearchDirIteratorImpl &)=default
SearchDirIteratorImpl(const SearchDirIteratorImpl &)=default