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 module signature.
311
312 /// The name of the umbrella entry, as written in the module map.
313 std::string UmbrellaAsWritten;
314
315 // The path to the umbrella entry relative to the root module's \c Directory.
317
318 /// The module through which entities defined in this module will
319 /// eventually be exposed, for use in "private" modules.
320 std::string ExportAsModule;
321
322 /// For the debug info, the path to this module's .apinotes file, if any.
323 std::string APINotesFile;
324
325 /// Does this Module is a named module of a standard named module?
326 bool isNamedModule() const {
327 switch (Kind) {
333 return true;
334 default:
335 return false;
336 }
337 }
338
339 /// Does this Module scope describe a fragment of the global module within
340 /// some C++ module.
341 bool isGlobalModule() const {
343 }
346 }
349 }
350
351 bool isPrivateModule() const { return Kind == PrivateModuleFragment; }
352
353 bool isModuleMapModule() const { return Kind == ModuleMapModule; }
354
355private:
356 /// The submodules of this module, indexed by name.
357 std::vector<Module *> SubModules;
358
359 /// A mapping from the submodule name to the index into the
360 /// \c SubModules vector at which that submodule resides.
361 mutable llvm::StringMap<unsigned> SubModuleIndex;
362
363 /// The AST file name and key if this is a top-level module which has a
364 /// corresponding serialized AST file, or null otherwise.
365 std::optional<ModuleFileName> ASTFileName;
366 std::optional<ModuleFileKey> ASTFileKey;
367
368 /// The top-level headers associated with this module.
370
371 /// top-level header filenames that aren't resolved to FileEntries yet.
372 std::vector<std::string> TopHeaderNames;
373
374 /// Cache of modules visible to lookup in this module.
375 mutable llvm::DenseSet<const Module*> VisibleModulesCache;
376
377 /// The ID used when referencing this module within a VisibleModuleSet.
378 unsigned VisibilityID;
379
380public:
388 /// Information about a header directive as found in the module map
389 /// file.
395
396private:
397 static const int NumHeaderKinds = HK_Excluded + 1;
398 // The begin index for a HeaderKind also acts the end index of HeaderKind - 1.
399 // The extra element at the end acts as the end index of the last HeaderKind.
400 unsigned HeaderKindBeginIndex[NumHeaderKinds + 1] = {};
401 SmallVector<Header, 2> HeadersStorage;
402
403public:
404 ArrayRef<Header> getAllHeaders() const { return HeadersStorage; }
406 assert(HK < NumHeaderKinds && "Invalid Module::HeaderKind");
407 auto BeginIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK];
408 auto EndIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK + 1];
409 return {BeginIt, EndIt};
410 }
412 assert(HK < NumHeaderKinds && "Invalid Module::HeaderKind");
413 auto EndIt = HeadersStorage.begin() + HeaderKindBeginIndex[HK + 1];
414 HeadersStorage.insert(EndIt, std::move(H));
415 for (unsigned HKI = HK + 1; HKI != NumHeaderKinds + 1; ++HKI)
416 ++HeaderKindBeginIndex[HKI];
417 }
418
419 /// Information about a directory name as found in the module map file.
425
426 /// Stored information about a header directive that was found in the
427 /// module map file but has not been resolved to a file.
431 std::string FileName;
432 bool IsUmbrella = false;
433 bool HasBuiltinHeader = false;
434 std::optional<off_t> Size;
435 std::optional<time_t> ModTime;
436 };
437
438 /// Headers that are mentioned in the module map file but that we have not
439 /// yet attempted to resolve to a file on the file system.
441
442 /// Headers that are mentioned in the module map file but could not be
443 /// found on the file system.
445
446 struct Requirement {
447 std::string FeatureName;
449 };
450
451 /// The set of language features required to use this module.
452 ///
453 /// If any of these requirements are not available, the \c IsAvailable bit
454 /// will be false to indicate that this (sub)module is not available.
456
457 /// A module with the same name that shadows this module.
459
460 /// Whether this module has declared itself unimportable, either because
461 /// it's missing a requirement from \p Requirements or because it's been
462 /// shadowed by another module.
463 LLVM_PREFERRED_TYPE(bool)
465
466 /// Whether we tried and failed to load a module file for this module.
467 LLVM_PREFERRED_TYPE(bool)
469
470 /// Whether this module is available in the current translation unit.
471 ///
472 /// If the module is missing headers or does not meet all requirements then
473 /// this bit will be 0.
474 LLVM_PREFERRED_TYPE(bool)
475 unsigned IsAvailable : 1;
476
477 /// Whether this module was loaded from a module file.
478 LLVM_PREFERRED_TYPE(bool)
479 unsigned IsFromModuleFile : 1;
480
481 /// Whether this is a framework module.
482 LLVM_PREFERRED_TYPE(bool)
483 unsigned IsFramework : 1;
484
485 /// Whether this is an explicit submodule.
486 LLVM_PREFERRED_TYPE(bool)
487 unsigned IsExplicit : 1;
488
489 /// Whether this is a "system" module (which assumes that all
490 /// headers in it are system headers).
491 LLVM_PREFERRED_TYPE(bool)
492 unsigned IsSystem : 1;
493
494 /// Whether this is an 'extern "C"' module (which implicitly puts all
495 /// headers in it within an 'extern "C"' block, and allows the module to be
496 /// imported within such a block).
497 LLVM_PREFERRED_TYPE(bool)
498 unsigned IsExternC : 1;
499
500 /// Whether this is an inferred submodule (module * { ... }).
501 LLVM_PREFERRED_TYPE(bool)
502 unsigned IsInferred : 1;
503
504 /// Whether we should infer submodules for this module based on
505 /// the headers.
506 ///
507 /// Submodules can only be inferred for modules with an umbrella header.
508 LLVM_PREFERRED_TYPE(bool)
509 unsigned InferSubmodules : 1;
510
511 /// Whether, when inferring submodules, the inferred submodules
512 /// should be explicit.
513 LLVM_PREFERRED_TYPE(bool)
515
516 /// Whether, when inferring submodules, the inferr submodules should
517 /// export all modules they import (e.g., the equivalent of "export *").
518 LLVM_PREFERRED_TYPE(bool)
520
521 /// Whether the set of configuration macros is exhaustive.
522 ///
523 /// When the set of configuration macros is exhaustive, meaning
524 /// that no identifier not in this list should affect how the module is
525 /// built.
526 LLVM_PREFERRED_TYPE(bool)
528
529 /// Whether files in this module can only include non-modular headers
530 /// and headers from used modules.
531 LLVM_PREFERRED_TYPE(bool)
533
534 /// Whether this module came from a "private" module map, found next
535 /// to a regular (public) module map.
536 LLVM_PREFERRED_TYPE(bool)
537 unsigned ModuleMapIsPrivate : 1;
538
539 /// Whether this C++20 named modules doesn't need an initializer.
540 /// This is only meaningful for C++20 modules.
541 LLVM_PREFERRED_TYPE(bool)
542 unsigned NamedModuleHasInit : 1;
543
544 /// Describes the visibility of the various names within a
545 /// particular module.
547 /// All of the names in this module are hidden.
549 /// All of the names in this module are visible.
551 };
552
553 /// The visibility of names within this particular module.
555
556 /// The location of the inferred submodule.
558
559 /// The set of modules imported by this module, and on which this
560 /// module depends.
562
563 /// The set of top-level modules that affected the compilation of this module,
564 /// but were not imported.
566
567 /// Describes an exported module.
568 ///
569 /// The pointer is the module being re-exported, while the bit will be true
570 /// to indicate that this is a wildcard export.
571 using ExportDecl = llvm::PointerIntPair<Module *, 1, bool>;
572
573 /// The set of export declarations.
575
576 /// Describes an exported module that has not yet been resolved
577 /// (perhaps because the module it refers to has not yet been loaded).
579 /// The location of the 'export' keyword in the module map file.
581
582 /// The name of the module.
584
585 /// Whether this export declaration ends in a wildcard, indicating
586 /// that all of its submodules should be exported (rather than the named
587 /// module itself).
589 };
590
591 /// The set of export declarations that have yet to be resolved.
593
594 /// The directly used modules.
596
597 /// The set of use declarations that have yet to be resolved.
599
600 /// When \c NoUndeclaredIncludes is true, the set of modules this module tried
601 /// to import but didn't because they are not direct uses.
603
604 /// A library or framework to link against when an entity from this
605 /// module is used.
606 struct LinkLibrary {
607 LinkLibrary() = default;
608 LinkLibrary(const std::string &Library, bool IsFramework)
610
611 /// The library to link against.
612 ///
613 /// This will typically be a library or framework name, but can also
614 /// be an absolute path to the library or framework.
615 std::string Library;
616
617 /// Whether this is a framework rather than a library.
618 bool IsFramework = false;
619 };
620
621 /// The set of libraries or frameworks to link against when
622 /// an entity from this module is used.
624
625 /// Autolinking uses the framework name for linking purposes
626 /// when this is false and the export_as name otherwise.
628
629 /// The set of "configuration macros", which are macros that
630 /// (intentionally) change how this module is built.
631 std::vector<std::string> ConfigMacros;
632
633 /// An unresolved conflict with another module.
635 /// The (unresolved) module id.
637
638 /// The message provided to the user when there is a conflict.
639 std::string Message;
640 };
641
642 /// The list of conflicts for which the module-id has not yet been
643 /// resolved.
644 std::vector<UnresolvedConflict> UnresolvedConflicts;
645
646 /// A conflict between two modules.
647 struct Conflict {
648 /// The module that this module conflicts with.
650
651 /// The message provided to the user when there is a conflict.
652 std::string Message;
653 };
654
655 /// The list of conflicts.
656 std::vector<Conflict> Conflicts;
657
658 /// Construct a new module or submodule.
660 Module *Parent, bool IsFramework, bool IsExplicit,
661 unsigned VisibilityID);
662
664
665 /// Determine whether this module has been declared unimportable.
666 bool isUnimportable() const { return IsUnimportable; }
667
668 /// Determine whether this module has been declared unimportable.
669 ///
670 /// \param LangOpts The language options used for the current
671 /// translation unit.
672 ///
673 /// \param Target The target options used for the current translation unit.
674 ///
675 /// \param Req If this module is unimportable because of a missing
676 /// requirement, this parameter will be set to one of the requirements that
677 /// is not met for use of this module.
678 ///
679 /// \param ShadowingModule If this module is unimportable because it is
680 /// shadowed, this parameter will be set to the shadowing module.
681 bool isUnimportable(const LangOptions &LangOpts, const TargetInfo &Target,
682 Requirement &Req, Module *&ShadowingModule) const;
683
684 /// Determine whether this module can be built in this compilation.
685 bool isForBuilding(const LangOptions &LangOpts) const;
686
687 /// Determine whether this module is available for use within the
688 /// current translation unit.
689 bool isAvailable() const { return IsAvailable; }
690
691 /// Determine whether this module is available for use within the
692 /// current translation unit.
693 ///
694 /// \param LangOpts The language options used for the current
695 /// translation unit.
696 ///
697 /// \param Target The target options used for the current translation unit.
698 ///
699 /// \param Req If this module is unavailable because of a missing requirement,
700 /// this parameter will be set to one of the requirements that is not met for
701 /// use of this module.
702 ///
703 /// \param MissingHeader If this module is unavailable because of a missing
704 /// header, this parameter will be set to one of the missing headers.
705 ///
706 /// \param ShadowingModule If this module is unavailable because it is
707 /// shadowed, this parameter will be set to the shadowing module.
708 bool isAvailable(const LangOptions &LangOpts,
709 const TargetInfo &Target,
710 Requirement &Req,
711 UnresolvedHeaderDirective &MissingHeader,
712 Module *&ShadowingModule) const;
713
714 /// Determine whether this module is a submodule.
715 bool isSubModule() const { return Parent != nullptr; }
716
717 /// Check if this module is a (possibly transitive) submodule of \p Other.
718 ///
719 /// The 'A is a submodule of B' relation is a partial order based on the
720 /// the parent-child relationship between individual modules.
721 ///
722 /// Returns \c false if \p Other is \c nullptr.
723 bool isSubModuleOf(const Module *Other) const;
724
725 /// Determine whether this module is a part of a framework,
726 /// either because it is a framework module or because it is a submodule
727 /// of a framework module.
728 bool isPartOfFramework() const {
729 for (const Module *Mod = this; Mod; Mod = Mod->Parent)
730 if (Mod->IsFramework)
731 return true;
732
733 return false;
734 }
735
736 /// Determine whether this module is a subframework of another
737 /// framework.
738 bool isSubFramework() const {
739 return IsFramework && Parent && Parent->isPartOfFramework();
740 }
741
742 /// Set the parent of this module. This should only be used if the parent
743 /// could not be set during module creation.
744 void setParent(Module *M) {
745 assert(!Parent);
746 Parent = M;
747 Parent->SubModules.push_back(this);
748 }
749
750 /// Is this module have similar semantics as headers.
751 bool isHeaderLikeModule() const {
752 return isModuleMapModule() || isHeaderUnit();
753 }
754
755 /// Is this a module partition.
760
761 /// Is this a module partition implementation unit.
765
766 /// Is this a module implementation.
769 }
770
771 /// Is this module a header unit.
772 bool isHeaderUnit() const { return Kind == ModuleHeaderUnit; }
773 // Is this a C++20 module interface or a partition.
776 }
777
778 /// Is this a C++20 named module unit.
779 bool isNamedModuleUnit() const {
781 }
782
786
788
789 /// Get the primary module interface name from a partition.
791 // Technically, global module fragment belongs to global module. And global
792 // module has no name: [module.unit]p6:
793 // The global module has no name, no module interface unit, and is not
794 // introduced by any module-declaration.
795 //
796 // <global> is the default name showed in module map.
797 if (isGlobalModule())
798 return "<global>";
799
800 if (isModulePartition()) {
801 auto pos = Name.find(':');
802 return StringRef(Name.data(), pos);
803 }
804
805 if (isPrivateModule())
806 return getTopLevelModuleName();
807
808 return Name;
809 }
810
811 /// Retrieve the full name of this module, including the path from
812 /// its top-level module.
813 /// \param AllowStringLiterals If \c true, components that might not be
814 /// lexically valid as identifiers will be emitted as string literals.
815 std::string getFullModuleName(bool AllowStringLiterals = false) const;
816
817 /// Whether the full name of this module is equal to joining
818 /// \p nameParts with "."s.
819 ///
820 /// This is more efficient than getFullModuleName().
821 bool fullModuleNameIs(ArrayRef<StringRef> nameParts) const;
822
823 /// Retrieve the top-level module for this (sub)module, which may
824 /// be this module.
826 return const_cast<Module *>(
827 const_cast<const Module *>(this)->getTopLevelModule());
828 }
829
830 /// Retrieve the top-level module for this (sub)module, which may
831 /// be this module.
832 const Module *getTopLevelModule() const;
833
834 /// Retrieve the name of the top-level module.
835 StringRef getTopLevelModuleName() const {
836 return getTopLevelModule()->Name;
837 }
838
839 /// The serialized AST file name for this module, if one was created.
841 const Module *TopLevel = getTopLevelModule();
842 return TopLevel->ASTFileName ? &*TopLevel->ASTFileName : nullptr;
843 }
844
845 /// The serialized AST file key for this module, if one was created.
847 const Module *TopLevel = getTopLevelModule();
848 return TopLevel->ASTFileKey ? &*TopLevel->ASTFileKey : nullptr;
849 }
850
851 /// Set the serialized module file for the top-level module of this module.
853 assert(((!getASTFileName() && !getASTFileKey()) ||
854 *getASTFileKey() == NewKey) &&
855 "file path changed");
856 Module *TopLevel = getTopLevelModule();
857 TopLevel->ASTFileName = NewName;
858 TopLevel->ASTFileKey = NewKey;
859 }
860
861 /// Retrieve the umbrella directory as written.
862 std::optional<DirectoryName> getUmbrellaDirAsWritten() const {
863 if (const auto *Dir = std::get_if<DirectoryEntryRef>(&Umbrella))
866 return std::nullopt;
867 }
868
869 /// Retrieve the umbrella header as written.
870 std::optional<Header> getUmbrellaHeaderAsWritten() const {
871 if (const auto *Hdr = std::get_if<FileEntryRef>(&Umbrella))
873 *Hdr};
874 return std::nullopt;
875 }
876
877 /// Get the effective umbrella directory for this module: either the one
878 /// explicitly written in the module map file, or the parent of the umbrella
879 /// header.
881
882 /// Add a top-level header associated with this module.
884
885 /// Add a top-level header filename associated with this module.
886 void addTopHeaderFilename(StringRef Filename) {
887 TopHeaderNames.push_back(std::string(Filename));
888 }
889
890 /// The top-level headers associated with this module.
892
893 /// Determine whether this module has declared its intention to
894 /// directly use another module.
895 bool directlyUses(const Module *Requested);
896
897 /// Add the given feature requirement to the list of features
898 /// required by this module.
899 ///
900 /// \param Feature The feature that is required by this module (and
901 /// its submodules).
902 ///
903 /// \param RequiredState The required state of this feature: \c true
904 /// if it must be present, \c false if it must be absent.
905 ///
906 /// \param LangOpts The set of language options that will be used to
907 /// evaluate the availability of this feature.
908 ///
909 /// \param Target The target options that will be used to evaluate the
910 /// availability of this feature.
911 void addRequirement(StringRef Feature, bool RequiredState,
912 const LangOptions &LangOpts,
913 const TargetInfo &Target);
914
915 /// Mark this module and all of its submodules as unavailable.
916 void markUnavailable(bool Unimportable);
917
918 /// Find the submodule with the given name.
919 ///
920 /// \returns The submodule if found, or NULL otherwise.
921 Module *findSubmodule(StringRef Name) const;
922
923 /// Get the Global Module Fragment (sub-module) for this module, it there is
924 /// one.
925 ///
926 /// \returns The GMF sub-module if found, or NULL otherwise.
928
929 /// Get the Private Module Fragment (sub-module) for this module, it there is
930 /// one.
931 ///
932 /// \returns The PMF sub-module if found, or NULL otherwise.
934
935 /// Determine whether the specified module would be visible to
936 /// a lookup at the end of this module.
937 ///
938 /// FIXME: This may return incorrect results for (submodules of) the
939 /// module currently being built, if it's queried before we see all
940 /// of its imports.
941 bool isModuleVisible(const Module *M) const {
942 if (VisibleModulesCache.empty())
943 buildVisibleModulesCache();
944 return VisibleModulesCache.count(M);
945 }
946
947 unsigned getVisibilityID() const { return VisibilityID; }
948
949 using submodule_iterator = std::vector<Module *>::iterator;
950 using submodule_const_iterator = std::vector<Module *>::const_iterator;
951
952 llvm::iterator_range<submodule_iterator> submodules() {
953 return llvm::make_range(SubModules.begin(), SubModules.end());
954 }
955 llvm::iterator_range<submodule_const_iterator> submodules() const {
956 return llvm::make_range(SubModules.begin(), SubModules.end());
957 }
958
959 /// Appends this module's list of exported modules to \p Exported.
960 ///
961 /// This provides a subset of immediately imported modules (the ones that are
962 /// directly exported), not the complete set of exported modules.
963 void getExportedModules(SmallVectorImpl<Module *> &Exported) const;
964
965 static StringRef getModuleInputBufferName() {
966 return "<module-includes>";
967 }
968
969 /// Print the module map for this module to the given stream.
970 void print(raw_ostream &OS, unsigned Indent = 0, bool Dump = false) const;
971
972 /// Dump the contents of this module to the given output stream.
973 void dump() const;
974
975private:
976 void buildVisibleModulesCache() const;
977};
978
979/// A set of visible modules.
981public:
982 VisibleModuleSet() = default;
984 : ImportLocs(std::move(O.ImportLocs)), Generation(O.Generation ? 1 : 0) {
985 O.ImportLocs.clear();
986 ++O.Generation;
987 }
988
989 /// Move from another visible modules set. Guaranteed to leave the source
990 /// empty and bump the generation on both.
992 ImportLocs = std::move(O.ImportLocs);
993 O.ImportLocs.clear();
994 ++O.Generation;
995 ++Generation;
996 return *this;
997 }
998
999 /// Get the current visibility generation. Incremented each time the
1000 /// set of visible modules changes in any way.
1001 unsigned getGeneration() const { return Generation; }
1002
1003 /// Determine whether a module is visible.
1004 bool isVisible(const Module *M) const {
1005 return getImportLoc(M).isValid();
1006 }
1007
1008 /// Get the location at which the import of a module was triggered.
1010 return M && M->getVisibilityID() < ImportLocs.size()
1011 ? ImportLocs[M->getVisibilityID()]
1012 : SourceLocation();
1013 }
1014
1015 /// A callback to call when a module is made visible (directly or
1016 /// indirectly) by a call to \ref setVisible.
1017 using VisibleCallback = llvm::function_ref<void(Module *M)>;
1018
1019 /// A callback to call when a module conflict is found. \p Path
1020 /// consists of a sequence of modules from the conflicting module to the one
1021 /// made visible, where each was exported by the next.
1023 llvm::function_ref<void(ArrayRef<Module *> Path, Module *Conflict,
1024 StringRef Message)>;
1025
1026 /// Make a specific module visible.
1027 void setVisible(
1028 Module *M, SourceLocation Loc, bool IncludeExports = true,
1029 VisibleCallback Vis = [](Module *) {},
1030 ConflictCallback Cb = [](ArrayRef<Module *>, Module *, StringRef) {});
1031
1032private:
1033 /// Import locations for each visible module. Indexed by the module's
1034 /// VisibilityID.
1035 std::vector<SourceLocation> ImportLocs;
1036
1037 /// Visibility generation, bumped every time the visibility state changes.
1038 unsigned Generation = 0;
1039};
1040
1041} // namespace clang
1042
1043template <> struct llvm::DenseMapInfo<clang::ModuleFileKey> {
1045 return DenseMapInfo<const void *>::getEmptyKey();
1046 }
1047
1049 return DenseMapInfo<const void *>::getTombstoneKey();
1050 }
1051
1052 static unsigned getHashValue(const clang::ModuleFileKey &Val) {
1053 return hash_combine(Val.Ptr, Val.ImplicitModulePathSuffix);
1054 }
1055
1056 static bool isEqual(const clang::ModuleFileKey &LHS,
1057 const clang::ModuleFileKey &RHS) {
1058 return LHS == RHS;
1059 }
1060};
1061
1062#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:835
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:332
unsigned IsExplicit
Whether this is an explicit submodule.
Definition Module.h:487
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
Definition Module.h:574
bool isForBuilding(const LangOptions &LangOpts) const
Determine whether this module can be built in this compilation.
Definition Module.cpp:174
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:509
ArrayRef< Header > getAllHeaders() const
Definition Module.h:404
Module * findSubmodule(StringRef Name) const
Find the submodule with the given name.
Definition Module.cpp:369
bool directlyUses(const Module *Requested)
Determine whether this module has declared its intention to directly use another module.
Definition Module.cpp:306
bool isNamedModuleInterfaceHasInit() const
Definition Module.h:787
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
Definition Module.h:631
SourceLocation InferredSubmoduleLoc
The location of the inferred submodule.
Definition Module.h:557
unsigned IsUnimportable
Whether this module has declared itself unimportable, either because it's missing a requirement from ...
Definition Module.h:464
bool isInterfaceOrPartition() const
Definition Module.h:774
NameVisibilityKind NameVisibility
The visibility of names within this particular module.
Definition Module.h:554
bool isModulePartitionImplementation() const
Is this a module partition implementation unit.
Definition Module.h:762
NameVisibilityKind
Describes the visibility of the various names within a particular module.
Definition Module.h:546
@ Hidden
All of the names in this module are hidden.
Definition Module.h:548
@ AllVisible
All of the names in this module are visible.
Definition Module.h:550
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:482
bool isNamedModuleUnit() const
Is this a C++20 named module unit.
Definition Module.h:779
const ModuleFileKey * getASTFileKey() const
The serialized AST file key for this module, if one was created.
Definition Module.h:846
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:444
Module(ModuleConstructorTag, StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit, unsigned VisibilityID)
Construct a new module or submodule.
Definition Module.cpp:55
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:344
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:440
ModuleKind Kind
The kind of this module.
Definition Module.h:291
bool isPrivateModule() const
Definition Module.h:351
@ HK_PrivateTextual
Definition Module.h:385
void addTopHeaderFilename(StringRef Filename)
Add a top-level header filename associated with this module.
Definition Module.h:886
bool isUnimportable() const
Determine whether this module has been declared unimportable.
Definition Module.h:666
bool fullModuleNameIs(ArrayRef< StringRef > nameParts) const
Whether the full name of this module is equal to joining nameParts with "."s.
Definition Module.cpp:273
Module * getPrivateModuleFragment() const
Get the Private Module Fragment (sub-module) for this module, it there is one.
Definition Module.cpp:391
unsigned IsInferred
Whether this is an inferred submodule (module * { ... }).
Definition Module.h:502
void setASTFileNameAndKey(ModuleFileName NewName, ModuleFileKey NewKey)
Set the serialized module file for the top-level module of this module.
Definition Module.h:852
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
Definition Module.h:561
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:941
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers).
Definition Module.h:492
bool isModuleInterfaceUnit() const
Definition Module.h:783
static StringRef getModuleInputBufferName()
Definition Module.h:965
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:380
bool isSubFramework() const
Determine whether this module is a subframework of another framework.
Definition Module.h:738
const ModuleFileName * getASTFileName() const
The serialized AST file name for this module, if one was created.
Definition Module.h:840
llvm::iterator_range< submodule_iterator > submodules()
Definition Module.h:952
unsigned IsExternC
Whether this is an 'extern "C"' module (which implicitly puts all headers in it within an 'extern "C"...
Definition Module.h:498
bool isModuleMapModule() const
Definition Module.h:353
unsigned ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map.
Definition Module.h:537
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:623
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
The set of export declarations that have yet to be resolved.
Definition Module.h:592
void addHeader(HeaderKind HK, Header H)
Definition Module.h:411
void setParent(Module *M)
Set the parent of this module.
Definition Module.h:744
std::optional< Header > getUmbrellaHeaderAsWritten() const
Retrieve the umbrella header as written.
Definition Module.h:870
unsigned getVisibilityID() const
Definition Module.h:947
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
Definition Module.h:455
bool isHeaderLikeModule() const
Is this module have similar semantics as headers.
Definition Module.h:751
bool isModuleImplementation() const
Is this a module implementation.
Definition Module.h:767
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:602
std::string UmbrellaRelativeToRootModuleDirectory
Definition Module.h:316
OptionalDirectoryEntryRef Directory
The build directory of this module.
Definition Module.h:300
std::vector< Module * >::iterator submodule_iterator
Definition Module.h:949
llvm::iterator_range< submodule_const_iterator > submodules() const
Definition Module.h:955
SmallVector< ModuleId, 2 > UnresolvedDirectUses
The set of use declarations that have yet to be resolved.
Definition Module.h:598
unsigned NamedModuleHasInit
Whether this C++20 named modules doesn't need an initializer.
Definition Module.h:542
unsigned NoUndeclaredIncludes
Whether files in this module can only include non-modular headers and headers from used modules.
Definition Module.h:532
StringRef getPrimaryModuleInterfaceName() const
Get the primary module interface name from a partition.
Definition Module.h:790
bool isModulePartition() const
Is this a module partition.
Definition Module.h:756
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:565
SmallVector< Module *, 2 > DirectUses
The directly used modules.
Definition Module.h:595
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
Definition Module.h:527
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:323
ASTFileSignature Signature
The module signature.
Definition Module.h:310
bool isExplicitGlobalModule() const
Definition Module.h:344
ArrayRef< Header > getHeaders(HeaderKind HK) const
Definition Module.h:405
bool isGlobalModule() const
Does this Module scope describe a fragment of the global module within some C++ module.
Definition Module.h:341
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e....
Definition Module.h:519
bool isSubModule() const
Determine whether this module is a submodule.
Definition Module.h:715
void getExportedModules(SmallVectorImpl< Module * > &Exported) const
Appends this module's list of exported modules to Exported.
Definition Module.cpp:402
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
Definition Module.h:644
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
Definition Module.h:479
bool isSubModuleOf(const Module *Other) const
Check if this module is a (possibly transitive) submodule of Other.
Definition Module.cpp:212
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:728
ArrayRef< FileEntryRef > getTopHeaders(FileManager &FileMgr)
The top-level headers associated with this module.
Definition Module.cpp:295
bool isAvailable() const
Determine whether this module is available for use within the current translation unit.
Definition Module.h:689
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
Definition Module.h:571
std::optional< DirectoryName > getUmbrellaDirAsWritten() const
Retrieve the umbrella directory as written.
Definition Module.h:862
unsigned HasIncompatibleModuleFile
Whether we tried and failed to load a module file for this module.
Definition Module.h:468
bool isImplicitGlobalModule() const
Definition Module.h:347
bool isHeaderUnit() const
Is this module a header unit.
Definition Module.h:772
@ 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:458
unsigned IsFramework
Whether this is a framework module.
Definition Module.h:483
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed,...
Definition Module.h:320
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:258
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Definition Module.h:326
std::string UmbrellaAsWritten
The name of the umbrella entry, as written in the module map.
Definition Module.h:313
void addTopHeader(FileEntryRef File)
Add a top-level header associated with this module.
Definition Module.cpp:290
std::vector< Module * >::const_iterator submodule_const_iterator
Definition Module.h:950
unsigned IsAvailable
Whether this module is available in the current translation unit.
Definition Module.h:475
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
Definition Module.h:514
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
Definition Module.h:825
OptionalDirectoryEntryRef getEffectiveUmbrellaDir() const
Get the effective umbrella directory for this module: either the one explicitly written in the module...
Definition Module.cpp:282
bool UseExportAsModuleLinkName
Autolinking uses the framework name for linking purposes when this is false and the export_as name ot...
Definition Module.h:627
std::vector< Conflict > Conflicts
The list of conflicts.
Definition Module.h:656
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:681
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:1017
SourceLocation getImportLoc(const Module *M) const
Get the location at which the import of a module was triggered.
Definition Module.h:1009
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:1022
bool isVisible(const Module *M) const
Determine whether a module is visible.
Definition Module.h:1004
unsigned getGeneration() const
Get the current visibility generation.
Definition Module.h:1001
VisibleModuleSet & operator=(VisibleModuleSet &&O)
Move from another visible modules set.
Definition Module.h:991
VisibleModuleSet(VisibleModuleSet &&O)
Definition Module.h:983
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:647
Module * Other
The module that this module conflicts with.
Definition Module.h:649
std::string Message
The message provided to the user when there is a conflict.
Definition Module.h:652
Information about a directory name as found in the module map file.
Definition Module.h:420
std::string PathRelativeToRootModuleDirectory
Definition Module.h:422
DirectoryEntryRef Entry
Definition Module.h:423
Information about a header directive as found in the module map file.
Definition Module.h:390
std::string PathRelativeToRootModuleDirectory
Definition Module.h:392
std::string NameAsWritten
Definition Module.h:391
FileEntryRef Entry
Definition Module.h:393
bool IsFramework
Whether this is a framework rather than a library.
Definition Module.h:618
LinkLibrary(const std::string &Library, bool IsFramework)
Definition Module.h:608
std::string Library
The library to link against.
Definition Module.h:615
std::string FeatureName
Definition Module.h:447
An unresolved conflict with another module.
Definition Module.h:634
std::string Message
The message provided to the user when there is a conflict.
Definition Module.h:639
ModuleId Id
The (unresolved) module id.
Definition Module.h:636
Describes an exported module that has not yet been resolved (perhaps because the module it refers to ...
Definition Module.h:578
bool Wildcard
Whether this export declaration ends in a wildcard, indicating that all of its submodules should be e...
Definition Module.h:588
ModuleId Id
The name of the module.
Definition Module.h:583
SourceLocation ExportLoc
The location of the 'export' keyword in the module map file.
Definition Module.h:580
Stored information about a header directive that was found in the module map file but has not been re...
Definition Module.h:428
std::optional< time_t > ModTime
Definition Module.h:435
static clang::ModuleFileKey getEmptyKey()
Definition Module.h:1044
static bool isEqual(const clang::ModuleFileKey &LHS, const clang::ModuleFileKey &RHS)
Definition Module.h:1056
static unsigned getHashValue(const clang::ModuleFileKey &Val)
Definition Module.h:1052
static clang::ModuleFileKey getTombstoneKey()
Definition Module.h:1048