1 //===-- CompilerInstance.h - Clang Compiler Instance ------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
11 #define LLVM_CLANG_FRONTEND_COMPILERINSTANCE_H_
13 #include "clang/AST/ASTConsumer.h"
14 #include "clang/Basic/Diagnostic.h"
15 #include "clang/Basic/SourceManager.h"
16 #include "clang/Frontend/CompilerInvocation.h"
17 #include "clang/Frontend/PCHContainerOperations.h"
18 #include "clang/Frontend/Utils.h"
19 #include "clang/Lex/HeaderSearchOptions.h"
20 #include "clang/Lex/ModuleLoader.h"
21 #include "llvm/ADT/ArrayRef.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/ADT/IntrusiveRefCntPtr.h"
24 #include "llvm/ADT/StringRef.h"
40 class CodeCompleteConsumer;
41 class DiagnosticsEngine;
42 class DiagnosticConsumer;
43 class ExternalASTSource;
47 class MemoryBufferCache;
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;
85 /// The virtual file system.
86 IntrusiveRefCntPtr<vfs::FileSystem> VirtualFileSystem;
89 IntrusiveRefCntPtr<FileManager> FileMgr;
91 /// The source manager.
92 IntrusiveRefCntPtr<SourceManager> SourceMgr;
94 /// The cache of PCM files.
95 IntrusiveRefCntPtr<MemoryBufferCache> PCMCache;
98 std::shared_ptr<Preprocessor> PP;
101 IntrusiveRefCntPtr<ASTContext> Context;
103 /// An optional sema source that will be attached to sema.
104 IntrusiveRefCntPtr<ExternalSemaSource> ExternalSemaSrc;
106 /// The AST consumer.
107 std::unique_ptr<ASTConsumer> Consumer;
109 /// The code completion consumer.
110 std::unique_ptr<CodeCompleteConsumer> CompletionConsumer;
112 /// \brief The semantic analysis object.
113 std::unique_ptr<Sema> TheSema;
115 /// \brief The frontend timer group.
116 std::unique_ptr<llvm::TimerGroup> FrontendTimerGroup;
118 /// \brief The frontend timer.
119 std::unique_ptr<llvm::Timer> FrontendTimer;
121 /// \brief The ASTReader, if one exists.
122 IntrusiveRefCntPtr<ASTReader> ModuleManager;
124 /// \brief The module dependency collector for crashdumps
125 std::shared_ptr<ModuleDependencyCollector> ModuleDepCollector;
127 /// \brief The module provider.
128 std::shared_ptr<PCHContainerOperations> ThePCHContainerOperations;
130 /// \brief The dependency file generator.
131 std::unique_ptr<DependencyFileGenerator> TheDependencyFileGenerator;
133 std::vector<std::shared_ptr<DependencyCollector>> DependencyCollectors;
135 /// \brief The set of top-level modules that has already been loaded,
136 /// along with the module map
137 llvm::DenseMap<const IdentifierInfo *, Module *> KnownModules;
139 /// \brief The location of the module-import keyword for the last module
141 SourceLocation LastModuleImportLoc;
143 /// \brief The result of the last module import.
145 ModuleLoadResult LastModuleImportResult;
147 /// \brief Whether we should (re)build the global module index once we
148 /// have finished with this translation unit.
149 bool BuildGlobalModuleIndex = false;
151 /// \brief We have a full global module index, with all modules.
152 bool HaveFullGlobalModuleIndex = false;
154 /// \brief One or more modules failed to build.
155 bool ModuleBuildFailed = false;
157 /// \brief Holds information about the output file.
159 /// If TempFilename is not empty we must rename it to Filename at the end.
160 /// TempFilename may be empty and Filename non-empty if creating the temporary
163 std::string Filename;
164 std::string TempFilename;
166 OutputFile(std::string filename, std::string tempFilename)
167 : Filename(std::move(filename)), TempFilename(std::move(tempFilename)) {
171 /// If the output doesn't support seeking (terminal, pipe). we switch
172 /// the stream to a buffer_ostream. These are the buffer and the original
174 std::unique_ptr<llvm::raw_fd_ostream> NonSeekStream;
176 /// The list of active output files.
177 std::list<OutputFile> OutputFiles;
179 CompilerInstance(const CompilerInstance &) = delete;
180 void operator=(const CompilerInstance &) = delete;
182 explicit CompilerInstance(
183 std::shared_ptr<PCHContainerOperations> PCHContainerOps =
184 std::make_shared<PCHContainerOperations>(),
185 MemoryBufferCache *SharedPCMCache = nullptr);
186 ~CompilerInstance() override;
188 /// @name High-Level Operations
191 /// ExecuteAction - Execute the provided action against the compiler's
192 /// CompilerInvocation object.
194 /// This function makes the following assumptions:
196 /// - The invocation options should be initialized. This function does not
197 /// handle the '-help' or '-version' options, clients should handle those
200 /// - The diagnostics engine should have already been created by the client.
202 /// - No other CompilerInstance state should have been initialized (this is
203 /// an unchecked error).
205 /// - Clients should have initialized any LLVM target features that may be
208 /// - Clients should eventually call llvm_shutdown() upon the completion of
209 /// this routine to ensure that any managed objects are properly destroyed.
211 /// Note that this routine may write output to 'stderr'.
213 /// \param Act - The action to execute.
214 /// \return - True on success.
216 // FIXME: This function should take the stream to write any debugging /
217 // verbose output to as an argument.
219 // FIXME: Eliminate the llvm_shutdown requirement, that should either be part
220 // of the context or else not CompilerInstance specific.
221 bool ExecuteAction(FrontendAction &Act);
224 /// @name Compiler Invocation and Options
227 bool hasInvocation() const { return Invocation != nullptr; }
229 CompilerInvocation &getInvocation() {
230 assert(Invocation && "Compiler instance has no invocation!");
234 /// setInvocation - Replace the current invocation.
235 void setInvocation(std::shared_ptr<CompilerInvocation> Value);
237 /// \brief Indicates whether we should (re)build the global module index.
238 bool shouldBuildGlobalModuleIndex() const;
240 /// \brief Set the flag indicating whether we should (re)build the global
242 void setBuildGlobalModuleIndex(bool Build) {
243 BuildGlobalModuleIndex = Build;
247 /// @name Forwarding Methods
250 AnalyzerOptionsRef getAnalyzerOpts() {
251 return Invocation->getAnalyzerOpts();
254 CodeGenOptions &getCodeGenOpts() {
255 return Invocation->getCodeGenOpts();
257 const CodeGenOptions &getCodeGenOpts() const {
258 return Invocation->getCodeGenOpts();
261 DependencyOutputOptions &getDependencyOutputOpts() {
262 return Invocation->getDependencyOutputOpts();
264 const DependencyOutputOptions &getDependencyOutputOpts() const {
265 return Invocation->getDependencyOutputOpts();
268 DiagnosticOptions &getDiagnosticOpts() {
269 return Invocation->getDiagnosticOpts();
271 const DiagnosticOptions &getDiagnosticOpts() const {
272 return Invocation->getDiagnosticOpts();
275 FileSystemOptions &getFileSystemOpts() {
276 return Invocation->getFileSystemOpts();
278 const FileSystemOptions &getFileSystemOpts() const {
279 return Invocation->getFileSystemOpts();
282 FrontendOptions &getFrontendOpts() {
283 return Invocation->getFrontendOpts();
285 const FrontendOptions &getFrontendOpts() const {
286 return Invocation->getFrontendOpts();
289 HeaderSearchOptions &getHeaderSearchOpts() {
290 return Invocation->getHeaderSearchOpts();
292 const HeaderSearchOptions &getHeaderSearchOpts() const {
293 return Invocation->getHeaderSearchOpts();
295 std::shared_ptr<HeaderSearchOptions> getHeaderSearchOptsPtr() const {
296 return Invocation->getHeaderSearchOptsPtr();
299 LangOptions &getLangOpts() {
300 return *Invocation->getLangOpts();
302 const LangOptions &getLangOpts() const {
303 return *Invocation->getLangOpts();
306 PreprocessorOptions &getPreprocessorOpts() {
307 return Invocation->getPreprocessorOpts();
309 const PreprocessorOptions &getPreprocessorOpts() const {
310 return Invocation->getPreprocessorOpts();
313 PreprocessorOutputOptions &getPreprocessorOutputOpts() {
314 return Invocation->getPreprocessorOutputOpts();
316 const PreprocessorOutputOptions &getPreprocessorOutputOpts() const {
317 return Invocation->getPreprocessorOutputOpts();
320 TargetOptions &getTargetOpts() {
321 return Invocation->getTargetOpts();
323 const TargetOptions &getTargetOpts() const {
324 return Invocation->getTargetOpts();
328 /// @name Diagnostics Engine
331 bool hasDiagnostics() const { return Diagnostics != nullptr; }
333 /// Get the current diagnostics engine.
334 DiagnosticsEngine &getDiagnostics() const {
335 assert(Diagnostics && "Compiler instance has no diagnostics!");
339 /// setDiagnostics - Replace the current diagnostics engine.
340 void setDiagnostics(DiagnosticsEngine *Value);
342 DiagnosticConsumer &getDiagnosticClient() const {
343 assert(Diagnostics && Diagnostics->getClient() &&
344 "Compiler instance has no diagnostic client!");
345 return *Diagnostics->getClient();
349 /// @name Target Info
352 bool hasTarget() const { return Target != nullptr; }
354 TargetInfo &getTarget() const {
355 assert(Target && "Compiler instance has no target!");
359 /// Replace the current Target.
360 void setTarget(TargetInfo *Value);
363 /// @name AuxTarget Info
366 TargetInfo *getAuxTarget() const { return AuxTarget.get(); }
368 /// Replace the current AuxTarget.
369 void setAuxTarget(TargetInfo *Value);
372 /// @name Virtual File System
375 bool hasVirtualFileSystem() const { return VirtualFileSystem != nullptr; }
377 vfs::FileSystem &getVirtualFileSystem() const {
378 assert(hasVirtualFileSystem() &&
379 "Compiler instance has no virtual file system");
380 return *VirtualFileSystem;
383 /// \brief Replace the current virtual file system.
385 /// \note Most clients should use setFileManager, which will implicitly reset
386 /// the virtual file system to the one contained in the file manager.
387 void setVirtualFileSystem(IntrusiveRefCntPtr<vfs::FileSystem> FS) {
388 VirtualFileSystem = std::move(FS);
392 /// @name File Manager
395 bool hasFileManager() const { return FileMgr != nullptr; }
397 /// Return the current file manager to the caller.
398 FileManager &getFileManager() const {
399 assert(FileMgr && "Compiler instance has no file manager!");
403 void resetAndLeakFileManager() {
404 BuryPointer(FileMgr.get());
405 FileMgr.resetWithoutRelease();
408 /// \brief Replace the current file manager and virtual file system.
409 void setFileManager(FileManager *Value);
412 /// @name Source Manager
415 bool hasSourceManager() const { return SourceMgr != nullptr; }
417 /// Return the current source manager.
418 SourceManager &getSourceManager() const {
419 assert(SourceMgr && "Compiler instance has no source manager!");
423 void resetAndLeakSourceManager() {
424 BuryPointer(SourceMgr.get());
425 SourceMgr.resetWithoutRelease();
428 /// setSourceManager - Replace the current source manager.
429 void setSourceManager(SourceManager *Value);
432 /// @name Preprocessor
435 bool hasPreprocessor() const { return PP != nullptr; }
437 /// Return the current preprocessor.
438 Preprocessor &getPreprocessor() const {
439 assert(PP && "Compiler instance has no preprocessor!");
443 std::shared_ptr<Preprocessor> getPreprocessorPtr() { return PP; }
445 void resetAndLeakPreprocessor() {
446 BuryPointer(new std::shared_ptr<Preprocessor>(PP));
449 /// Replace the current preprocessor.
450 void setPreprocessor(std::shared_ptr<Preprocessor> Value);
456 bool hasASTContext() const { return Context != nullptr; }
458 ASTContext &getASTContext() const {
459 assert(Context && "Compiler instance has no AST context!");
463 void resetAndLeakASTContext() {
464 BuryPointer(Context.get());
465 Context.resetWithoutRelease();
468 /// setASTContext - Replace the current AST context.
469 void setASTContext(ASTContext *Value);
471 /// \brief Replace the current Sema; the compiler instance takes ownership
473 void setSema(Sema *S);
476 /// @name ASTConsumer
479 bool hasASTConsumer() const { return (bool)Consumer; }
481 ASTConsumer &getASTConsumer() const {
482 assert(Consumer && "Compiler instance has no AST consumer!");
486 /// takeASTConsumer - Remove the current AST consumer and give ownership to
488 std::unique_ptr<ASTConsumer> takeASTConsumer() { return std::move(Consumer); }
490 /// setASTConsumer - Replace the current AST consumer; the compiler instance
491 /// takes ownership of \p Value.
492 void setASTConsumer(std::unique_ptr<ASTConsumer> Value);
495 /// @name Semantic analysis
497 bool hasSema() const { return (bool)TheSema; }
499 Sema &getSema() const {
500 assert(TheSema && "Compiler instance has no Sema object!");
504 std::unique_ptr<Sema> takeSema();
505 void resetAndLeakSema();
508 /// @name Module Management
511 IntrusiveRefCntPtr<ASTReader> getModuleManager() const;
512 void setModuleManager(IntrusiveRefCntPtr<ASTReader> Reader);
514 std::shared_ptr<ModuleDependencyCollector> getModuleDepCollector() const;
515 void setModuleDepCollector(
516 std::shared_ptr<ModuleDependencyCollector> Collector);
518 std::shared_ptr<PCHContainerOperations> getPCHContainerOperations() const {
519 return ThePCHContainerOperations;
522 /// Return the appropriate PCHContainerWriter depending on the
523 /// current CodeGenOptions.
524 const PCHContainerWriter &getPCHContainerWriter() const {
525 assert(Invocation && "cannot determine module format without invocation");
526 StringRef Format = getHeaderSearchOpts().ModuleFormat;
527 auto *Writer = ThePCHContainerOperations->getWriterOrNull(Format);
530 Diagnostics->Report(diag::err_module_format_unhandled) << Format;
531 llvm::report_fatal_error("unknown module format");
536 /// Return the appropriate PCHContainerReader depending on the
537 /// current CodeGenOptions.
538 const PCHContainerReader &getPCHContainerReader() const {
539 assert(Invocation && "cannot determine module format without invocation");
540 StringRef Format = getHeaderSearchOpts().ModuleFormat;
541 auto *Reader = ThePCHContainerOperations->getReaderOrNull(Format);
544 Diagnostics->Report(diag::err_module_format_unhandled) << Format;
545 llvm::report_fatal_error("unknown module format");
551 /// @name Code Completion
554 bool hasCodeCompletionConsumer() const { return (bool)CompletionConsumer; }
556 CodeCompleteConsumer &getCodeCompletionConsumer() const {
557 assert(CompletionConsumer &&
558 "Compiler instance has no code completion consumer!");
559 return *CompletionConsumer;
562 /// setCodeCompletionConsumer - Replace the current code completion consumer;
563 /// the compiler instance takes ownership of \p Value.
564 void setCodeCompletionConsumer(CodeCompleteConsumer *Value);
567 /// @name Frontend timer
570 bool hasFrontendTimer() const { return (bool)FrontendTimer; }
572 llvm::Timer &getFrontendTimer() const {
573 assert(FrontendTimer && "Compiler instance has no frontend timer!");
574 return *FrontendTimer;
578 /// @name Output Files
581 /// addOutputFile - Add an output file onto the list of tracked output files.
583 /// \param OutFile - The output file info.
584 void addOutputFile(OutputFile &&OutFile);
586 /// clearOutputFiles - Clear the output file list. The underlying output
587 /// streams must have been closed beforehand.
589 /// \param EraseFiles - If true, attempt to erase the files from disk.
590 void clearOutputFiles(bool EraseFiles);
593 /// @name Construction Utility Methods
596 /// Create the diagnostics engine using the invocation's diagnostic options
597 /// and replace any existing one with it.
599 /// Note that this routine also replaces the diagnostic client,
600 /// allocating one if one is not provided.
602 /// \param Client If non-NULL, a diagnostic client that will be
603 /// attached to (and, then, owned by) the DiagnosticsEngine inside this AST
606 /// \param ShouldOwnClient If Client is non-NULL, specifies whether
607 /// the diagnostic object should take ownership of the client.
608 void createDiagnostics(DiagnosticConsumer *Client = nullptr,
609 bool ShouldOwnClient = true);
611 /// Create a DiagnosticsEngine object with a the TextDiagnosticPrinter.
613 /// If no diagnostic client is provided, this creates a
614 /// DiagnosticConsumer that is owned by the returned diagnostic
615 /// object, if using directly the caller is responsible for
616 /// releasing the returned DiagnosticsEngine's client eventually.
618 /// \param Opts - The diagnostic options; note that the created text
619 /// diagnostic object contains a reference to these options.
621 /// \param Client If non-NULL, a diagnostic client that will be
622 /// attached to (and, then, owned by) the returned DiagnosticsEngine
625 /// \param CodeGenOpts If non-NULL, the code gen options in use, which may be
626 /// used by some diagnostics printers (for logging purposes only).
628 /// \return The new object on success, or null on failure.
629 static IntrusiveRefCntPtr<DiagnosticsEngine>
630 createDiagnostics(DiagnosticOptions *Opts,
631 DiagnosticConsumer *Client = nullptr,
632 bool ShouldOwnClient = true,
633 const CodeGenOptions *CodeGenOpts = nullptr);
635 /// Create the file manager and replace any existing one with it.
636 void createFileManager();
638 /// Create the source manager and replace any existing one with it.
639 void createSourceManager(FileManager &FileMgr);
641 /// Create the preprocessor, using the invocation, file, and source managers,
642 /// and replace any existing one with it.
643 void createPreprocessor(TranslationUnitKind TUKind);
645 std::string getSpecificModuleCachePath();
647 /// Create the AST context.
648 void createASTContext();
650 /// Create an external AST source to read a PCH file and attach it to the AST
652 void createPCHExternalASTSource(StringRef Path, bool DisablePCHValidation,
653 bool AllowPCHWithCompilerErrors,
654 void *DeserializationListener,
655 bool OwnDeserializationListener);
657 /// Create an external AST source to read a PCH file.
659 /// \return - The new object on success, or null on failure.
660 static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource(
661 StringRef Path, StringRef Sysroot, bool DisablePCHValidation,
662 bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context,
663 const PCHContainerReader &PCHContainerRdr,
664 ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
665 DependencyFileGenerator *DependencyFile,
666 ArrayRef<std::shared_ptr<DependencyCollector>> DependencyCollectors,
667 void *DeserializationListener, bool OwnDeserializationListener,
668 bool Preamble, bool UseGlobalModuleIndex);
670 /// Create a code completion consumer using the invocation; note that this
671 /// will cause the source manager to truncate the input source file at the
672 /// completion point.
673 void createCodeCompletionConsumer();
675 /// Create a code completion consumer to print code completion results, at
676 /// \p Filename, \p Line, and \p Column, to the given output stream \p OS.
677 static CodeCompleteConsumer *createCodeCompletionConsumer(
678 Preprocessor &PP, StringRef Filename, unsigned Line, unsigned Column,
679 const CodeCompleteOptions &Opts, raw_ostream &OS);
681 /// \brief Create the Sema object to be used for parsing.
682 void createSema(TranslationUnitKind TUKind,
683 CodeCompleteConsumer *CompletionConsumer);
685 /// Create the frontend timer and replace any existing one with it.
686 void createFrontendTimer();
688 /// Create the default output file (from the invocation's options) and add it
689 /// to the list of tracked output files.
691 /// The files created by this function always use temporary files to write to
692 /// their result (that is, the data is written to a temporary file which will
693 /// atomically replace the target output on success).
695 /// \return - Null on error.
696 std::unique_ptr<raw_pwrite_stream>
697 createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "",
698 StringRef Extension = "");
700 /// Create a new output file and add it to the list of tracked output files,
701 /// optionally deriving the output path name.
703 /// \return - Null on error.
704 std::unique_ptr<raw_pwrite_stream>
705 createOutputFile(StringRef OutputPath, bool Binary, bool RemoveFileOnSignal,
706 StringRef BaseInput, StringRef Extension, bool UseTemporary,
707 bool CreateMissingDirectories = false);
709 /// Create a new output file, optionally deriving the output path name.
711 /// If \p OutputPath is empty, then createOutputFile will derive an output
712 /// path location as \p BaseInput, with any suffix removed, and \p Extension
713 /// appended. If \p OutputPath is not stdout and \p UseTemporary
714 /// is true, createOutputFile will create a new temporary file that must be
715 /// renamed to \p OutputPath in the end.
717 /// \param OutputPath - If given, the path to the output file.
718 /// \param Error [out] - On failure, the error.
719 /// \param BaseInput - If \p OutputPath is empty, the input path name to use
720 /// for deriving the output path.
721 /// \param Extension - The extension to use for derived output names.
722 /// \param Binary - The mode to open the file in.
723 /// \param RemoveFileOnSignal - Whether the file should be registered with
724 /// llvm::sys::RemoveFileOnSignal. Note that this is not safe for
725 /// multithreaded use, as the underlying signal mechanism is not reentrant
726 /// \param UseTemporary - Create a new temporary file that must be renamed to
727 /// OutputPath in the end.
728 /// \param CreateMissingDirectories - When \p UseTemporary is true, create
729 /// missing directories in the output path.
730 /// \param ResultPathName [out] - If given, the result path name will be
731 /// stored here on success.
732 /// \param TempPathName [out] - If given, the temporary file path name
733 /// will be stored here on success.
734 std::unique_ptr<raw_pwrite_stream>
735 createOutputFile(StringRef OutputPath, std::error_code &Error, bool Binary,
736 bool RemoveFileOnSignal, StringRef BaseInput,
737 StringRef Extension, bool UseTemporary,
738 bool CreateMissingDirectories, std::string *ResultPathName,
739 std::string *TempPathName);
741 std::unique_ptr<raw_pwrite_stream> createNullOutputFile();
744 /// @name Initialization Utility Methods
747 /// InitializeSourceManager - Initialize the source manager to set InputFile
748 /// as the main file.
750 /// \return True on success.
751 bool InitializeSourceManager(const FrontendInputFile &Input);
753 /// InitializeSourceManager - Initialize the source manager to set InputFile
754 /// as the main file.
756 /// \return True on success.
757 static bool InitializeSourceManager(const FrontendInputFile &Input,
758 DiagnosticsEngine &Diags,
759 FileManager &FileMgr,
760 SourceManager &SourceMgr,
762 DependencyOutputOptions &DepOpts,
763 const FrontendOptions &Opts);
767 // Create module manager.
768 void createModuleManager();
770 bool loadModuleFile(StringRef FileName);
772 ModuleLoadResult loadModule(SourceLocation ImportLoc, ModuleIdPath Path,
773 Module::NameVisibilityKind Visibility,
774 bool IsInclusionDirective) override;
776 void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility,
777 SourceLocation ImportLoc) override;
779 bool hadModuleLoaderFatalFailure() const {
780 return ModuleLoader::HadFatalFailure;
783 GlobalModuleIndex *loadGlobalModuleIndex(SourceLocation TriggerLoc) override;
785 bool lookupMissingImports(StringRef Name, SourceLocation TriggerLoc) override;
787 void addDependencyCollector(std::shared_ptr<DependencyCollector> Listener) {
788 DependencyCollectors.push_back(std::move(Listener));
791 void setExternalSemaSource(IntrusiveRefCntPtr<ExternalSemaSource> ESS);
793 MemoryBufferCache &getPCMCache() const { return *PCMCache; }
796 } // end namespace clang