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