clang 23.0.0git
Module.h
Go to the documentation of this file.
1//===- Module.h - Describe a module -----------------------------*- 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/// \file
10/// Defines the clang::Module class, which describes a module in the
11/// source code.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_BASIC_MODULE_H
16#define LLVM_CLANG_BASIC_MODULE_H
17
21#include "llvm/ADT/ArrayRef.h"
22#include "llvm/ADT/DenseSet.h"
23#include "llvm/ADT/PointerIntPair.h"
24#include "llvm/ADT/STLExtras.h"
25#include "llvm/ADT/SetVector.h"
26#include "llvm/ADT/SmallVector.h"
27#include "llvm/ADT/StringMap.h"
28#include "llvm/ADT/StringRef.h"
29#include "llvm/ADT/iterator_range.h"
30#include <array>
31#include <cassert>
32#include <cstdint>
33#include <ctime>
34#include <iterator>
35#include <optional>
36#include <string>
37#include <utility>
38#include <variant>
39#include <vector>
40
41namespace llvm {
42
43class raw_ostream;
44
45} // namespace llvm
46
47namespace clang {
48
49class FileManager;
50class LangOptions;
51class ModuleMap;
52class TargetInfo;
53
54/// Describes the name of a module.
56
57/// Deduplication key for a loaded module file in \c ModuleManager.
58///
59/// For implicitly-built modules, this is the \c DirectoryEntry of the module
60/// cache and the module file name with the (optional) context hash.
61/// This enables using \c FileManager's inode-based canonicalization of the
62/// user-provided module cache path without hitting issues on file systems that
63/// recycle inodes for recompiled module files.
64///
65/// For explicitly-built modules, this is \c FileEntry.
66/// This uses \c FileManager's inode-based canonicalization of the user-provided
67/// module file path. Because input explicitly-built modules do not change
68/// during the lifetime of the compiler, inode recycling is not of concern here.
69class ModuleFileKey {
70 /// The FileManager entity used for deduplication.
71 const void *Ptr;
72 /// The path relative to the module cache path for implicit module file, empty
73 /// for other kinds of module files.
74 std::string ImplicitModulePathSuffix;
75
76 friend class ModuleFileName;
77 friend llvm::DenseMapInfo<ModuleFileKey>;
78
79 ModuleFileKey(const void *Ptr) : Ptr(Ptr) {}
80
81 ModuleFileKey(const FileEntry *ModuleFile) : Ptr(ModuleFile) {}
82
83 ModuleFileKey(const DirectoryEntry *ModuleCacheDir, StringRef PathSuffix)
84 : Ptr(ModuleCacheDir), ImplicitModulePathSuffix(PathSuffix) {}
85
86public:
87 bool operator==(const ModuleFileKey &Other) const {
88 return Ptr == Other.Ptr &&
89 ImplicitModulePathSuffix == Other.ImplicitModulePathSuffix;
90 }
91
92 bool operator!=(const ModuleFileKey &Other) const {
93 return !operator==(Other);
94 }
95};
96
97/// Identifies a module file to be loaded.
98///
99/// For implicitly-built module files, the path is split into the module cache
100/// path and the module file name with the (optional) context hash. For all
101/// other types of module files, this is just the file system path.
103 std::string Path;
104 unsigned ImplicitModuleSuffixLength = 0;
105
106public:
107 /// Creates an empty module file name.
108 ModuleFileName() = default;
109
110 /// Creates a file name for an explicit module.
111 static ModuleFileName makeExplicit(std::string Name) {
113 File.Path = std::move(Name);
114 return File;
115 }
116
117 /// Creates a file name for an explicit module.
118 static ModuleFileName makeExplicit(StringRef Name) {
119 return makeExplicit(Name.str());
120 }
121
122 /// Creates a file name for an implicit module.
123 static ModuleFileName makeImplicit(std::string Name, unsigned SuffixLength) {
124 assert(SuffixLength != 0 && "Empty suffix for implicit module file name");
125 assert(SuffixLength <= Name.size() &&
126 "Suffix for implicit module file name out-of-bounds");
128 File.Path = std::move(Name);
129 File.ImplicitModuleSuffixLength = SuffixLength;
130 return File;
131 }
132
133 /// Creates a file name for an implicit module.
134 static ModuleFileName makeImplicit(StringRef Name, unsigned SuffixLength) {
135 return makeImplicit(Name.str(), SuffixLength);
136 }
137
138 /// Returns the suffix length for an implicit module name, zero otherwise.
140 return ImplicitModuleSuffixLength;
141 }
142
143 /// Returns the plain module file name.
144 StringRef str() const { return Path; }
145
146 /// Converts to StringRef representing the plain module file name.
147 operator StringRef() const { return Path; }
148
149 /// Checks whether the module file name is empty.
150 bool empty() const { return Path.empty(); }
151
152 /// Creates the deduplication key for use in \c ModuleManager.
153 /// Returns an empty optional if:
154 /// * the module cache does not exist for an implicit module name,
155 /// * the module file does not exist for an explicit module name.
156 std::optional<ModuleFileKey> makeKey(FileManager &FileMgr) const;
157};
158
159/// The signature of a module, which is a hash of the AST content.
160struct ASTFileSignature : std::array<uint8_t, 20> {
161 using BaseT = std::array<uint8_t, 20>;
162
163 static constexpr size_t size = std::tuple_size<BaseT>::value;
164
165 ASTFileSignature(BaseT S = {{0}}) : BaseT(std::move(S)) {}
166
167 explicit operator bool() const { return *this != BaseT({{0}}); }
168
169 // Support implicit cast to ArrayRef. Note that ASTFileSignature::size
170 // prevents implicit cast to ArrayRef because one of the implicit constructors
171 // of ArrayRef requires access to BaseT::size.
172 operator ArrayRef<uint8_t>() const { return ArrayRef<uint8_t>(data(), size); }
173
174 /// Returns the value truncated to the size of an uint64_t.
175 uint64_t truncatedValue() const {
176 uint64_t Value = 0;
177 static_assert(sizeof(*this) >= sizeof(uint64_t), "No need to truncate.");
178 for (unsigned I = 0; I < sizeof(uint64_t); ++I)
179 Value |= static_cast<uint64_t>((*this)[I]) << (I * 8);
180 return Value;
181 }
182
183 static ASTFileSignature create(std::array<uint8_t, 20> Bytes) {
184 return ASTFileSignature(std::move(Bytes));
185 }
186
188 ASTFileSignature Sentinel;
189 Sentinel.fill(0xFF);
190 return Sentinel;
191 }
192
194 ASTFileSignature Dummy;
195 Dummy.fill(0x00);
196 return Dummy;
197 }
198
199 template <typename InputIt>
200 static ASTFileSignature create(InputIt First, InputIt Last) {
201 assert(std::distance(First, Last) == size &&
202 "Wrong amount of bytes to create an ASTFileSignature");
203
204 ASTFileSignature Signature;
205 std::copy(First, Last, Signature.begin());
206 return Signature;
207 }
208};
209
210/// The set of attributes that can be attached to a module.
212 /// Whether this is a system module.
213 LLVM_PREFERRED_TYPE(bool)
215
216 /// Whether this is an extern "C" module.
217 LLVM_PREFERRED_TYPE(bool)
218 unsigned IsExternC : 1;
219
220 /// Whether this is an exhaustive set of configuration macros.
221 LLVM_PREFERRED_TYPE(bool)
222 unsigned IsExhaustive : 1;
223
224 /// Whether files in this module can only include non-modular headers
225 /// and headers from used modules.
226 LLVM_PREFERRED_TYPE(bool)
228
232};
233
234/// Required to construct a Module.
235///
236/// This tag type is only constructible by ModuleMap, guaranteeing it ownership
237/// of all Module instances.
238class ModuleConstructorTag {
239 explicit ModuleConstructorTag() = default;
240 friend ModuleMap;
241};
242
243/// Describes a module or submodule.
244///
245/// Aligned to 8 bytes to allow for llvm::PointerIntPair<Module *, 3>.
246class alignas(8) Module {
247public:
248 /// The name of this module.
249 std::string Name;
250
251 /// The location of the module definition.
253
254 // FIXME: Consider if reducing the size of this enum (having Partition and
255 // Named modules only) then representing interface/implementation separately
256 // is more efficient.
258 /// This is a module that was defined by a module map and built out
259 /// of header files.
261
262 /// This is a C++20 header unit.
264
265 /// This is a C++20 module interface unit.
267
268 /// This is a C++20 module implementation unit.
270
271 /// This is a C++20 module partition interface.
273
274 /// This is a C++20 module partition implementation.
276
277 /// This is the explicit Global Module Fragment of a modular TU.
278 /// As per C++ [module.global.frag].
280
281 /// This is the private module fragment within some C++ module.
283
284 /// This is an implicit fragment of the global module which contains
285 /// only language linkage declarations (made in the purview of the
286 /// named module).
288 };
289
290 /// The kind of this module.
292
293 /// The parent of this module. This will be NULL for the top-level
294 /// module.
296
297 /// The build directory of this module. This is the directory in
298 /// which the module is notionally built, and relative to which its headers
299 /// are found.
301
302 /// The presumed file name for the module map defining this module.
303 /// Only non-empty when building from preprocessed source.
305
306 /// The umbrella header or directory.
307 std::variant<std::monostate, FileEntryRef, DirectoryEntryRef> Umbrella;
308
309 /// The location of the umbrella header or directory declaration.
311
312 /// The module signature.
314
315 /// The name of the umbrella entry, as written in the module map.
316 std::string UmbrellaAsWritten;
317
318 // The path to the umbrella entry relative to the root module's \c Directory.
320
321 /// The module through which entities defined in this module will
322 /// eventually be exposed, for use in "private" modules.
323 std::string ExportAsModule;
324
325 /// For the debug info, the path to this module's .apinotes file, if any.
326 std::string APINotesFile;
327
328 /// Does this Module is a named module of a standard named module?
329 bool isNamedModule() const {
330 switch (Kind) {
336 return true;
337 default:
338 return false;
339 }
340 }
341
342 /// Does this Module scope describe a fragment of the global module within
343 /// some C++ module.
344 bool isGlobalModule() const {
346 }
349 }
352 }
353
354 bool isPrivateModule() const { return Kind == PrivateModuleFragment; }
355
356 bool isModuleMapModule() const { return Kind == ModuleMapModule; }
357
358private:
359 /// The submodules of this module, indexed by name.
360 std::vector<Module *> SubModules;
361
362 /// A mapping from the submodule name to the index into the
363 /// \c SubModules vector at which that submodule resides.
364 mutable llvm::StringMap<unsigned> SubModuleIndex;
365
366 /// The AST file name and key if this is a top-level module which has a
367 /// corresponding serialized AST file, or null otherwise.
368 std::optional<ModuleFileName> ASTFileName;
369 std::optional<ModuleFileKey> ASTFileKey;
370
371 /// The top-level headers associated with this module.
373
374 /// top-level header filenames that aren't resolved to FileEntries yet.
375 std::vector<std::string> TopHeaderNames;
376
377 /// Cache of modules visible to lookup in this module.
378 mutable llvm::DenseSet<const Module*> VisibleModulesCache;
379
380 /// The ID used when referencing this module within a VisibleModuleSet.
381 unsigned VisibilityID;
382
383public:
391 /// Information about a header directive as found in the module map
392 /// file.
398
399private:
400 static const int NumHeaderKinds = HK_Excluded + 1;
401 // The begin index for a HeaderKind also acts the end index of HeaderKind - 1.
402 // The extra element at the end acts as the end index of the last HeaderKind.
403 unsigned HeaderKindBeginIndex[NumHeaderKinds + 1] = {};
404 SmallVector<Header, 2> HeadersStorage;
405
406public:
407 ArrayRef<Header> getAllHeaders() const { return HeadersStorage; }
409 assert(HK < NumHeaderKinds && "Invalid Module::HeaderKind");
410 auto BeginIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK];
411 auto EndIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK + 1];
412 return {BeginIt, EndIt};
413 }
415 assert(HK < NumHeaderKinds && "Invalid Module::HeaderKind");
416 auto EndIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK + 1];
417 HeadersStorage.insert(EndIt, std::move(H));
418 for (unsigned HKI = HK + 1; HKI != NumHeaderKinds + 1; ++HKI)
419 ++HeaderKindBeginIndex[HKI];
420 }
421
422 /// Information about a directory name as found in the module map file.
428
429 /// Stored information about a header directive that was found in the
430 /// module map file but has not been resolved to a file.
434 std::string FileName;
435 bool IsUmbrella = false;
436 bool HasBuiltinHeader = false;
437 std::optional<off_t> Size;
438 std::optional<time_t> ModTime;
439 };
440
441 /// Headers that are mentioned in the module map file but that we have not
442 /// yet attempted to resolve to a file on the file system.
444
445 /// Headers that are mentioned in the module map file but could not be
446 /// found on the file system.
448
449 struct Requirement {
450 std::string FeatureName;
452 };
453
454 /// The set of language features required to use this module.
455 ///
456 /// If any of these requirements are not available, the \c IsAvailable bit
457 /// will be false to indicate that this (sub)module is not available.
459
460 /// A module with the same name that shadows this module.
462
463 /// Whether this module has declared itself unimportable, either because
464 /// it's missing a requirement from \p Requirements or because it's been
465 /// shadowed by another module.
466 LLVM_PREFERRED_TYPE(bool)
468
469 /// Whether we tried and failed to load a module file for this module.
470 LLVM_PREFERRED_TYPE(bool)
472
473 /// Whether this module is available in the current translation unit.
474 ///
475 /// If the module is missing headers or does not meet all requirements then
476 /// this bit will be 0.
477 LLVM_PREFERRED_TYPE(bool)
478 unsigned IsAvailable : 1;
479
480 /// Whether this module was loaded from a module file.
481 LLVM_PREFERRED_TYPE(bool)
482 unsigned IsFromModuleFile : 1;
483
484 /// Whether this is a framework module.
485 LLVM_PREFERRED_TYPE(bool)
486 unsigned IsFramework : 1;
487
488 /// Whether this is an explicit submodule.
489 LLVM_PREFERRED_TYPE(bool)
490 unsigned IsExplicit : 1;
491
492 /// Whether this is a "system" module (which assumes that all
493 /// headers in it are system headers).
494 LLVM_PREFERRED_TYPE(bool)
495 unsigned IsSystem : 1;
496
497 /// Whether this is an 'extern "C"' module (which implicitly puts all
498 /// headers in it within an 'extern "C"' block, and allows the module to be
499 /// imported within such a block).
500 LLVM_PREFERRED_TYPE(bool)
501 unsigned IsExternC : 1;
502
503 /// Whether this is an inferred submodule (module * { ... }).
504 LLVM_PREFERRED_TYPE(bool)
505 unsigned IsInferred : 1;
506
507 /// Whether we should infer submodules for this module based on
508 /// the headers.
509 ///
510 /// Submodules can only be inferred for modules with an umbrella header.
511 LLVM_PREFERRED_TYPE(bool)
512 unsigned InferSubmodules : 1;
513
514 /// Whether, when inferring submodules, the inferred submodules
515 /// should be explicit.
516 LLVM_PREFERRED_TYPE(bool)
518
519 /// Whether, when inferring submodules, the inferr submodules should
520 /// export all modules they import (e.g., the equivalent of "export *").
521 LLVM_PREFERRED_TYPE(bool)
523
524 /// Whether the set of configuration macros is exhaustive.
525 ///
526 /// When the set of configuration macros is exhaustive, meaning
527 /// that no identifier not in this list should affect how the module is
528 /// built.
529 LLVM_PREFERRED_TYPE(bool)
531
532 /// Whether files in this module can only include non-modular headers
533 /// and headers from used modules.
534 LLVM_PREFERRED_TYPE(bool)
536
537 /// Whether this module came from a "private" module map, found next
538 /// to a regular (public) module map.
539 LLVM_PREFERRED_TYPE(bool)
540 unsigned ModuleMapIsPrivate : 1;
541
542 /// Whether this C++20 named modules doesn't need an initializer.
543 /// This is only meaningful for C++20 modules.
544 LLVM_PREFERRED_TYPE(bool)
545 unsigned NamedModuleHasInit : 1;
546
547 /// Describes the visibility of the various names within a
548 /// particular module.
550 /// All of the names in this module are hidden.
552 /// All of the names in this module are visible.
554 };
555
556 /// The visibility of names within this particular module.
558
559 /// The location of the inferred submodule.
561
562 /// The set of modules imported by this module, and on which this
563 /// module depends.
565
566 /// The set of top-level modules that affected the compilation of this module,
567 /// but were not imported.
569
570 /// Describes an exported module.
571 ///
572 /// The pointer is the module being re-exported, while the bit will be true
573 /// to indicate that this is a wildcard export.
574 using ExportDecl = llvm::PointerIntPair<Module *, 1, bool>;
575
576 /// The set of export declarations.
578
579 /// Describes an exported module that has not yet been resolved
580 /// (perhaps because the module it refers to has not yet been loaded).
582 /// The location of the 'export' keyword in the module map file.
584
585 /// The name of the module.
587
588 /// Whether this export declaration ends in a wildcard, indicating
589 /// that all of its submodules should be exported (rather than the named
590 /// module itself).
592 };
593
594 /// The set of export declarations that have yet to be resolved.
596
597 /// The directly used modules.
599
600 /// The set of use declarations that have yet to be resolved.
602
603 /// When \c NoUndeclaredIncludes is true, the set of modules this module tried
604 /// to import but didn't because they are not direct uses.
606
607 /// A library or framework to link against when an entity from this
608 /// module is used.
609 struct LinkLibrary {
610 LinkLibrary() = default;
611 LinkLibrary(const std::string &Library, bool IsFramework)
613
614 /// The library to link against.
615 ///
616 /// This will typically be a library or framework name, but can also
617 /// be an absolute path to the library or framework.
618 std::string Library;
619
620 /// Whether this is a framework rather than a library.
621 bool IsFramework = false;
622 };
623
624 /// The set of libraries or frameworks to link against when
625 /// an entity from this module is used.
627
628 /// Autolinking uses the framework name for linking purposes
629 /// when this is false and the export_as name otherwise.
631
632 /// The set of "configuration macros", which are macros that
633 /// (intentionally) change how this module is built.
634 std::vector<std::string> ConfigMacros;
635
636 /// An unresolved conflict with another module.
638 /// The (unresolved) module id.
640
641 /// The message provided to the user when there is a conflict.
642 std::string Message;
643 };
644
645 /// The list of conflicts for which the module-id has not yet been
646 /// resolved.
647 std::vector<UnresolvedConflict> UnresolvedConflicts;
648
649 /// A conflict between two modules.
650 struct Conflict {
651 /// The module that this module conflicts with.
653
654 /// The message provided to the user when there is a conflict.
655 std::string Message;
656 };
657
658 /// The list of conflicts.
659 std::vector<Conflict> Conflicts;
660
661 /// Construct a new module or submodule.
663 Module *Parent, bool IsFramework, bool IsExplicit,
664 unsigned VisibilityID);
665
667
668 /// Determine whether this module has been declared unimportable.
669 bool isUnimportable() const { return IsUnimportable; }
670
671 /// Determine whether this module has been declared unimportable.
672 ///
673 /// \param LangOpts The language options used for the current
674 /// translation unit.
675 ///
676 /// \param Target The target options used for the current translation unit.
677 ///
678 /// \param Req If this module is unimportable because of a missing
679 /// requirement, this parameter will be set to one of the requirements that
680 /// is not met for use of this module.
681 ///
682 /// \param ShadowingModule If this module is unimportable because it is
683 /// shadowed, this parameter will be set to the shadowing module.
684 bool isUnimportable(const LangOptions &LangOpts, const TargetInfo &Target,
685 Requirement &Req, Module *&ShadowingModule) const;
686
687 /// Determine whether this module can be built in this compilation.
688 bool isForBuilding(const LangOptions &LangOpts) const;
689
690 /// Determine whether this module is available for use within the
691 /// current translation unit.
692 bool isAvailable() const { return IsAvailable; }
693
694 /// Determine whether this module is available for use within the
695 /// current translation unit.
696 ///
697 /// \param LangOpts The language options used for the current
698 /// translation unit.
699 ///
700 /// \param Target The target options used for the current translation unit.
701 ///
702 /// \param Req If this module is unavailable because of a missing requirement,
703 /// this parameter will be set to one of the requirements that is not met for
704 /// use of this module.
705 ///
706 /// \param MissingHeader If this module is unavailable because of a missing
707 /// header, this parameter will be set to one of the missing headers.
708 ///
709 /// \param ShadowingModule If this module is unavailable because it is
710 /// shadowed, this parameter will be set to the shadowing module.
711 bool isAvailable(const LangOptions &LangOpts,
712 const TargetInfo &Target,
713 Requirement &Req,
714 UnresolvedHeaderDirective &MissingHeader,
715 Module *&ShadowingModule) const;
716
717 /// Determine whether this module is a submodule.
718 bool isSubModule() const { return Parent != nullptr; }
719
720 /// Check if this module is a (possibly transitive) submodule of \p Other.
721 ///
722 /// The 'A is a submodule of B' relation is a partial order based on the
723 /// the parent-child relationship between individual modules.
724 ///
725 /// Returns \c false if \p Other is \c nullptr.
726 bool isSubModuleOf(const Module *Other) const;
727
728 /// Determine whether this module is a part of a framework,
729 /// either because it is a framework module or because it is a submodule
730 /// of a framework module.
731 bool isPartOfFramework() const {
732 for (const Module *Mod = this; Mod; Mod = Mod->Parent)
733 if (Mod->IsFramework)
734 return true;
735
736 return false;
737 }
738
739 /// Determine whether this module is a subframework of another
740 /// framework.
741 bool isSubFramework() const {
742 return IsFramework && Parent && Parent->isPartOfFramework();
743 }
744
745 /// Set the parent of this module. This should only be used if the parent
746 /// could not be set during module creation.
747 void setParent(Module *M) {
748 assert(!Parent);
749 Parent = M;
750 Parent->SubModules.push_back(this);
751 }
752
753 /// Is this module have similar semantics as headers.
754 bool isHeaderLikeModule() const {
755 return isModuleMapModule() || isHeaderUnit();
756 }
757
758 /// Is this a module partition.
763
764 /// Is this a module partition implementation unit.
768
769 /// Is this a module implementation.
772 }
773
774 /// Is this module a header unit.
775 bool isHeaderUnit() const { return Kind == ModuleHeaderUnit; }
776 // Is this a C++20 module interface or a partition.
779 }
780
781 /// Is this a C++20 named module unit.
782 bool isNamedModuleUnit() const {
784 }
785
789
791
792 /// Get the primary module interface name from a partition.
794 // Technically, global module fragment belongs to global module. And global
795 // module has no name: [module.unit]p6:
796 // The global module has no name, no module interface unit, and is not
797 // introduced by any module-declaration.
798 //
799 // <global> is the default name showed in module map.
800 if (isGlobalModule())
801 return "<global>";
802
803 if (isModulePartition()) {
804 auto pos = Name.find(':');
805 return StringRef(Name.data(), pos);
806 }
807
808 if (isPrivateModule())
809 return getTopLevelModuleName();
810
811 return Name;
812 }
813
814 /// Retrieve the full name of this module, including the path from
815 /// its top-level module.
816 /// \param AllowStringLiterals If \c true, components that might not be
817 /// lexically valid as identifiers will be emitted as string literals.
818 std::string getFullModuleName(bool AllowStringLiterals = false) const;
819
820 /// Whether the full name of this module is equal to joining
821 /// \p nameParts with "."s.
822 ///
823 /// This is more efficient than getFullModuleName().
824 bool fullModuleNameIs(ArrayRef<StringRef> nameParts) const;
825
826 /// Retrieve the top-level module for this (sub)module, which may
827 /// be this module.
829 return const_cast<Module *>(
830 const_cast<const Module *>(this)->getTopLevelModule());
831 }
832
833 /// Retrieve the top-level module for this (sub)module, which may
834 /// be this module.
835 const Module *getTopLevelModule() const;
836
837 /// Retrieve the name of the top-level module.
838 StringRef getTopLevelModuleName() const {
839 return getTopLevelModule()->Name;
840 }
841
842 /// The serialized AST file name for this module, if one was created.
844 const Module *TopLevel = getTopLevelModule();
845 return TopLevel->ASTFileName ? &*TopLevel->ASTFileName : nullptr;
846 }
847
848 /// The serialized AST file key for this module, if one was created.
850 const Module *TopLevel = getTopLevelModule();
851 return TopLevel->ASTFileKey ? &*TopLevel->ASTFileKey : nullptr;
852 }
853
854 /// Set the serialized module file for the top-level module of this module.
856 assert(((!getASTFileName() && !getASTFileKey()) ||
857 *getASTFileKey() == NewKey) &&
858 "file path changed");
859 Module *TopLevel = getTopLevelModule();
860 TopLevel->ASTFileName = NewName;
861 TopLevel->ASTFileKey = NewKey;
862 }
863
864 /// Retrieve the umbrella directory as written.
865 std::optional<DirectoryName> getUmbrellaDirAsWritten() const {
866 if (const auto *Dir = std::get_if<DirectoryEntryRef>(&Umbrella))
869 return std::nullopt;
870 }
871
872 /// Retrieve the umbrella header as written.
873 std::optional<Header> getUmbrellaHeaderAsWritten() const {
874 if (const auto *Hdr = std::get_if<FileEntryRef>(&Umbrella))
876 *Hdr};
877 return std::nullopt;
878 }
879
880 /// Get the effective umbrella directory for this module: either the one
881 /// explicitly written in the module map file, or the parent of the umbrella
882 /// header.
884
885 /// Add a top-level header associated with this module.
887
888 /// Add a top-level header filename associated with this module.
889 void addTopHeaderFilename(StringRef Filename) {
890 TopHeaderNames.push_back(std::string(Filename));
891 }
892
893 /// The top-level headers associated with this module.
895
896 /// Determine whether this module has declared its intention to
897 /// directly use another module.
898 bool directlyUses(const Module *Requested);
899
900 /// Add the given feature requirement to the list of features
901 /// required by this module.
902 ///
903 /// \param Feature The feature that is required by this module (and
904 /// its submodules).
905 ///
906 /// \param RequiredState The required state of this feature: \c true
907 /// if it must be present, \c false if it must be absent.
908 ///
909 /// \param LangOpts The set of language options that will be used to
910 /// evaluate the availability of this feature.
911 ///
912 /// \param Target The target options that will be used to evaluate the
913 /// availability of this feature.
914 void addRequirement(StringRef Feature, bool RequiredState,
915 const LangOptions &LangOpts,
916 const TargetInfo &Target);
917
918 /// Mark this module and all of its submodules as unavailable.
919 void markUnavailable(bool Unimportable);
920
921 /// Find the submodule with the given name.
922 ///
923 /// \returns The submodule if found, or NULL otherwise.
924 Module *findSubmodule(StringRef Name) const;
925
926 /// Get the Global Module Fragment (sub-module) for this module, it there is
927 /// one.
928 ///
929 /// \returns The GMF sub-module if found, or NULL otherwise.
931
932 /// Get the Private Module Fragment (sub-module) for this module, it there is
933 /// one.
934 ///
935 /// \returns The PMF sub-module if found, or NULL otherwise.
937
938 /// Determine whether the specified module would be visible to
939 /// a lookup at the end of this module.
940 ///
941 /// FIXME: This may return incorrect results for (submodules of) the
942 /// module currently being built, if it's queried before we see all
943 /// of its imports.
944 bool isModuleVisible(const Module *M) const {
945 if (VisibleModulesCache.empty())
946 buildVisibleModulesCache();
947 return VisibleModulesCache.count(M);
948 }
949
950 unsigned getVisibilityID() const { return VisibilityID; }
951
952 using submodule_iterator = std::vector<Module *>::iterator;
953 using submodule_const_iterator = std::vector<Module *>::const_iterator;
954
955 llvm::iterator_range<submodule_iterator> submodules() {
956 return llvm::make_range(SubModules.begin(), SubModules.end());
957 }
958 llvm::iterator_range<submodule_const_iterator> submodules() const {
959 return llvm::make_range(SubModules.begin(), SubModules.end());
960 }
961
962 /// Appends this module's list of exported modules to \p Exported.
963 ///
964 /// This provides a subset of immediately imported modules (the ones that are
965 /// directly exported), not the complete set of exported modules.
966 void getExportedModules(SmallVectorImpl<Module *> &Exported) const;
967
968 static StringRef getModuleInputBufferName() {
969 return "<module-includes>";
970 }
971
972 /// Print the module map for this module to the given stream.
973 void print(raw_ostream &OS, unsigned Indent = 0, bool Dump = false) const;
974
975 /// Dump the contents of this module to the given output stream.
976 void dump() const;
977
978private:
979 void buildVisibleModulesCache() const;
980};
981
982/// A set of visible modules.
984public:
985 VisibleModuleSet() = default;
987 : ImportLocs(std::move(O.ImportLocs)), Generation(O.Generation ? 1 : 0) {
988 O.ImportLocs.clear();
989 ++O.Generation;
990 }
991
992 /// Move from another visible modules set. Guaranteed to leave the source
993 /// empty and bump the generation on both.
995 ImportLocs = std::move(O.ImportLocs);
996 O.ImportLocs.clear();
997 ++O.Generation;
998 ++Generation;
999 return *this;
1000 }
1001
1002 /// Get the current visibility generation. Incremented each time the
1003 /// set of visible modules changes in any way.
1004 unsigned getGeneration() const { return Generation; }
1005
1006 /// Determine whether a module is visible.
1007 bool isVisible(const Module *M) const {
1008 return getImportLoc(M).isValid();
1009 }
1010
1011 /// Get the location at which the import of a module was triggered.
1013 return M && M->getVisibilityID() < ImportLocs.size()
1014 ? ImportLocs[M->getVisibilityID()]
1015 : SourceLocation();
1016 }
1017
1018 /// A callback to call when a module is made visible (directly or
1019 /// indirectly) by a call to \ref setVisible.
1020 using VisibleCallback = llvm::function_ref<void(Module *M)>;
1021
1022 /// A callback to call when a module conflict is found. \p Path
1023 /// consists of a sequence of modules from the conflicting module to the one
1024 /// made visible, where each was exported by the next.
1026 llvm::function_ref<void(ArrayRef<Module *> Path, Module *Conflict,
1027 StringRef Message)>;
1028
1029 /// Make a specific module visible.
1030 void setVisible(
1031 Module *M, SourceLocation Loc, bool IncludeExports = true,
1032 VisibleCallback Vis = [](Module *) {},
1033 ConflictCallback Cb = [](ArrayRef<Module *>, Module *, StringRef) {});
1034
1035private:
1036 /// Import locations for each visible module. Indexed by the module's
1037 /// VisibilityID.
1038 std::vector<SourceLocation> ImportLocs;
1039
1040 /// Visibility generation, bumped every time the visibility state changes.
1041 unsigned Generation = 0;
1042};
1043
1044} // namespace clang
1045
1046template <> struct llvm::DenseMapInfo<clang::ModuleFileKey> {
1048 return DenseMapInfo<const void *>::getEmptyKey();
1049 }
1050
1052 return DenseMapInfo<const void *>::getTombstoneKey();
1053 }
1054
1055 static unsigned getHashValue(const clang::ModuleFileKey &Val) {
1056 return hash_combine(Val.Ptr, Val.ImplicitModulePathSuffix);
1057 }
1058
1059 static bool isEqual(const clang::ModuleFileKey &LHS,
1060 const clang::ModuleFileKey &RHS) {
1061 return LHS == RHS;
1062 }
1063};
1064
1065#endif // LLVM_CLANG_BASIC_MODULE_H
Defines interfaces for clang::DirectoryEntry and clang::DirectoryEntryRef.
Defines interfaces for clang::FileEntry and clang::FileEntryRef.
Defines the clang::SourceLocation class and associated facilities.
A reference to a DirectoryEntry that includes the name of the directory as it was accessed by the Fil...
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:302
Implements support for file system lookup, file system caching, and directory search management.
Definition FileManager.h:53
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Required to construct a Module.
Definition Module.h:238
Deduplication key for a loaded module file in ModuleManager.
Definition Module.h:69
friend class ModuleFileName
Definition Module.h:76
bool operator==(const ModuleFileKey &Other) const
Definition Module.h:87
bool operator!=(const ModuleFileKey &Other) const
Definition Module.h:92
Identifies a module file to be loaded.
Definition Module.h:102
static ModuleFileName makeExplicit(StringRef Name)
Creates a file name for an explicit module.
Definition Module.h:118
unsigned getImplicitModuleSuffixLength() const
Returns the suffix length for an implicit module name, zero otherwise.
Definition Module.h:139
bool empty() const
Checks whether the module file name is empty.
Definition Module.h:150
std::optional< ModuleFileKey > makeKey(FileManager &FileMgr) const
Creates the deduplication key for use in ModuleManager.
Definition Module.cpp:37
static ModuleFileName makeImplicit(std::string Name, unsigned SuffixLength)
Creates a file name for an implicit module.
Definition Module.h:123
static ModuleFileName makeExplicit(std::string Name)
Creates a file name for an explicit module.
Definition Module.h:111
StringRef str() const
Returns the plain module file name.
Definition Module.h:144
ModuleFileName()=default
Creates an empty module file name.
static ModuleFileName makeImplicit(StringRef Name, unsigned SuffixLength)
Creates a file name for an implicit module.
Definition Module.h:134
Describes a module or submodule.
Definition Module.h:246
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
Definition Module.h:838
void addRequirement(StringRef Feature, bool RequiredState, const LangOptions &LangOpts, const TargetInfo &Target)
Add the given feature requirement to the list of features required by this module.
Definition Module.cpp:333
unsigned IsExplicit
Whether this is an explicit submodule.
Definition Module.h:490
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
Definition Module.h:577
bool isForBuilding(const LangOptions &LangOpts) const
Determine whether this module can be built in this compilation.
Definition Module.cpp:175
std::variant< std::monostate, FileEntryRef, DirectoryEntryRef > Umbrella
The umbrella header or directory.
Definition Module.h:307
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
Definition Module.h:512
ArrayRef< Header > getAllHeaders() const
Definition Module.h:407
Module * findSubmodule(StringRef Name) const
Find the submodule with the given name.
Definition Module.cpp:370
SourceLocation UmbrellaDeclLoc
The location of the umbrella header or directory declaration.
Definition Module.h:310
bool directlyUses(const Module *Requested)
Determine whether this module has declared its intention to directly use another module.
Definition Module.cpp:307
bool isNamedModuleInterfaceHasInit() const
Definition Module.h:790
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
Definition Module.h:634
SourceLocation InferredSubmoduleLoc
The location of the inferred submodule.
Definition Module.h:560
unsigned IsUnimportable
Whether this module has declared itself unimportable, either because it's missing a requirement from ...
Definition Module.h:467
bool isInterfaceOrPartition() const
Definition Module.h:777
NameVisibilityKind NameVisibility
The visibility of names within this particular module.
Definition Module.h:557
bool isModulePartitionImplementation() const
Is this a module partition implementation unit.
Definition Module.h:765
NameVisibilityKind
Describes the visibility of the various names within a particular module.
Definition Module.h:549
@ Hidden
All of the names in this module are hidden.
Definition Module.h:551
@ AllVisible
All of the names in this module are visible.
Definition Module.h:553
void print(raw_ostream &OS, unsigned Indent=0, bool Dump=false) const
Print the module map for this module to the given stream.
Definition Module.cpp:483
bool isNamedModuleUnit() const
Is this a C++20 named module unit.
Definition Module.h:782
const ModuleFileKey * getASTFileKey() const
The serialized AST file key for this module, if one was created.
Definition Module.h:849
SourceLocation DefinitionLoc
The location of the module definition.
Definition Module.h:252
SmallVector< UnresolvedHeaderDirective, 1 > MissingHeaders
Headers that are mentioned in the module map file but could not be found on the file system.
Definition Module.h:447
Module(ModuleConstructorTag, StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit, unsigned VisibilityID)
Construct a new module or submodule.
Definition Module.cpp:56
Module * Parent
The parent of this module.
Definition Module.h:295
void markUnavailable(bool Unimportable)
Mark this module and all of its submodules as unavailable.
Definition Module.cpp:345
SmallVector< UnresolvedHeaderDirective, 1 > UnresolvedHeaders
Headers that are mentioned in the module map file but that we have not yet attempted to resolve to a ...
Definition Module.h:443
ModuleKind Kind
The kind of this module.
Definition Module.h:291
bool isPrivateModule() const
Definition Module.h:354
@ HK_PrivateTextual
Definition Module.h:388
void addTopHeaderFilename(StringRef Filename)
Add a top-level header filename associated with this module.
Definition Module.h:889
bool isUnimportable() const
Determine whether this module has been declared unimportable.
Definition Module.h:669
bool fullModuleNameIs(ArrayRef< StringRef > nameParts) const
Whether the full name of this module is equal to joining nameParts with "."s.
Definition Module.cpp:274
Module * getPrivateModuleFragment() const
Get the Private Module Fragment (sub-module) for this module, it there is one.
Definition Module.cpp:392
unsigned IsInferred
Whether this is an inferred submodule (module * { ... }).
Definition Module.h:505
void setASTFileNameAndKey(ModuleFileName NewName, ModuleFileKey NewKey)
Set the serialized module file for the top-level module of this module.
Definition Module.h:855
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
Definition Module.h:564
bool isModuleVisible(const Module *M) const
Determine whether the specified module would be visible to a lookup at the end of this module.
Definition Module.h:944
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers).
Definition Module.h:495
bool isModuleInterfaceUnit() const
Definition Module.h:786
static StringRef getModuleInputBufferName()
Definition Module.h:968
std::string Name
The name of this module.
Definition Module.h:249
Module * getGlobalModuleFragment() const
Get the Global Module Fragment (sub-module) for this module, it there is one.
Definition Module.cpp:381
bool isSubFramework() const
Determine whether this module is a subframework of another framework.
Definition Module.h:741
const ModuleFileName * getASTFileName() const
The serialized AST file name for this module, if one was created.
Definition Module.h:843
llvm::iterator_range< submodule_iterator > submodules()
Definition Module.h:955
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"...
Definition Module.h:501
bool isModuleMapModule() const
Definition Module.h:356
unsigned ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map.
Definition Module.h:540
llvm::SmallVector< LinkLibrary, 2 > LinkLibraries
The set of libraries or frameworks to link against when an entity from this module is used.
Definition Module.h:626
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
The set of export declarations that have yet to be resolved.
Definition Module.h:595
void addHeader(HeaderKind HK, Header H)
Definition Module.h:414
void setParent(Module *M)
Set the parent of this module.
Definition Module.h:747
std::optional< Header > getUmbrellaHeaderAsWritten() const
Retrieve the umbrella header as written.
Definition Module.h:873
unsigned getVisibilityID() const
Definition Module.h:950
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
Definition Module.h:458
bool isHeaderLikeModule() const
Is this module have similar semantics as headers.
Definition Module.h:754
bool isModuleImplementation() const
Is this a module implementation.
Definition Module.h:770
llvm::SmallSetVector< const Module *, 2 > UndeclaredUses
When NoUndeclaredIncludes is true, the set of modules this module tried to import but didn't because ...
Definition Module.h:605
std::string UmbrellaRelativeToRootModuleDirectory
Definition Module.h:319
OptionalDirectoryEntryRef Directory
The build directory of this module.
Definition Module.h:300
std::vector< Module * >::iterator submodule_iterator
Definition Module.h:952
llvm::iterator_range< submodule_const_iterator > submodules() const
Definition Module.h:958
SmallVector< ModuleId, 2 > UnresolvedDirectUses
The set of use declarations that have yet to be resolved.
Definition Module.h:601
unsigned NamedModuleHasInit
Whether this C++20 named modules doesn't need an initializer.
Definition Module.h:545
unsigned NoUndeclaredIncludes
Whether files in this module can only include non-modular headers and headers from used modules.
Definition Module.h:535
StringRef getPrimaryModuleInterfaceName() const
Get the primary module interface name from a partition.
Definition Module.h:793
bool isModulePartition() const
Is this a module partition.
Definition Module.h:759
llvm::SmallSetVector< Module *, 2 > AffectingClangModules
The set of top-level modules that affected the compilation of this module, but were not imported.
Definition Module.h:568
SmallVector< Module *, 2 > DirectUses
The directly used modules.
Definition Module.h:598
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
Definition Module.h:530
std::string PresumedModuleMapFile
The presumed file name for the module map defining this module.
Definition Module.h:304
std::string APINotesFile
For the debug info, the path to this module's .apinotes file, if any.
Definition Module.h:326
ASTFileSignature Signature
The module signature.
Definition Module.h:313
bool isExplicitGlobalModule() const
Definition Module.h:347
ArrayRef< Header > getHeaders(HeaderKind HK) const
Definition Module.h:408
bool isGlobalModule() const
Does this Module scope describe a fragment of the global module within some C++ module.
Definition Module.h:344
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e....
Definition Module.h:522
bool isSubModule() const
Determine whether this module is a submodule.
Definition Module.h:718
void getExportedModules(SmallVectorImpl< Module * > &Exported) const
Appends this module's list of exported modules to Exported.
Definition Module.cpp:403
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
Definition Module.h:647
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
Definition Module.h:482
bool isSubModuleOf(const Module *Other) const
Check if this module is a (possibly transitive) submodule of Other.
Definition Module.cpp:213
bool isPartOfFramework() const
Determine whether this module is a part of a framework, either because it is a framework module or be...
Definition Module.h:731
ArrayRef< FileEntryRef > getTopHeaders(FileManager &FileMgr)
The top-level headers associated with this module.
Definition Module.cpp:296
bool isAvailable() const
Determine whether this module is available for use within the current translation unit.
Definition Module.h:692
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
Definition Module.h:574
std::optional< DirectoryName > getUmbrellaDirAsWritten() const
Retrieve the umbrella directory as written.
Definition Module.h:865
unsigned HasIncompatibleModuleFile
Whether we tried and failed to load a module file for this module.
Definition Module.h:471
bool isImplicitGlobalModule() const
Definition Module.h:350
bool isHeaderUnit() const
Is this module a header unit.
Definition Module.h:775
@ ModuleImplementationUnit
This is a C++20 module implementation unit.
Definition Module.h:269
@ ModuleMapModule
This is a module that was defined by a module map and built out of header files.
Definition Module.h:260
@ ImplicitGlobalModuleFragment
This is an implicit fragment of the global module which contains only language linkage declarations (...
Definition Module.h:287
@ ModulePartitionInterface
This is a C++20 module partition interface.
Definition Module.h:272
@ ModuleInterfaceUnit
This is a C++20 module interface unit.
Definition Module.h:266
@ ModuleHeaderUnit
This is a C++20 header unit.
Definition Module.h:263
@ ModulePartitionImplementation
This is a C++20 module partition implementation.
Definition Module.h:275
@ PrivateModuleFragment
This is the private module fragment within some C++ module.
Definition Module.h:282
@ ExplicitGlobalModuleFragment
This is the explicit Global Module Fragment of a modular TU.
Definition Module.h:279
void dump() const
Dump the contents of this module to the given output stream.
Module * ShadowingModule
A module with the same name that shadows this module.
Definition Module.h:461
unsigned IsFramework
Whether this is a framework module.
Definition Module.h:486
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed,...
Definition Module.h:323
std::string getFullModuleName(bool AllowStringLiterals=false) const
Retrieve the full name of this module, including the path from its top-level module.
Definition Module.cpp:259
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Definition Module.h:329
std::string UmbrellaAsWritten
The name of the umbrella entry, as written in the module map.
Definition Module.h:316
void addTopHeader(FileEntryRef File)
Add a top-level header associated with this module.
Definition Module.cpp:291
std::vector< Module * >::const_iterator submodule_const_iterator
Definition Module.h:953
unsigned IsAvailable
Whether this module is available in the current translation unit.
Definition Module.h:478
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
Definition Module.h:517
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
Definition Module.h:828
OptionalDirectoryEntryRef getEffectiveUmbrellaDir() const
Get the effective umbrella directory for this module: either the one explicitly written in the module...
Definition Module.cpp:283
bool UseExportAsModuleLinkName
Autolinking uses the framework name for linking purposes when this is false and the export_as name ot...
Definition Module.h:630
std::vector< Conflict > Conflicts
The list of conflicts.
Definition Module.h:659
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
Exposes information about the current target.
Definition TargetInfo.h:227
void setVisible(Module *M, SourceLocation Loc, bool IncludeExports=true, VisibleCallback Vis=[](Module *) {}, ConflictCallback Cb=[](ArrayRef< Module * >, Module *, StringRef) {})
Make a specific module visible.
Definition Module.cpp:682
llvm::function_ref< void(Module *M)> VisibleCallback
A callback to call when a module is made visible (directly or indirectly) by a call to setVisible.
Definition Module.h:1020
SourceLocation getImportLoc(const Module *M) const
Get the location at which the import of a module was triggered.
Definition Module.h:1012
llvm::function_ref< void(ArrayRef< Module * > Path, Module *Conflict, StringRef Message)> ConflictCallback
A callback to call when a module conflict is found.
Definition Module.h:1025
bool isVisible(const Module *M) const
Determine whether a module is visible.
Definition Module.h:1007
unsigned getGeneration() const
Get the current visibility generation.
Definition Module.h:1004
VisibleModuleSet & operator=(VisibleModuleSet &&O)
Move from another visible modules set.
Definition Module.h:994
VisibleModuleSet(VisibleModuleSet &&O)
Definition Module.h:986
The JSON file list parser is used to communicate input to InstallAPI.
SmallVector< std::pair< std::string, SourceLocation >, 2 > ModuleId
Describes the name of a module.
Definition Module.h:55
raw_ostream & Indent(raw_ostream &Out, const unsigned int Space, bool IsDot)
Definition JsonSupport.h:21
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
Definition Linkage.h:54
CustomizableOptional< DirectoryEntryRef > OptionalDirectoryEntryRef
@ Other
Other implicit parameter.
Definition Decl.h:1761
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
#define false
Definition stdbool.h:26
The signature of a module, which is a hash of the AST content.
Definition Module.h:160
uint64_t truncatedValue() const
Returns the value truncated to the size of an uint64_t.
Definition Module.h:175
static constexpr size_t size
Definition Module.h:163
static ASTFileSignature create(std::array< uint8_t, 20 > Bytes)
Definition Module.h:183
ASTFileSignature(BaseT S={{0}})
Definition Module.h:165
static ASTFileSignature createDummy()
Definition Module.h:193
std::array< uint8_t, 20 > BaseT
Definition Module.h:161
static ASTFileSignature createDISentinel()
Definition Module.h:187
static ASTFileSignature create(InputIt First, InputIt Last)
Definition Module.h:200
unsigned IsExternC
Whether this is an extern "C" module.
Definition Module.h:218
unsigned IsSystem
Whether this is a system module.
Definition Module.h:214
unsigned IsExhaustive
Whether this is an exhaustive set of configuration macros.
Definition Module.h:222
unsigned NoUndeclaredIncludes
Whether files in this module can only include non-modular headers and headers from used modules.
Definition Module.h:227
A conflict between two modules.
Definition Module.h:650
Module * Other
The module that this module conflicts with.
Definition Module.h:652
std::string Message
The message provided to the user when there is a conflict.
Definition Module.h:655
Information about a directory name as found in the module map file.
Definition Module.h:423
std::string PathRelativeToRootModuleDirectory
Definition Module.h:425
DirectoryEntryRef Entry
Definition Module.h:426
Information about a header directive as found in the module map file.
Definition Module.h:393
std::string PathRelativeToRootModuleDirectory
Definition Module.h:395
std::string NameAsWritten
Definition Module.h:394
FileEntryRef Entry
Definition Module.h:396
bool IsFramework
Whether this is a framework rather than a library.
Definition Module.h:621
LinkLibrary(const std::string &Library, bool IsFramework)
Definition Module.h:611
std::string Library
The library to link against.
Definition Module.h:618
std::string FeatureName
Definition Module.h:450
An unresolved conflict with another module.
Definition Module.h:637
std::string Message
The message provided to the user when there is a conflict.
Definition Module.h:642
ModuleId Id
The (unresolved) module id.
Definition Module.h:639
Describes an exported module that has not yet been resolved (perhaps because the module it refers to ...
Definition Module.h:581
bool Wildcard
Whether this export declaration ends in a wildcard, indicating that all of its submodules should be e...
Definition Module.h:591
ModuleId Id
The name of the module.
Definition Module.h:586
SourceLocation ExportLoc
The location of the 'export' keyword in the module map file.
Definition Module.h:583
Stored information about a header directive that was found in the module map file but has not been re...
Definition Module.h:431
std::optional< time_t > ModTime
Definition Module.h:438
static clang::ModuleFileKey getEmptyKey()
Definition Module.h:1047
static bool isEqual(const clang::ModuleFileKey &LHS, const clang::ModuleFileKey &RHS)
Definition Module.h:1059
static unsigned getHashValue(const clang::ModuleFileKey &Val)
Definition Module.h:1055
static clang::ModuleFileKey getTombstoneKey()
Definition Module.h:1051