1 //===-- CompilerInstance.h - Clang Compiler Instance ------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
10 #define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
12 #include "clang/AST/ASTConsumer.h"
13 #include "clang/Basic/Diagnostic.h"
14 #include "clang/Basic/SourceManager.h"
15 #include "clang/Frontend/CompilerInvocation.h"
16 #include "clang/Frontend/PCHContainerOperations.h"
17 #include "clang/Frontend/Utils.h"
18 #include "clang/Lex/HeaderSearchOptions.h"
19 #include "clang/Lex/ModuleLoader.h"
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/DenseMap.h"
22 #include "llvm/ADT/IntrusiveRefCntPtr.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/Support/BuryPointer.h"
40 class CodeCompleteConsumer;
41 class DiagnosticsEngine;
42 class DiagnosticConsumer;
43 class ExternalASTSource;
47 class InMemoryModuleCache;
54 /// CompilerInstance - Helper class for managing a single instance of the Clang
57 /// The CompilerInstance serves two purposes:
58 /// (1) It manages the various objects which are necessary to run the compiler,
59 /// for example the preprocessor, the target information, and the AST
61 /// (2) It provides utility routines for constructing and manipulating the
62 /// common Clang objects.
64 /// The compiler instance generally owns the instance of all the objects that it
65 /// manages. However, clients can still share objects by manually setting the
66 /// object and retaking ownership prior to destroying the CompilerInstance.
68 /// The compiler instance is intended to simplify clients, but not to lock them
69 /// in to the compiler instance for everything. When possible, utility functions
70 /// come in two forms; a short form that reuses the CompilerInstance objects,
71 /// and a long form that takes explicit instances of any required objects.
72 class CompilerInstance : public ModuleLoader {
73 /// The options used in this compiler instance.
74 std::shared_ptr<CompilerInvocation> Invocation;
76 /// The diagnostics engine instance.
77 IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
79 /// The target being compiled for.
80 IntrusiveRefCntPtr<TargetInfo> Target;
82 /// Auxiliary Target info.
83 IntrusiveRefCntPtr<TargetInfo> AuxTarget;
86 IntrusiveRefCntPtr<FileManager> FileMgr;
88 /// The source manager.
89 IntrusiveRefCntPtr<SourceManager> SourceMgr;
91 /// The cache of PCM files.
92 IntrusiveRefCntPtr<InMemoryModuleCache> ModuleCache;
95 std::shared_ptr<Preprocessor> PP;
98 IntrusiveRefCntPtr<ASTContext> Context;
100 /// An optional sema source that will be attached to sema.
101 IntrusiveRefCntPtr<ExternalSemaSource> ExternalSemaSrc;
103 /// The AST consumer.
104 std::unique_ptr<ASTConsumer> Consumer;
106 /// The code completion consumer.
107 std::unique_ptr<CodeCompleteConsumer> CompletionConsumer;
109 /// The semantic analysis object.
110 std::unique_ptr<Sema> TheSema;
112 /// The frontend timer group.
113 std::unique_ptr<llvm::TimerGroup> FrontendTimerGroup;
115 /// The frontend timer.
116 std::unique_ptr<llvm::Timer> FrontendTimer;
118 /// The ASTReader, if one exists.
119 IntrusiveRefCntPtr<ASTReader> ModuleManager;
121 /// The module dependency collector for crashdumps
122 std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector;
124 /// The module provider.
125 std::shared_ptr<PCHContainerOperations> ThePCHContainerOperations;
127 std::vector<std::shared_ptr<DependencyCollector>> DependencyCollectors;
129 /// The set of top-level modules that has already been loaded,
130 /// along with the module map
131 llvm::DenseMap<const IdentifierInfo *, Module *> KnownModules;
133 /// The set of top-level modules that has already been built on the
134 /// fly as part of this overall compilation action.
135 std::map<std::string, std::string> BuiltModules;
137 /// Should we delete the BuiltModules when we're done?
138 bool DeleteBuiltModules = true;
140 /// The location of the module-import keyword for the last module
142 SourceLocation LastModuleImportLoc;
144 /// The result of the last module import.
146 ModuleLoadResult LastModuleImportResult;
148 /// Whether we should (re)build the global module index once we
149 /// have finished with this translation unit.
150 bool BuildGlobalModuleIndex = false;
152 /// We have a full global module index, with all modules.
153 bool HaveFullGlobalModuleIndex = false;
155 /// One or more modules failed to build.
156 bool ModuleBuildFailed = false;
158 /// Holds information about the output file.
160 /// If TempFilename is not empty we must rename it to Filename at the end.
161 /// TempFilename may be empty and Filename non-empty if creating the temporary
164 std::string Filename;
165 std::string TempFilename;
167 OutputFile(std::string filename, std::string tempFilename)
168 : Filename(std::move(filename)), TempFilename(std::move(tempFilename)) {
172 /// If the output doesn't support seeking (terminal, pipe). we switch
173 /// the stream to a buffer_ostream. These are the buffer and the original
175 std::unique_ptr<llvm::raw_fd_ostream> NonSeekStream;
177 /// The list of active output files.
178 std::list<OutputFile> OutputFiles;
180 /// Force an output buffer.
181 std::unique_ptr<llvm::raw_pwrite_stream> OutputStream;
183 CompilerInstance(const CompilerInstance &) = delete;
184 void operator=(const CompilerInstance &) = delete;
186 explicit CompilerInstance(
187 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
188 std::make_shared<PCHContainerOperations>(),
189 InMemoryModuleCache *SharedModuleCache = nullptr);
190 ~CompilerInstance() override;
192 /// @name High-Level Operations
195 /// ExecuteAction - Execute the provided action against the compiler's
196 /// CompilerInvocation object.
198 /// This function makes the following assumptions:
200 /// - The invocation options should be initialized. This function does not
201 /// handle the '-help' or '-version' options, clients should handle those
204 /// - The diagnostics engine should have already been created by the client.
206 /// - No other CompilerInstance state should have been initialized (this is
207 /// an unchecked error).
209 /// - Clients should have initialized any LLVM target features that may be
212 /// - Clients should eventually call llvm_shutdown() upon the completion of
213 /// this routine to ensure that any managed objects are properly destroyed.
215 /// Note that this routine may write output to 'stderr'.
217 /// \param Act - The action to execute.
218 /// \return - True on success.
220 // FIXME: This function should take the stream to write any debugging /
221 // verbose output to as an argument.
223 // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
224 // of the context or else not CompilerInstance specific.
225 bool ExecuteAction(FrontendAction &Act);
228 /// @name Compiler Invocation and Options
231 bool hasInvocation() const { return Invocation != nullptr; }
233 CompilerInvocation &getInvocation() {
234 assert(Invocation && "Compiler instance has no invocation!");
238 /// setInvocation - Replace the current invocation.
239 void setInvocation(std::shared_ptr<CompilerInvocation> Value);
241 /// Indicates whether we should (re)build the global module index.
242 bool shouldBuildGlobalModuleIndex() const;
244 /// Set the flag indicating whether we should (re)build the global
246 void setBuildGlobalModuleIndex(bool Build) {
247 BuildGlobalModuleIndex = Build;
251 /// @name Forwarding Methods
254 AnalyzerOptionsRef getAnalyzerOpts() {
255 return Invocation->getAnalyzerOpts();
258 CodeGenOptions &getCodeGenOpts() {
259 return Invocation->getCodeGenOpts();
261 const CodeGenOptions &getCodeGenOpts() const {
262 return Invocation->getCodeGenOpts();
265 DependencyOutputOptions &getDependencyOutputOpts() {
266 return Invocation->getDependencyOutputOpts();
268 const DependencyOutputOptions &getDependencyOutputOpts() const {
269 return Invocation->getDependencyOutputOpts();
272 DiagnosticOptions &getDiagnosticOpts() {
273 return Invocation->getDiagnosticOpts();
275 const DiagnosticOptions &getDiagnosticOpts() const {
276 return Invocation->getDiagnosticOpts();
279 FileSystemOptions &getFileSystemOpts() {
280 return Invocation->getFileSystemOpts();
282 const FileSystemOptions &getFileSystemOpts() const {
283 return Invocation->getFileSystemOpts();
286 FrontendOptions &getFrontendOpts() {
287 return Invocation->getFrontendOpts();
289 const FrontendOptions &getFrontendOpts() const {
290 return Invocation->getFrontendOpts();
293 HeaderSearchOptions &getHeaderSearchOpts() {
294 return Invocation->getHeaderSearchOpts();
296 const HeaderSearchOptions &getHeaderSearchOpts() const {
297 return Invocation->getHeaderSearchOpts();
299 std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() const {
300 return Invocation->getHeaderSearchOptsPtr();
303 LangOptions &getLangOpts() {
304 return *Invocation->getLangOpts();
306 const LangOptions &getLangOpts() const {
307 return *Invocation->getLangOpts();
310 PreprocessorOptions &getPreprocessorOpts() {
311 return Invocation->getPreprocessorOpts();
313 const PreprocessorOptions &getPreprocessorOpts() const {
314 return Invocation->getPreprocessorOpts();
317 PreprocessorOutputOptions &getPreprocessorOutputOpts() {
318 return Invocation->getPreprocessorOutputOpts();
320 const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
321 return Invocation->getPreprocessorOutputOpts();
324 TargetOptions &getTargetOpts() {
325 return Invocation->getTargetOpts();
327 const TargetOptions &getTargetOpts() const {
328 return Invocation->getTargetOpts();
332 /// @name Diagnostics Engine
335 bool hasDiagnostics() const { return Diagnostics != nullptr; }
337 /// Get the current diagnostics engine.
338 DiagnosticsEngine &getDiagnostics() const {
339 assert(Diagnostics && "Compiler instance has no diagnostics!");
343 /// setDiagnostics - Replace the current diagnostics engine.
344 void setDiagnostics(DiagnosticsEngine *Value);
346 DiagnosticConsumer &getDiagnosticClient() const {
347 assert(Diagnostics && Diagnostics->getClient() &&
348 "Compiler instance has no diagnostic client!");
349 return *Diagnostics->getClient();
353 /// @name Target Info
356 bool hasTarget() const { return Target != nullptr; }
358 TargetInfo &getTarget() const {
359 assert(Target && "Compiler instance has no target!");
363 /// Replace the current Target.
364 void setTarget(TargetInfo *Value);
367 /// @name AuxTarget Info
370 TargetInfo *getAuxTarget() const { return AuxTarget.get(); }
372 /// Replace the current AuxTarget.
373 void setAuxTarget(TargetInfo *Value);
376 /// @name Virtual File System
379 llvm::vfs::FileSystem &getVirtualFileSystem() const {
380 return getFileManager().getVirtualFileSystem();
384 /// @name File Manager
387 bool hasFileManager() const { return FileMgr != nullptr; }
389 /// Return the current file manager to the caller.
390 FileManager &getFileManager() const {
391 assert(FileMgr && "Compiler instance has no file manager!");
395 void resetAndLeakFileManager() {
396 llvm::BuryPointer(FileMgr.get());
397 FileMgr.resetWithoutRelease();
400 /// Replace the current file manager and virtual file system.
401 void setFileManager(FileManager *Value);
404 /// @name Source Manager
407 bool hasSourceManager() const { return SourceMgr != nullptr; }
409 /// Return the current source manager.
410 SourceManager &getSourceManager() const {
411 assert(SourceMgr && "Compiler instance has no source manager!");
415 void resetAndLeakSourceManager() {
416 llvm::BuryPointer(SourceMgr.get());
417 SourceMgr.resetWithoutRelease();
420 /// setSourceManager - Replace the current source manager.
421 void setSourceManager(SourceManager *Value);
424 /// @name Preprocessor
427 bool hasPreprocessor() const { return PP != nullptr; }
429 /// Return the current preprocessor.
430 Preprocessor &getPreprocessor() const {
431 assert(PP && "Compiler instance has no preprocessor!");
435 std::shared_ptr<Preprocessor> getPreprocessorPtr() { return PP; }
437 void resetAndLeakPreprocessor() {
438 llvm::BuryPointer(new std::shared_ptr<Preprocessor>(PP));
441 /// Replace the current preprocessor.
442 void setPreprocessor(std::shared_ptr<Preprocessor> Value);
448 bool hasASTContext() const { return Context != nullptr; }
450 ASTContext &getASTContext() const {
451 assert(Context && "Compiler instance has no AST context!");
455 void resetAndLeakASTContext() {
456 llvm::BuryPointer(Context.get());
457 Context.resetWithoutRelease();
460 /// setASTContext - Replace the current AST context.
461 void setASTContext(ASTContext *Value);
463 /// Replace the current Sema; the compiler instance takes ownership
465 void setSema(Sema *S);
468 /// @name ASTConsumer
471 bool hasASTConsumer() const { return (bool)Consumer; }
473 ASTConsumer &getASTConsumer() const {
474 assert(Consumer && "Compiler instance has no AST consumer!");
478 /// takeASTConsumer - Remove the current AST consumer and give ownership to
480 std::unique_ptr<ASTConsumer> takeASTConsumer() { return std::move(Consumer); }
482 /// setASTConsumer - Replace the current AST consumer; the compiler instance
483 /// takes ownership of \p Value.
484 void setASTConsumer(std::unique_ptr<ASTConsumer> Value);
487 /// @name Semantic analysis
489 bool hasSema() const { return (bool)TheSema; }
491 Sema &getSema() const {
492 assert(TheSema && "Compiler instance has no Sema object!");
496 std::unique_ptr<Sema> takeSema();
497 void resetAndLeakSema();
500 /// @name Module Management
503 IntrusiveRefCntPtr<ASTReader> getModuleManager() const;
504 void setModuleManager(IntrusiveRefCntPtr<ASTReader> Reader);
506 std::shared_ptr<ModuleDependencyCollector> getModuleDepCollector() const;
507 void setModuleDepCollector(
508 std::shared_ptr<ModuleDependencyCollector> Collector);
510 std::shared_ptr<PCHContainerOperations> getPCHContainerOperations() const {
511 return ThePCHContainerOperations;
514 /// Return the appropriate PCHContainerWriter depending on the
515 /// current CodeGenOptions.
516 const PCHContainerWriter &getPCHContainerWriter() const {
517 assert(Invocation && "cannot determine module format without invocation");
518 StringRef Format = getHeaderSearchOpts().ModuleFormat;
519 auto *Writer = ThePCHContainerOperations->getWriterOrNull(Format);
522 Diagnostics->Report(diag::err_module_format_unhandled) << Format;
523 llvm::report_fatal_error("unknown module format");
528 /// Return the appropriate PCHContainerReader depending on the
529 /// current CodeGenOptions.
530 const PCHContainerReader &getPCHContainerReader() const {
531 assert(Invocation && "cannot determine module format without invocation");
532 StringRef Format = getHeaderSearchOpts().ModuleFormat;
533 auto *Reader = ThePCHContainerOperations->getReaderOrNull(Format);
536 Diagnostics->Report(diag::err_module_format_unhandled) << Format;
537 llvm::report_fatal_error("unknown module format");
543 /// @name Code Completion
546 bool hasCodeCompletionConsumer() const { return (bool)CompletionConsumer; }
548 CodeCompleteConsumer &getCodeCompletionConsumer() const {
549 assert(CompletionConsumer &&
550 "Compiler instance has no code completion consumer!");
551 return *CompletionConsumer;
554 /// setCodeCompletionConsumer - Replace the current code completion consumer;
555 /// the compiler instance takes ownership of \p Value.
556 void setCodeCompletionConsumer(CodeCompleteConsumer *Value);
559 /// @name Frontend timer
562 bool hasFrontendTimer() const { return (bool)FrontendTimer; }
564 llvm::Timer &getFrontendTimer() const {
565 assert(FrontendTimer && "Compiler instance has no frontend timer!");
566 return *FrontendTimer;
570 /// @name Output Files
573 /// addOutputFile - Add an output file onto the list of tracked output files.
575 /// \param OutFile - The output file info.
576 void addOutputFile(OutputFile &&OutFile);
578 /// clearOutputFiles - Clear the output file list. The underlying output
579 /// streams must have been closed beforehand.
581 /// \param EraseFiles - If true, attempt to erase the files from disk.
582 void clearOutputFiles(bool EraseFiles);
585 /// @name Construction Utility Methods
588 /// Create the diagnostics engine using the invocation's diagnostic options
589 /// and replace any existing one with it.
591 /// Note that this routine also replaces the diagnostic client,
592 /// allocating one if one is not provided.
594 /// \param Client If non-NULL, a diagnostic client that will be
595 /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
598 /// \param ShouldOwnClient If Client is non-NULL, specifies whether
599 /// the diagnostic object should take ownership of the client.
600 void createDiagnostics(DiagnosticConsumer *Client = nullptr,
601 bool ShouldOwnClient = true);
603 /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
605 /// If no diagnostic client is provided, this creates a
606 /// DiagnosticConsumer that is owned by the returned diagnostic
607 /// object, if using directly the caller is responsible for
608 /// releasing the returned DiagnosticsEngine's client eventually.
610 /// \param Opts - The diagnostic options; note that the created text
611 /// diagnostic object contains a reference to these options.
613 /// \param Client If non-NULL, a diagnostic client that will be
614 /// attached to (and, then, owned by) the returned DiagnosticsEngine
617 /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
618 /// used by some diagnostics printers (for logging purposes only).
620 /// \return The new object on success, or null on failure.
621 static IntrusiveRefCntPtr<DiagnosticsEngine>
622 createDiagnostics(DiagnosticOptions *Opts,
623 DiagnosticConsumer *Client = nullptr,
624 bool ShouldOwnClient = true,
625 const CodeGenOptions *CodeGenOpts = nullptr);
627 /// Create the file manager and replace any existing one with it.
629 /// \return The new file manager on success, or null on failure.
631 createFileManager(IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr);
633 /// Create the source manager and replace any existing one with it.
634 void createSourceManager(FileManager &FileMgr);
636 /// Create the preprocessor, using the invocation, file, and source managers,
637 /// and replace any existing one with it.
638 void createPreprocessor(TranslationUnitKind TUKind);
640 std::string getSpecificModuleCachePath();
642 /// Create the AST context.
643 void createASTContext();
645 /// Create an external AST source to read a PCH file and attach it to the AST
647 void createPCHExternalASTSource(StringRef Path, bool DisablePCHValidation,
648 bool AllowPCHWithCompilerErrors,
649 void *DeserializationListener,
650 bool OwnDeserializationListener);
652 /// Create an external AST source to read a PCH file.
654 /// \return - The new object on success, or null on failure.
655 static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource(
656 StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
657 bool AllowPCHWithCompilerErrors, Preprocessor &PP,
658 InMemoryModuleCache &ModuleCache, ASTContext &Context,
659 const PCHContainerReader &PCHContainerRdr,
660 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
661 ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors,
662 void *DeserializationListener, bool OwnDeserializationListener,
663 bool Preamble, bool UseGlobalModuleIndex);
665 /// Create a code completion consumer using the invocation; note that this
666 /// will cause the source manager to truncate the input source file at the
667 /// completion point.
668 void createCodeCompletionConsumer();
670 /// Create a code completion consumer to print code completion results, at
671 /// \p Filename, \p Line, and \p Column, to the given output stream \p OS.
672 static CodeCompleteConsumer *createCodeCompletionConsumer(
673 Preprocessor &PP, StringRef Filename, unsigned Line, unsigned Column,
674 const CodeCompleteOptions &Opts, raw_ostream &OS);
676 /// Create the Sema object to be used for parsing.
677 void createSema(TranslationUnitKind TUKind,
678 CodeCompleteConsumer *CompletionConsumer);
680 /// Create the frontend timer and replace any existing one with it.
681 void createFrontendTimer();
683 /// Create the default output file (from the invocation's options) and add it
684 /// to the list of tracked output files.
686 /// The files created by this function always use temporary files to write to
687 /// their result (that is, the data is written to a temporary file which will
688 /// atomically replace the target output on success).
690 /// \return - Null on error.
691 std::unique_ptr<raw_pwrite_stream>
692 createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "",
693 StringRef Extension = "");
695 /// Create a new output file and add it to the list of tracked output files,
696 /// optionally deriving the output path name.
698 /// \return - Null on error.
699 std::unique_ptr<raw_pwrite_stream>
700 createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal,
701 StringRef BaseInput, StringRef Extension, bool UseTemporary,
702 bool CreateMissingDirectories = false);
704 /// Create a new output file, optionally deriving the output path name.
706 /// If \p OutputPath is empty, then createOutputFile will derive an output
707 /// path location as \p BaseInput, with any suffix removed, and \p Extension
708 /// appended. If \p OutputPath is not stdout and \p UseTemporary
709 /// is true, createOutputFile will create a new temporary file that must be
710 /// renamed to \p OutputPath in the end.
712 /// \param OutputPath - If given, the path to the output file.
713 /// \param Error [out] - On failure, the error.
714 /// \param BaseInput - If \p OutputPath is empty, the input path name to use
715 /// for deriving the output path.
716 /// \param Extension - The extension to use for derived output names.
717 /// \param Binary - The mode to open the file in.
718 /// \param RemoveFileOnSignal - Whether the file should be registered with
719 /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for
720 /// multithreaded use, as the underlying signal mechanism is not reentrant
721 /// \param UseTemporary - Create a new temporary file that must be renamed to
722 /// OutputPath in the end.
723 /// \param CreateMissingDirectories - When \p UseTemporary is true, create
724 /// missing directories in the output path.
725 /// \param ResultPathName [out] - If given, the result path name will be
726 /// stored here on success.
727 /// \param TempPathName [out] - If given, the temporary file path name
728 /// will be stored here on success.
729 std::unique_ptr<raw_pwrite_stream>
730 createOutputFile(StringRef OutputPath, std::error_code &Error, bool Binary,
731 bool RemoveFileOnSignal, StringRef BaseInput,
732 StringRef Extension, bool UseTemporary,
733 bool CreateMissingDirectories, std::string *ResultPathName,
734 std::string *TempPathName);
736 std::unique_ptr<raw_pwrite_stream> createNullOutputFile();
739 /// @name Initialization Utility Methods
742 /// InitializeSourceManager - Initialize the source manager to set InputFile
743 /// as the main file.
745 /// \return True on success.
746 bool InitializeSourceManager(const FrontendInputFile &Input);
748 /// InitializeSourceManager - Initialize the source manager to set InputFile
749 /// as the main file.
751 /// \return True on success.
752 static bool InitializeSourceManager(const FrontendInputFile &Input,
753 DiagnosticsEngine &Diags,
754 FileManager &FileMgr,
755 SourceManager &SourceMgr,
757 DependencyOutputOptions &DepOpts,
758 const FrontendOptions &Opts);
762 void setOutputStream(std::unique_ptr<llvm::raw_pwrite_stream> OutStream) {
763 OutputStream = std::move(OutStream);
766 std::unique_ptr<llvm::raw_pwrite_stream> takeOutputStream() {
767 return std::move(OutputStream);
770 // Create module manager.
771 void createModuleManager();
773 bool loadModuleFile(StringRef FileName);
775 ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path,
776 Module::NameVisibilityKind Visibility,
777 bool IsInclusionDirective) override;
779 void loadModuleFromSource(SourceLocation ImportLoc, StringRef ModuleName,
780 StringRef Source) override;
782 void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility,
783 SourceLocation ImportLoc) override;
785 bool hadModuleLoaderFatalFailure() const {
786 return ModuleLoader::HadFatalFailure;
789 GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override;
791 bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override;
793 void addDependencyCollector(std::shared_ptr<DependencyCollector> Listener) {
794 DependencyCollectors.push_back(std::move(Listener));
797 void setExternalSemaSource(IntrusiveRefCntPtr<ExternalSemaSource> ESS);
799 InMemoryModuleCache &getModuleCache() const { return *ModuleCache; }
802 } // end namespace clang