diff options
Diffstat (limited to 'clang/include/clang')
-rw-r--r-- | clang/include/clang/CodeGen/BackendUtil.h | 3 | ||||
-rw-r--r-- | clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h | 10 | ||||
-rw-r--r-- | clang/include/clang/Frontend/ASTConsumers.h | 2 | ||||
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 34 | ||||
-rw-r--r-- | clang/include/clang/Frontend/FrontendActions.h | 9 | ||||
-rw-r--r-- | clang/include/clang/Frontend/PCHContainerOperations.h | 20 | ||||
-rw-r--r-- | clang/include/clang/Rewrite/Frontend/ASTConsumers.h | 7 |
7 files changed, 43 insertions, 42 deletions
diff --git a/clang/include/clang/CodeGen/BackendUtil.h b/clang/include/clang/CodeGen/BackendUtil.h index f88057bfe62..01721d32209 100644 --- a/clang/include/clang/CodeGen/BackendUtil.h +++ b/clang/include/clang/CodeGen/BackendUtil.h @@ -37,7 +37,8 @@ namespace clang { void EmitBackendOutput(DiagnosticsEngine &Diags, const CodeGenOptions &CGOpts, const TargetOptions &TOpts, const LangOptions &LOpts, const llvm::DataLayout &TDesc, llvm::Module *M, - BackendAction Action, raw_pwrite_stream *OS); + BackendAction Action, + std::unique_ptr<raw_pwrite_stream> OS); void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts, llvm::MemoryBufferRef Buf); diff --git a/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h b/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h index 15132acfc24..6437f4f9b4f 100644 --- a/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h +++ b/clang/include/clang/CodeGen/ObjectFilePCHContainerOperations.h @@ -22,10 +22,12 @@ class ObjectFilePCHContainerWriter : public PCHContainerWriter { /// Return an ASTConsumer that can be chained with a /// PCHGenerator that produces a wrapper file format /// that also contains full debug info for the module. - std::unique_ptr<ASTConsumer> CreatePCHContainerGenerator( - CompilerInstance &CI, const std::string &MainFileName, - const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, - std::shared_ptr<PCHBuffer> Buffer) const override; + std::unique_ptr<ASTConsumer> + CreatePCHContainerGenerator(CompilerInstance &CI, + const std::string &MainFileName, + const std::string &OutputFileName, + std::unique_ptr<llvm::raw_pwrite_stream> OS, + std::shared_ptr<PCHBuffer> Buffer) const override; }; /// A PCHContainerReader implementation that uses LLVM to diff --git a/clang/include/clang/Frontend/ASTConsumers.h b/clang/include/clang/Frontend/ASTConsumers.h index 757fcae988f..b76bfcbe466 100644 --- a/clang/include/clang/Frontend/ASTConsumers.h +++ b/clang/include/clang/Frontend/ASTConsumers.h @@ -31,7 +31,7 @@ class TargetOptions; // original C code. The output is intended to be in a format such that // clang could re-parse the output back into the same AST, but the // implementation is still incomplete. -std::unique_ptr<ASTConsumer> CreateASTPrinter(raw_ostream *OS, +std::unique_ptr<ASTConsumer> CreateASTPrinter(std::unique_ptr<raw_ostream> OS, StringRef FilterString); // AST dumper: dumps the raw AST in human-readable form to stderr; this is diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index cf66088aae2..1228cf4d5fc 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -155,15 +155,10 @@ class CompilerInstance : public ModuleLoader { struct OutputFile { std::string Filename; std::string TempFilename; - std::unique_ptr<raw_ostream> OS; - - OutputFile(std::string filename, std::string tempFilename, - std::unique_ptr<raw_ostream> OS) - : Filename(std::move(filename)), TempFilename(std::move(tempFilename)), - OS(std::move(OS)) {} - OutputFile(OutputFile &&O) - : Filename(std::move(O.Filename)), - TempFilename(std::move(O.TempFilename)), OS(std::move(O.OS)) {} + + OutputFile(std::string filename, std::string tempFilename) + : Filename(std::move(filename)), TempFilename(std::move(tempFilename)) { + } }; /// If the output doesn't support seeking (terminal, pipe). we switch @@ -577,8 +572,8 @@ public: /// \param OutFile - The output file info. void addOutputFile(OutputFile &&OutFile); - /// clearOutputFiles - Clear the output file list, destroying the contained - /// output streams. + /// clearOutputFiles - Clear the output file list. The underlying output + /// streams must have been closed beforehand. /// /// \param EraseFiles - If true, attempt to erase the files from disk. void clearOutputFiles(bool EraseFiles); @@ -685,19 +680,18 @@ public: /// atomically replace the target output on success). /// /// \return - Null on error. - raw_pwrite_stream *createDefaultOutputFile(bool Binary = true, - StringRef BaseInput = "", - StringRef Extension = ""); + std::unique_ptr<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. - raw_pwrite_stream *createOutputFile(StringRef OutputPath, bool Binary, - bool RemoveFileOnSignal, - StringRef BaseInput, StringRef Extension, - bool UseTemporary, - bool CreateMissingDirectories = false); + std::unique_ptr<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. /// @@ -731,7 +725,7 @@ public: bool CreateMissingDirectories, std::string *ResultPathName, std::string *TempPathName); - llvm::raw_null_ostream *createNullOutputFile(); + std::unique_ptr<raw_pwrite_stream> createNullOutputFile(); /// } /// @name Initialization Utility Methods diff --git a/clang/include/clang/Frontend/FrontendActions.h b/clang/include/clang/Frontend/FrontendActions.h index 60e0ae4875f..0cbacbb4b12 100644 --- a/clang/include/clang/Frontend/FrontendActions.h +++ b/clang/include/clang/Frontend/FrontendActions.h @@ -85,7 +85,7 @@ public: /// create the PCHGenerator instance returned by CreateASTConsumer. /// /// \returns true if an error occurred, false otherwise. - static raw_pwrite_stream * + static std::unique_ptr<raw_pwrite_stream> ComputeASTConsumerArguments(CompilerInstance &CI, StringRef InFile, std::string &Sysroot, std::string &OutputFile); }; @@ -117,10 +117,9 @@ public: /// create the PCHGenerator instance returned by CreateASTConsumer. /// /// \returns true if an error occurred, false otherwise. - raw_pwrite_stream *ComputeASTConsumerArguments(CompilerInstance &CI, - StringRef InFile, - std::string &Sysroot, - std::string &OutputFile); + std::unique_ptr<raw_pwrite_stream> + ComputeASTConsumerArguments(CompilerInstance &CI, StringRef InFile, + std::string &Sysroot, std::string &OutputFile); }; class SyntaxOnlyAction : public ASTFrontendAction { diff --git a/clang/include/clang/Frontend/PCHContainerOperations.h b/clang/include/clang/Frontend/PCHContainerOperations.h index 67c36cf08eb..0c1b28e9a51 100644 --- a/clang/include/clang/Frontend/PCHContainerOperations.h +++ b/clang/include/clang/Frontend/PCHContainerOperations.h @@ -46,10 +46,12 @@ public: /// Return an ASTConsumer that can be chained with a /// PCHGenerator that produces a wrapper file format containing a /// serialized AST bitstream. - virtual std::unique_ptr<ASTConsumer> CreatePCHContainerGenerator( - CompilerInstance &CI, const std::string &MainFileName, - const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, - std::shared_ptr<PCHBuffer> Buffer) const = 0; + virtual std::unique_ptr<ASTConsumer> + CreatePCHContainerGenerator(CompilerInstance &CI, + const std::string &MainFileName, + const std::string &OutputFileName, + std::unique_ptr<llvm::raw_pwrite_stream> OS, + std::shared_ptr<PCHBuffer> Buffer) const = 0; }; /// This abstract interface provides operations for unwrapping @@ -73,10 +75,12 @@ class RawPCHContainerWriter : public PCHContainerWriter { /// Return an ASTConsumer that can be chained with a /// PCHGenerator that writes the module to a flat file. - std::unique_ptr<ASTConsumer> CreatePCHContainerGenerator( - CompilerInstance &CI, const std::string &MainFileName, - const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, - std::shared_ptr<PCHBuffer> Buffer) const override; + std::unique_ptr<ASTConsumer> + CreatePCHContainerGenerator(CompilerInstance &CI, + const std::string &MainFileName, + const std::string &OutputFileName, + std::unique_ptr<llvm::raw_pwrite_stream> OS, + std::shared_ptr<PCHBuffer> Buffer) const override; }; /// Implements read operations for a raw pass-through PCH container. diff --git a/clang/include/clang/Rewrite/Frontend/ASTConsumers.h b/clang/include/clang/Rewrite/Frontend/ASTConsumers.h index c9df8895041..e054e75e959 100644 --- a/clang/include/clang/Rewrite/Frontend/ASTConsumers.h +++ b/clang/include/clang/Rewrite/Frontend/ASTConsumers.h @@ -28,17 +28,18 @@ class Preprocessor; // ObjC rewriter: attempts to rewrite ObjC constructs into pure C code. // This is considered experimental, and only works with Apple's ObjC runtime. std::unique_ptr<ASTConsumer> -CreateObjCRewriter(const std::string &InFile, raw_ostream *OS, +CreateObjCRewriter(const std::string &InFile, std::unique_ptr<raw_ostream> OS, DiagnosticsEngine &Diags, const LangOptions &LOpts, bool SilenceRewriteMacroWarning); std::unique_ptr<ASTConsumer> -CreateModernObjCRewriter(const std::string &InFile, raw_ostream *OS, +CreateModernObjCRewriter(const std::string &InFile, + std::unique_ptr<raw_ostream> OS, DiagnosticsEngine &Diags, const LangOptions &LOpts, bool SilenceRewriteMacroWarning, bool LineInfo); /// CreateHTMLPrinter - Create an AST consumer which rewrites source code to /// HTML with syntax highlighting suitable for viewing in a web-browser. -std::unique_ptr<ASTConsumer> CreateHTMLPrinter(raw_ostream *OS, +std::unique_ptr<ASTConsumer> CreateHTMLPrinter(std::unique_ptr<raw_ostream> OS, Preprocessor &PP, bool SyntaxHighlight = true, bool HighlightMacros = true); |