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