diff options
Diffstat (limited to 'include/clang/Frontend/CompilerInstance.h')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index 0f49b34..8d0d939 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -121,6 +121,10 @@ class CompilerInstance : public ModuleLoader { /// \brief Module names that have an override for the target file. llvm::StringMap<std::string> ModuleFileOverrides; + /// \brief Module files that we've explicitly loaded via \ref loadModuleFile, + /// and their dependencies. + llvm::StringSet<> ExplicitlyLoadedModuleFiles; + /// \brief The location of the module-import keyword for the last module /// import. SourceLocation LastModuleImportLoc; @@ -147,21 +151,29 @@ class CompilerInstance : public ModuleLoader { struct OutputFile { std::string Filename; std::string TempFilename; - raw_ostream *OS; + std::unique_ptr<raw_ostream> OS; OutputFile(const std::string &filename, const std::string &tempFilename, - raw_ostream *os) - : Filename(filename), TempFilename(tempFilename), OS(os) { } + std::unique_ptr<raw_ostream> OS) + : Filename(filename), TempFilename(tempFilename), OS(std::move(OS)) {} + OutputFile(OutputFile &&O) + : Filename(std::move(O.Filename)), + TempFilename(std::move(O.TempFilename)), OS(std::move(O.OS)) {} }; + /// If the output doesn't support seeking (terminal, pipe). we switch + /// the stream to a buffer_ostream. These are the buffer and the original + /// stream. + std::unique_ptr<llvm::raw_fd_ostream> NonSeekStream; + /// The list of active output files. std::list<OutputFile> OutputFiles; - CompilerInstance(const CompilerInstance &) LLVM_DELETED_FUNCTION; - void operator=(const CompilerInstance &) LLVM_DELETED_FUNCTION; + CompilerInstance(const CompilerInstance &) = delete; + void operator=(const CompilerInstance &) = delete; public: explicit CompilerInstance(bool BuildingModule = false); - ~CompilerInstance(); + ~CompilerInstance() override; /// @name High-Level Operations /// { @@ -514,7 +526,7 @@ public: /// addOutputFile - Add an output file onto the list of tracked output files. /// /// \param OutFile - The output file info. - void addOutputFile(const OutputFile &OutFile); + void addOutputFile(OutputFile &&OutFile); /// clearOutputFiles - Clear the output file list, destroying the contained /// output streams. @@ -575,6 +587,8 @@ public: /// and replace any existing one with it. void createPreprocessor(TranslationUnitKind TUKind); + std::string getSpecificModuleCachePath(); + /// Create the AST context. void createASTContext(); @@ -588,7 +602,7 @@ public: /// Create an external AST source to read a PCH file. /// /// \return - The new object on success, or null on failure. - static ExternalASTSource *createPCHExternalASTSource( + static IntrusiveRefCntPtr<ASTReader> createPCHExternalASTSource( StringRef Path, const std::string &Sysroot, bool DisablePCHValidation, bool AllowPCHWithCompilerErrors, Preprocessor &PP, ASTContext &Context, void *DeserializationListener, bool OwnDeserializationListener, @@ -622,21 +636,19 @@ public: /// atomically replace the target output on success). /// /// \return - Null on error. - llvm::raw_fd_ostream * - createDefaultOutputFile(bool Binary = true, StringRef BaseInput = "", - StringRef Extension = ""); + raw_pwrite_stream *createDefaultOutputFile(bool Binary = true, + StringRef BaseInput = "", + StringRef Extension = ""); /// Create a new output file and add it to the list of tracked output files, /// optionally deriving the output path name. /// /// \return - Null on error. - llvm::raw_fd_ostream * - createOutputFile(StringRef OutputPath, - bool Binary, bool RemoveFileOnSignal, - StringRef BaseInput, - StringRef Extension, - bool UseTemporary, - bool CreateMissingDirectories = false); + raw_pwrite_stream *createOutputFile(StringRef OutputPath, bool Binary, + bool RemoveFileOnSignal, + StringRef BaseInput, StringRef Extension, + bool UseTemporary, + bool CreateMissingDirectories = false); /// Create a new output file, optionally deriving the output path name. /// @@ -663,7 +675,7 @@ public: /// stored here on success. /// \param TempPathName [out] - If given, the temporary file path name /// will be stored here on success. - static llvm::raw_fd_ostream * + std::unique_ptr<raw_pwrite_stream> createOutputFile(StringRef OutputPath, std::error_code &Error, bool Binary, bool RemoveFileOnSignal, StringRef BaseInput, StringRef Extension, bool UseTemporary, @@ -704,7 +716,7 @@ public: bool IsInclusionDirective) override; void makeModuleVisible(Module *Mod, Module::NameVisibilityKind Visibility, - SourceLocation ImportLoc, bool Complain) override; + SourceLocation ImportLoc) override; bool hadModuleLoaderFatalFailure() const { return ModuleLoader::HadFatalFailure; |