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