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