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