From: Adrian Prantl Date: Sat, 19 Sep 2015 21:42:52 +0000 (+0000) Subject: Further simplify the interface of PCHContainerGenerator X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7217ff0c5311c8d0c6e8ac9bddd00756745ddb5;p=clang Further simplify the interface of PCHContainerGenerator by dropping the const qualifier on the CI. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248101 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/CodeGen/ObjectFilePCHContainerOperations.h b/include/clang/CodeGen/ObjectFilePCHContainerOperations.h index 031e6b43c8..15132acfc2 100644 --- a/include/clang/CodeGen/ObjectFilePCHContainerOperations.h +++ b/include/clang/CodeGen/ObjectFilePCHContainerOperations.h @@ -23,9 +23,8 @@ class ObjectFilePCHContainerWriter : public PCHContainerWriter { /// PCHGenerator that produces a wrapper file format /// that also contains full debug info for the module. std::unique_ptr CreatePCHContainerGenerator( - DiagnosticsEngine &Diags, const CompilerInstance &CI, - const std::string &MainFileName, const std::string &OutputFileName, - llvm::raw_pwrite_stream *OS, + CompilerInstance &CI, const std::string &MainFileName, + const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, std::shared_ptr Buffer) const override; }; diff --git a/include/clang/Frontend/PCHContainerOperations.h b/include/clang/Frontend/PCHContainerOperations.h index f6a742731b..92d9386207 100644 --- a/include/clang/Frontend/PCHContainerOperations.h +++ b/include/clang/Frontend/PCHContainerOperations.h @@ -46,9 +46,9 @@ public: /// PCHGenerator that produces a wrapper file format containing a /// serialized AST bitstream. virtual std::unique_ptr CreatePCHContainerGenerator( - DiagnosticsEngine &Diags, const CompilerInstance &CI, - const std::string &MainFileName, const std::string &OutputFileName, - llvm::raw_pwrite_stream *OS, std::shared_ptr Buffer) const = 0; + CompilerInstance &CI, const std::string &MainFileName, + const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, + std::shared_ptr Buffer) const = 0; }; /// This abstract interface provides operations for unwrapping @@ -73,9 +73,8 @@ 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 CreatePCHContainerGenerator( - DiagnosticsEngine &Diags, const CompilerInstance &CI, - const std::string &MainFileName, const std::string &OutputFileName, - llvm::raw_pwrite_stream *OS, + CompilerInstance &CI, const std::string &MainFileName, + const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, std::shared_ptr Buffer) const override; }; diff --git a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp index 8b40408f1c..147d198d9b 100644 --- a/lib/CodeGen/ObjectFilePCHContainerOperations.cpp +++ b/lib/CodeGen/ObjectFilePCHContainerOperations.cpp @@ -116,12 +116,12 @@ class PCHContainerGenerator : public ASTConsumer { }; public: - PCHContainerGenerator(DiagnosticsEngine &diags, const CompilerInstance &CI, - const std::string &MainFileName, + PCHContainerGenerator(CompilerInstance &CI, const std::string &MainFileName, const std::string &OutputFileName, raw_pwrite_stream *OS, std::shared_ptr Buffer) - : Diags(diags), Ctx(nullptr), HeaderSearchOpts(CI.getHeaderSearchOpts()), + : Diags(CI.getDiagnostics()), Ctx(nullptr), + HeaderSearchOpts(CI.getHeaderSearchOpts()), PreprocessorOpts(CI.getPreprocessorOpts()), TargetOpts(CI.getTargetOpts()), LangOpts(CI.getLangOpts()), OS(OS), Buffer(Buffer) { @@ -252,10 +252,10 @@ public: std::unique_ptr ObjectFilePCHContainerWriter::CreatePCHContainerGenerator( - DiagnosticsEngine &Diags, const CompilerInstance &CI, - const std::string &MainFileName, const std::string &OutputFileName, - llvm::raw_pwrite_stream *OS, std::shared_ptr Buffer) const { - return llvm::make_unique(Diags, CI, MainFileName, + CompilerInstance &CI, const std::string &MainFileName, + const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, + std::shared_ptr Buffer) const { + return llvm::make_unique(CI, MainFileName, OutputFileName, OS, Buffer); } diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index be4ec5b123..6ba4b134c3 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -93,7 +93,7 @@ GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { Consumers.push_back(llvm::make_unique( CI.getPreprocessor(), OutputFile, nullptr, Sysroot, Buffer)); Consumers.push_back(CI.getPCHContainerWriter().CreatePCHContainerGenerator( - CI.getDiagnostics(), CI, InFile, OutputFile, OS, Buffer)); + CI, InFile, OutputFile, OS, Buffer)); return llvm::make_unique(std::move(Consumers)); } @@ -138,7 +138,7 @@ GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI, /*AllowASTWithErrors*/false, /*IncludeTimestamps*/+CI.getFrontendOpts().BuildingImplicitModule)); Consumers.push_back(CI.getPCHContainerWriter().CreatePCHContainerGenerator( - CI.getDiagnostics(), CI, InFile, OutputFile, OS, Buffer)); + CI, InFile, OutputFile, OS, Buffer)); return llvm::make_unique(std::move(Consumers)); } diff --git a/lib/Frontend/PCHContainerOperations.cpp b/lib/Frontend/PCHContainerOperations.cpp index 5cf8de44dc..5e1d772050 100644 --- a/lib/Frontend/PCHContainerOperations.cpp +++ b/lib/Frontend/PCHContainerOperations.cpp @@ -48,9 +48,9 @@ public: } // anonymous namespace std::unique_ptr RawPCHContainerWriter::CreatePCHContainerGenerator( - DiagnosticsEngine &Diags, const CompilerInstance &CI, - const std::string &MainFileName, const std::string &OutputFileName, - llvm::raw_pwrite_stream *OS, std::shared_ptr Buffer) const { + CompilerInstance &CI, const std::string &MainFileName, + const std::string &OutputFileName, llvm::raw_pwrite_stream *OS, + std::shared_ptr Buffer) const { return llvm::make_unique(OS, Buffer); }