clang  9.0.0svn
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 
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/DenseSet.h"
22 #include "llvm/ADT/Optional.h"
23 #include "llvm/ADT/PointerIntPair.h"
24 #include "llvm/ADT/PointerUnion.h"
25 #include "llvm/ADT/SetVector.h"
26 #include "llvm/ADT/SmallVector.h"
27 #include "llvm/ADT/STLExtras.h"
28 #include "llvm/ADT/StringMap.h"
29 #include "llvm/ADT/StringRef.h"
30 #include "llvm/ADT/iterator_range.h"
31 #include <array>
32 #include <cassert>
33 #include <cstdint>
34 #include <ctime>
35 #include <string>
36 #include <utility>
37 #include <vector>
38 
39 namespace llvm {
40 
41 class raw_ostream;
42 
43 } // namespace llvm
44 
45 namespace clang {
46 
47 class LangOptions;
48 class TargetInfo;
49 
50 /// Describes the name of a module.
52 
53 /// The signature of a module, which is a hash of the AST content.
54 struct ASTFileSignature : std::array<uint32_t, 5> {
55  ASTFileSignature(std::array<uint32_t, 5> S = {{0}})
56  : std::array<uint32_t, 5>(std::move(S)) {}
57 
58  explicit operator bool() const {
59  return *this != std::array<uint32_t, 5>({{0}});
60  }
61 };
62 
63 /// Describes a module or submodule.
64 class Module {
65 public:
66  /// The name of this module.
67  std::string Name;
68 
69  /// The location of the module definition.
71 
72  enum ModuleKind {
73  /// This is a module that was defined by a module map and built out
74  /// of header files.
76 
77  /// This is a C++ Modules TS module interface unit.
79 
80  /// This is a fragment of the global module within some C++ Modules
81  /// TS module.
83  };
84 
85  /// The kind of this module.
86  ModuleKind Kind = ModuleMapModule;
87 
88  /// The parent of this module. This will be NULL for the top-level
89  /// module.
91 
92  /// The build directory of this module. This is the directory in
93  /// which the module is notionally built, and relative to which its headers
94  /// are found.
95  const DirectoryEntry *Directory = nullptr;
96 
97  /// The presumed file name for the module map defining this module.
98  /// Only non-empty when building from preprocessed source.
99  std::string PresumedModuleMapFile;
100 
101  /// The umbrella header or directory.
102  llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella;
103 
104  /// The module signature.
106 
107  /// The name of the umbrella entry, as written in the module map.
108  std::string UmbrellaAsWritten;
109 
110  /// The module through which entities defined in this module will
111  /// eventually be exposed, for use in "private" modules.
112  std::string ExportAsModule;
113 
114 private:
115  /// The submodules of this module, indexed by name.
116  std::vector<Module *> SubModules;
117 
118  /// A mapping from the submodule name to the index into the
119  /// \c SubModules vector at which that submodule resides.
120  llvm::StringMap<unsigned> SubModuleIndex;
121 
122  /// The AST file if this is a top-level module which has a
123  /// corresponding serialized AST file, or null otherwise.
124  const FileEntry *ASTFile = nullptr;
125 
126  /// The top-level headers associated with this module.
128 
129  /// top-level header filenames that aren't resolved to FileEntries yet.
130  std::vector<std::string> TopHeaderNames;
131 
132  /// Cache of modules visible to lookup in this module.
133  mutable llvm::DenseSet<const Module*> VisibleModulesCache;
134 
135  /// The ID used when referencing this module within a VisibleModuleSet.
136  unsigned VisibilityID;
137 
138 public:
139  enum HeaderKind {
144  HK_Excluded
145  };
146  static const int NumHeaderKinds = HK_Excluded + 1;
147 
148  /// Information about a header directive as found in the module map
149  /// file.
150  struct Header {
151  std::string NameAsWritten;
152  const FileEntry *Entry;
153 
154  explicit operator bool() { return Entry; }
155  };
156 
157  /// Information about a directory name as found in the module map
158  /// file.
159  struct DirectoryName {
160  std::string NameAsWritten;
162 
163  explicit operator bool() { return Entry; }
164  };
165 
166  /// The headers that are part of this module.
168 
169  /// Stored information about a header directive that was found in the
170  /// module map file but has not been resolved to a file.
172  HeaderKind Kind = HK_Normal;
174  std::string FileName;
175  bool IsUmbrella = false;
176  bool HasBuiltinHeader = false;
179  };
180 
181  /// Headers that are mentioned in the module map file but that we have not
182  /// yet attempted to resolve to a file on the file system.
184 
185  /// Headers that are mentioned in the module map file but could not be
186  /// found on the file system.
188 
189  /// An individual requirement: a feature name and a flag indicating
190  /// the required state of that feature.
191  using Requirement = std::pair<std::string, bool>;
192 
193  /// The set of language features required to use this module.
194  ///
195  /// If any of these requirements are not available, the \c IsAvailable bit
196  /// will be false to indicate that this (sub)module is not available.
198 
199  /// A module with the same name that shadows this module.
200  Module *ShadowingModule = nullptr;
201 
202  /// Whether this module is missing a feature from \c Requirements.
203  unsigned IsMissingRequirement : 1;
204 
205  /// Whether we tried and failed to load a module file for this module.
207 
208  /// Whether this module is available in the current translation unit.
209  ///
210  /// If the module is missing headers or does not meet all requirements then
211  /// this bit will be 0.
212  unsigned IsAvailable : 1;
213 
214  /// Whether this module was loaded from a module file.
215  unsigned IsFromModuleFile : 1;
216 
217  /// Whether this is a framework module.
218  unsigned IsFramework : 1;
219 
220  /// Whether this is an explicit submodule.
221  unsigned IsExplicit : 1;
222 
223  /// Whether this is a "system" module (which assumes that all
224  /// headers in it are system headers).
225  unsigned IsSystem : 1;
226 
227  /// Whether this is an 'extern "C"' module (which implicitly puts all
228  /// headers in it within an 'extern "C"' block, and allows the module to be
229  /// imported within such a block).
230  unsigned IsExternC : 1;
231 
232  /// Whether this is an inferred submodule (module * { ... }).
233  unsigned IsInferred : 1;
234 
235  /// Whether we should infer submodules for this module based on
236  /// the headers.
237  ///
238  /// Submodules can only be inferred for modules with an umbrella header.
239  unsigned InferSubmodules : 1;
240 
241  /// Whether, when inferring submodules, the inferred submodules
242  /// should be explicit.
244 
245  /// Whether, when inferring submodules, the inferr submodules should
246  /// export all modules they import (e.g., the equivalent of "export *").
247  unsigned InferExportWildcard : 1;
248 
249  /// Whether the set of configuration macros is exhaustive.
250  ///
251  /// When the set of configuration macros is exhaustive, meaning
252  /// that no identifier not in this list should affect how the module is
253  /// built.
255 
256  /// Whether files in this module can only include non-modular headers
257  /// and headers from used modules.
258  unsigned NoUndeclaredIncludes : 1;
259 
260  /// Whether this module came from a "private" module map, found next
261  /// to a regular (public) module map.
262  unsigned ModuleMapIsPrivate : 1;
263 
264  /// Describes the visibility of the various names within a
265  /// particular module.
267  /// All of the names in this module are hidden.
269  /// All of the names in this module are visible.
270  AllVisible
271  };
272 
273  /// The visibility of names within this particular module.
275 
276  /// The location of the inferred submodule.
278 
279  /// The set of modules imported by this module, and on which this
280  /// module depends.
282 
283  /// Describes an exported module.
284  ///
285  /// The pointer is the module being re-exported, while the bit will be true
286  /// to indicate that this is a wildcard export.
287  using ExportDecl = llvm::PointerIntPair<Module *, 1, bool>;
288 
289  /// The set of export declarations.
291 
292  /// Describes an exported module that has not yet been resolved
293  /// (perhaps because the module it refers to has not yet been loaded).
295  /// The location of the 'export' keyword in the module map file.
297 
298  /// The name of the module.
300 
301  /// Whether this export declaration ends in a wildcard, indicating
302  /// that all of its submodules should be exported (rather than the named
303  /// module itself).
304  bool Wildcard;
305  };
306 
307  /// The set of export declarations that have yet to be resolved.
309 
310  /// The directly used modules.
312 
313  /// The set of use declarations that have yet to be resolved.
315 
316  /// A library or framework to link against when an entity from this
317  /// module is used.
318  struct LinkLibrary {
319  LinkLibrary() = default;
320  LinkLibrary(const std::string &Library, bool IsFramework)
321  : Library(Library), IsFramework(IsFramework) {}
322 
323  /// The library to link against.
324  ///
325  /// This will typically be a library or framework name, but can also
326  /// be an absolute path to the library or framework.
327  std::string Library;
328 
329  /// Whether this is a framework rather than a library.
330  bool IsFramework = false;
331  };
332 
333  /// The set of libraries or frameworks to link against when
334  /// an entity from this module is used.
336 
337  /// Autolinking uses the framework name for linking purposes
338  /// when this is false and the export_as name otherwise.
339  bool UseExportAsModuleLinkName = false;
340 
341  /// The set of "configuration macros", which are macros that
342  /// (intentionally) change how this module is built.
343  std::vector<std::string> ConfigMacros;
344 
345  /// An unresolved conflict with another module.
347  /// The (unresolved) module id.
349 
350  /// The message provided to the user when there is a conflict.
351  std::string Message;
352  };
353 
354  /// The list of conflicts for which the module-id has not yet been
355  /// resolved.
356  std::vector<UnresolvedConflict> UnresolvedConflicts;
357 
358  /// A conflict between two modules.
359  struct Conflict {
360  /// The module that this module conflicts with.
362 
363  /// The message provided to the user when there is a conflict.
364  std::string Message;
365  };
366 
367  /// The list of conflicts.
368  std::vector<Conflict> Conflicts;
369 
370  /// Construct a new module or submodule.
371  Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent,
372  bool IsFramework, bool IsExplicit, unsigned VisibilityID);
373 
374  ~Module();
375 
376  /// Determine whether this module is available for use within the
377  /// current translation unit.
378  bool isAvailable() const { return IsAvailable; }
379 
380  /// Determine whether this module is available for use within the
381  /// current translation unit.
382  ///
383  /// \param LangOpts The language options used for the current
384  /// translation unit.
385  ///
386  /// \param Target The target options used for the current translation unit.
387  ///
388  /// \param Req If this module is unavailable because of a missing requirement,
389  /// this parameter will be set to one of the requirements that is not met for
390  /// use of this module.
391  ///
392  /// \param MissingHeader If this module is unavailable because of a missing
393  /// header, this parameter will be set to one of the missing headers.
394  ///
395  /// \param ShadowingModule If this module is unavailable because it is
396  /// shadowed, this parameter will be set to the shadowing module.
397  bool isAvailable(const LangOptions &LangOpts,
398  const TargetInfo &Target,
399  Requirement &Req,
400  UnresolvedHeaderDirective &MissingHeader,
401  Module *&ShadowingModule) const;
402 
403  /// Determine whether this module is a submodule.
404  bool isSubModule() const { return Parent != nullptr; }
405 
406  /// Determine whether this module is a submodule of the given other
407  /// module.
408  bool isSubModuleOf(const Module *Other) const;
409 
410  /// Determine whether this module is a part of a framework,
411  /// either because it is a framework module or because it is a submodule
412  /// of a framework module.
413  bool isPartOfFramework() const {
414  for (const Module *Mod = this; Mod; Mod = Mod->Parent)
415  if (Mod->IsFramework)
416  return true;
417 
418  return false;
419  }
420 
421  /// Determine whether this module is a subframework of another
422  /// framework.
423  bool isSubFramework() const {
424  return IsFramework && Parent && Parent->isPartOfFramework();
425  }
426 
427  /// Set the parent of this module. This should only be used if the parent
428  /// could not be set during module creation.
429  void setParent(Module *M) {
430  assert(!Parent);
431  Parent = M;
432  Parent->SubModuleIndex[Name] = Parent->SubModules.size();
433  Parent->SubModules.push_back(this);
434  }
435 
436  /// Retrieve the full name of this module, including the path from
437  /// its top-level module.
438  /// \param AllowStringLiterals If \c true, components that might not be
439  /// lexically valid as identifiers will be emitted as string literals.
440  std::string getFullModuleName(bool AllowStringLiterals = false) const;
441 
442  /// Whether the full name of this module is equal to joining
443  /// \p nameParts with "."s.
444  ///
445  /// This is more efficient than getFullModuleName().
446  bool fullModuleNameIs(ArrayRef<StringRef> nameParts) const;
447 
448  /// Retrieve the top-level module for this (sub)module, which may
449  /// be this module.
451  return const_cast<Module *>(
452  const_cast<const Module *>(this)->getTopLevelModule());
453  }
454 
455  /// Retrieve the top-level module for this (sub)module, which may
456  /// be this module.
457  const Module *getTopLevelModule() const;
458 
459  /// Retrieve the name of the top-level module.
460  StringRef getTopLevelModuleName() const {
461  return getTopLevelModule()->Name;
462  }
463 
464  /// The serialized AST file for this module, if one was created.
465  const FileEntry *getASTFile() const {
466  return getTopLevelModule()->ASTFile;
467  }
468 
469  /// Set the serialized AST file for the top-level module of this module.
470  void setASTFile(const FileEntry *File) {
471  assert((File == nullptr || getASTFile() == nullptr ||
472  getASTFile() == File) && "file path changed");
473  getTopLevelModule()->ASTFile = File;
474  }
475 
476  /// Retrieve the directory for which this module serves as the
477  /// umbrella.
478  DirectoryName getUmbrellaDir() const;
479 
480  /// Retrieve the header that serves as the umbrella header for this
481  /// module.
483  if (auto *E = Umbrella.dyn_cast<const FileEntry *>())
484  return Header{UmbrellaAsWritten, E};
485  return Header{};
486  }
487 
488  /// Determine whether this module has an umbrella directory that is
489  /// not based on an umbrella header.
490  bool hasUmbrellaDir() const {
491  return Umbrella && Umbrella.is<const DirectoryEntry *>();
492  }
493 
494  /// Add a top-level header associated with this module.
495  void addTopHeader(const FileEntry *File) {
496  assert(File);
497  TopHeaders.insert(File);
498  }
499 
500  /// Add a top-level header filename associated with this module.
501  void addTopHeaderFilename(StringRef Filename) {
502  TopHeaderNames.push_back(Filename);
503  }
504 
505  /// The top-level headers associated with this module.
506  ArrayRef<const FileEntry *> getTopHeaders(FileManager &FileMgr);
507 
508  /// Determine whether this module has declared its intention to
509  /// directly use another module.
510  bool directlyUses(const Module *Requested) const;
511 
512  /// Add the given feature requirement to the list of features
513  /// required by this module.
514  ///
515  /// \param Feature The feature that is required by this module (and
516  /// its submodules).
517  ///
518  /// \param RequiredState The required state of this feature: \c true
519  /// if it must be present, \c false if it must be absent.
520  ///
521  /// \param LangOpts The set of language options that will be used to
522  /// evaluate the availability of this feature.
523  ///
524  /// \param Target The target options that will be used to evaluate the
525  /// availability of this feature.
526  void addRequirement(StringRef Feature, bool RequiredState,
527  const LangOptions &LangOpts,
528  const TargetInfo &Target);
529 
530  /// Mark this module and all of its submodules as unavailable.
531  void markUnavailable(bool MissingRequirement = false);
532 
533  /// Find the submodule with the given name.
534  ///
535  /// \returns The submodule if found, or NULL otherwise.
536  Module *findSubmodule(StringRef Name) const;
537 
538  /// Determine whether the specified module would be visible to
539  /// a lookup at the end of this module.
540  ///
541  /// FIXME: This may return incorrect results for (submodules of) the
542  /// module currently being built, if it's queried before we see all
543  /// of its imports.
544  bool isModuleVisible(const Module *M) const {
545  if (VisibleModulesCache.empty())
546  buildVisibleModulesCache();
547  return VisibleModulesCache.count(M);
548  }
549 
550  unsigned getVisibilityID() const { return VisibilityID; }
551 
552  using submodule_iterator = std::vector<Module *>::iterator;
553  using submodule_const_iterator = std::vector<Module *>::const_iterator;
554 
555  submodule_iterator submodule_begin() { return SubModules.begin(); }
556  submodule_const_iterator submodule_begin() const {return SubModules.begin();}
557  submodule_iterator submodule_end() { return SubModules.end(); }
558  submodule_const_iterator submodule_end() const { return SubModules.end(); }
559 
560  llvm::iterator_range<submodule_iterator> submodules() {
561  return llvm::make_range(submodule_begin(), submodule_end());
562  }
563  llvm::iterator_range<submodule_const_iterator> submodules() const {
564  return llvm::make_range(submodule_begin(), submodule_end());
565  }
566 
567  /// Appends this module's list of exported modules to \p Exported.
568  ///
569  /// This provides a subset of immediately imported modules (the ones that are
570  /// directly exported), not the complete set of exported modules.
571  void getExportedModules(SmallVectorImpl<Module *> &Exported) const;
572 
573  static StringRef getModuleInputBufferName() {
574  return "<module-includes>";
575  }
576 
577  /// Print the module map for this module to the given stream.
578  void print(raw_ostream &OS, unsigned Indent = 0) const;
579 
580  /// Dump the contents of this module to the given output stream.
581  void dump() const;
582 
583 private:
584  void buildVisibleModulesCache() const;
585 };
586 
587 /// A set of visible modules.
589 public:
590  VisibleModuleSet() = default;
592  : ImportLocs(std::move(O.ImportLocs)), Generation(O.Generation ? 1 : 0) {
593  O.ImportLocs.clear();
594  ++O.Generation;
595  }
596 
597  /// Move from another visible modules set. Guaranteed to leave the source
598  /// empty and bump the generation on both.
600  ImportLocs = std::move(O.ImportLocs);
601  O.ImportLocs.clear();
602  ++O.Generation;
603  ++Generation;
604  return *this;
605  }
606 
607  /// Get the current visibility generation. Incremented each time the
608  /// set of visible modules changes in any way.
609  unsigned getGeneration() const { return Generation; }
610 
611  /// Determine whether a module is visible.
612  bool isVisible(const Module *M) const {
613  return getImportLoc(M).isValid();
614  }
615 
616  /// Get the location at which the import of a module was triggered.
618  return M->getVisibilityID() < ImportLocs.size()
619  ? ImportLocs[M->getVisibilityID()]
620  : SourceLocation();
621  }
622 
623  /// A callback to call when a module is made visible (directly or
624  /// indirectly) by a call to \ref setVisible.
625  using VisibleCallback = llvm::function_ref<void(Module *M)>;
626 
627  /// A callback to call when a module conflict is found. \p Path
628  /// consists of a sequence of modules from the conflicting module to the one
629  /// made visible, where each was exported by the next.
630  using ConflictCallback =
631  llvm::function_ref<void(ArrayRef<Module *> Path, Module *Conflict,
632  StringRef Message)>;
633 
634  /// Make a specific module visible.
635  void setVisible(Module *M, SourceLocation Loc,
636  VisibleCallback Vis = [](Module *) {},
638  StringRef) {});
639 
640 private:
641  /// Import locations for each visible module. Indexed by the module's
642  /// VisibilityID.
643  std::vector<SourceLocation> ImportLocs;
644 
645  /// Visibility generation, bumped every time the visibility state changes.
646  unsigned Generation = 0;
647 };
648 
649 } // namespace clang
650 
651 #endif // LLVM_CLANG_BASIC_MODULE_H
SourceLocation ExportLoc
The location of the &#39;export&#39; keyword in the module map file.
Definition: Module.h:296
unsigned IsAvailable
Whether this module is available in the current translation unit.
Definition: Module.h:212
SmallVector< UnresolvedExportDecl, 2 > UnresolvedExports
The set of export declarations that have yet to be resolved.
Definition: Module.h:308
ASTFileSignature Signature
The module signature.
Definition: Module.h:105
std::string Name
The name of this module.
Definition: Module.h:67
A set of visible modules.
Definition: Module.h:588
ASTFileSignature(std::array< uint32_t, 5 > S={{0}})
Definition: Module.h:55
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:187
std::string Message
The message provided to the user when there is a conflict.
Definition: Module.h:351
bool isSubFramework() const
Determine whether this module is a subframework of another framework.
Definition: Module.h:423
std::vector< Module * >::iterator submodule_iterator
Definition: Module.h:552
Implements support for file system lookup, file system caching, and directory search management...
Definition: FileManager.h:116
Defines the clang::FileManager interface and associated types.
An unresolved conflict with another module.
Definition: Module.h:346
unsigned getVisibilityID() const
Definition: Module.h:550
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:29
submodule_iterator submodule_begin()
Definition: Module.h:555
unsigned IsExternC
Whether this is an &#39;extern "C"&#39; module (which implicitly puts all headers in it within an &#39;extern "C"...
Definition: Module.h:230
void addTopHeaderFilename(StringRef Filename)
Add a top-level header filename associated with this module.
Definition: Module.h:501
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
Definition: Module.h:450
std::vector< UnresolvedConflict > UnresolvedConflicts
The list of conflicts for which the module-id has not yet been resolved.
Definition: Module.h:356
unsigned IsFramework
Whether this is a framework module.
Definition: Module.h:218
SourceLocation getImportLoc(const Module *M) const
Get the location at which the import of a module was triggered.
Definition: Module.h:617
const FileEntry * getASTFile() const
The serialized AST file for this module, if one was created.
Definition: Module.h:465
bool hasUmbrellaDir() const
Determine whether this module has an umbrella directory that is not based on an umbrella header...
Definition: Module.h:490
This is a module that was defined by a module map and built out of header files.
Definition: Module.h:75
std::string PresumedModuleMapFile
The presumed file name for the module map defining this module.
Definition: Module.h:99
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:413
A library or framework to link against when an entity from this module is used.
Definition: Module.h:318
static StringRef getModuleInputBufferName()
Definition: Module.h:573
SmallVector< Requirement, 2 > Requirements
The set of language features required to use this module.
Definition: Module.h:197
Definition: Format.h:2118
Header getUmbrellaHeader() const
Retrieve the header that serves as the umbrella header for this module.
Definition: Module.h:482
bool isVisible(const Module *M) const
Determine whether a module is visible.
Definition: Module.h:612
The signature of a module, which is a hash of the AST content.
Definition: Module.h:54
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:49
Describes a module or submodule.
Definition: Module.h:64
StringRef getTopLevelModuleName() const
Retrieve the name of the top-level module.
Definition: Module.h:460
unsigned InferExportWildcard
Whether, when inferring submodules, the inferr submodules should export all modules they import (e...
Definition: Module.h:247
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
std::string Message
The message provided to the user when there is a conflict.
Definition: Module.h:364
ModuleId Id
The (unresolved) module id.
Definition: Module.h:348
Module * Parent
The parent of this module.
Definition: Module.h:90
unsigned IsInferred
Whether this is an inferred submodule (module * { ... }).
Definition: Module.h:233
unsigned IsFromModuleFile
Whether this module was loaded from a module file.
Definition: Module.h:215
submodule_iterator submodule_end()
Definition: Module.h:557
LinkLibrary(const std::string &Library, bool IsFramework)
Definition: Module.h:320
VisibleModuleSet(VisibleModuleSet &&O)
Definition: Module.h:591
unsigned NoUndeclaredIncludes
Whether files in this module can only include non-modular headers and headers from used modules...
Definition: Module.h:258
unsigned IsSystem
Whether this is a "system" module (which assumes that all headers in it are system headers)...
Definition: Module.h:225
void setParent(Module *M)
Set the parent of this module.
Definition: Module.h:429
llvm::SmallSetVector< Module *, 2 > Imports
The set of modules imported by this module, and on which this module depends.
Definition: Module.h:281
StringRef Filename
Definition: Format.cpp:1667
std::string Library
The library to link against.
Definition: Module.h:327
const DirectoryEntry * Entry
Definition: Module.h:161
SmallVector< std::pair< std::string, SourceLocation >, 2 > ModuleId
Describes the name of a module.
Definition: Module.h:51
Exposes information about the current target.
Definition: TargetInfo.h:161
SmallVector< ModuleId, 2 > UnresolvedDirectUses
The set of use declarations that have yet to be resolved.
Definition: Module.h:314
ModuleId Id
The name of the module.
Definition: Module.h:299
VisibleModuleSet & operator=(VisibleModuleSet &&O)
Move from another visible modules set.
Definition: Module.h:599
unsigned ConfigMacrosExhaustive
Whether the set of configuration macros is exhaustive.
Definition: Module.h:254
#define bool
Definition: stdbool.h:31
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:335
std::string NameAsWritten
Definition: Module.h:151
bool isAvailable() const
Determine whether this module is available for use within the current translation unit...
Definition: Module.h:378
Information about a header directive as found in the module map file.
Definition: Module.h:150
SmallVector< ExportDecl, 2 > Exports
The set of export declarations.
Definition: Module.h:290
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:632
Kind
void setASTFile(const FileEntry *File)
Set the serialized AST file for the top-level module of this module.
Definition: Module.h:470
Encodes a location in the source.
std::string ExportAsModule
The module through which entities defined in this module will eventually be exposed, for use in "private" modules.
Definition: Module.h:112
NameVisibilityKind NameVisibility
The visibility of names within this particular module.
Definition: Module.h:274
All of the names in this module are hidden.
Definition: Module.h:268
Information about a directory name as found in the module map file.
Definition: Module.h:159
Cached information about one file (either on disk or in the virtual file system). ...
Definition: FileManager.h:59
const FileEntry * Entry
Definition: Module.h:152
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:544
This is a fragment of the global module within some C++ Modules TS module.
Definition: Module.h:82
bool Wildcard
Whether this export declaration ends in a wildcard, indicating that all of its submodules should be e...
Definition: Module.h:304
std::pair< std::string, bool > Requirement
An individual requirement: a feature name and a flag indicating the required state of that feature...
Definition: Module.h:191
llvm::iterator_range< submodule_const_iterator > submodules() const
Definition: Module.h:563
bool isSubModule() const
Determine whether this module is a submodule.
Definition: Module.h:404
A conflict between two modules.
Definition: Module.h:359
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:183
Dataflow Directional Tag Classes.
unsigned IsMissingRequirement
Whether this module is missing a feature from Requirements.
Definition: Module.h:203
Stored information about a header directive that was found in the module map file but has not been re...
Definition: Module.h:171
llvm::PointerUnion< const DirectoryEntry *, const FileEntry * > Umbrella
The umbrella header or directory.
Definition: Module.h:102
SourceLocation InferredSubmoduleLoc
The location of the inferred submodule.
Definition: Module.h:277
llvm::iterator_range< submodule_iterator > submodules()
Definition: Module.h:560
llvm::PointerIntPair< Module *, 1, bool > ExportDecl
Describes an exported module.
Definition: Module.h:287
void addTopHeader(const FileEntry *File)
Add a top-level header associated with this module.
Definition: Module.h:495
unsigned ModuleMapIsPrivate
Whether this module came from a "private" module map, found next to a regular (public) module map...
Definition: Module.h:262
SourceLocation DefinitionLoc
The location of the module definition.
Definition: Module.h:70
std::vector< Conflict > Conflicts
The list of conflicts.
Definition: Module.h:368
SmallVector< Module *, 2 > DirectUses
The directly used modules.
Definition: Module.h:311
Describes an exported module that has not yet been resolved (perhaps because the module it refers to ...
Definition: Module.h:294
unsigned getGeneration() const
Get the current visibility generation.
Definition: Module.h:609
std::string NameAsWritten
Definition: Module.h:160
Cached information about one directory (either on disk or in the virtual file system).
Definition: FileManager.h:45
submodule_const_iterator submodule_begin() const
Definition: Module.h:556
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:625
Defines the clang::SourceLocation class and associated facilities.
unsigned InferSubmodules
Whether we should infer submodules for this module based on the headers.
Definition: Module.h:239
unsigned HasIncompatibleModuleFile
Whether we tried and failed to load a module file for this module.
Definition: Module.h:206
NameVisibilityKind
Describes the visibility of the various names within a particular module.
Definition: Module.h:266
std::vector< std::string > ConfigMacros
The set of "configuration macros", which are macros that (intentionally) change how this module is bu...
Definition: Module.h:343
submodule_const_iterator submodule_end() const
Definition: Module.h:558
std::string UmbrellaAsWritten
The name of the umbrella entry, as written in the module map.
Definition: Module.h:108
Module * Other
The module that this module conflicts with.
Definition: Module.h:361
unsigned IsExplicit
Whether this is an explicit submodule.
Definition: Module.h:221
std::vector< Module * >::const_iterator submodule_const_iterator
Definition: Module.h:553
unsigned InferExplicitSubmodules
Whether, when inferring submodules, the inferred submodules should be explicit.
Definition: Module.h:243
This is a C++ Modules TS module interface unit.
Definition: Module.h:78