From 59175a1523c15a5e534dfa24bdee5b3bd252f3bc Mon Sep 17 00:00:00 2001 From: Edwin Vane Date: Wed, 12 Jun 2013 19:58:21 +0000 Subject: [PATCH] cpp11-migrate: Decluttering Transform.h Moving RewriteContainer's constructor impl to Transform.cpp to reduce clutter. More things will soon be added to this header. llvm-svn: 183856 --- .../cpp11-migrate/Core/Transform.cpp | 18 ++++++++++++++++++ .../cpp11-migrate/Core/Transform.h | 18 +----------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/clang-tools-extra/cpp11-migrate/Core/Transform.cpp b/clang-tools-extra/cpp11-migrate/Core/Transform.cpp index a781e912002c..718ed0785adf 100644 --- a/clang-tools-extra/cpp11-migrate/Core/Transform.cpp +++ b/clang-tools-extra/cpp11-migrate/Core/Transform.cpp @@ -74,6 +74,24 @@ private: } // namespace +RewriterContainer::RewriterContainer(clang::FileManager &Files, + const FileContentsByPath &InputStates) + : DiagOpts(new clang::DiagnosticOptions()), + DiagnosticPrinter(llvm::errs(), DiagOpts.getPtr()), + Diagnostics(llvm::IntrusiveRefCntPtr( + new clang::DiagnosticIDs()), + DiagOpts.getPtr(), &DiagnosticPrinter, false), + Sources(Diagnostics, Files), Rewrite(Sources, DefaultLangOptions) { + + // Overwrite source manager's file contents with data from InputStates + for (FileContentsByPath::const_iterator I = InputStates.begin(), + E = InputStates.end(); + I != E; ++I) { + Sources.overrideFileContents(Files.getFile(I->first), + llvm::MemoryBuffer::getMemBuffer(I->second)); + } +} + void collectResults(clang::Rewriter &Rewrite, const FileContentsByPath &InputStates, FileContentsByPath &Results) { diff --git a/clang-tools-extra/cpp11-migrate/Core/Transform.h b/clang-tools-extra/cpp11-migrate/Core/Transform.h index 632d30b1496a..1312cf42ed68 100644 --- a/clang-tools-extra/cpp11-migrate/Core/Transform.h +++ b/clang-tools-extra/cpp11-migrate/Core/Transform.h @@ -80,23 +80,7 @@ void collectResults(clang::Rewriter &Rewrite, class RewriterContainer { public: RewriterContainer(clang::FileManager &Files, - const FileContentsByPath &InputStates) - : DiagOpts(new clang::DiagnosticOptions()), - DiagnosticPrinter(llvm::errs(), DiagOpts.getPtr()), - Diagnostics(llvm::IntrusiveRefCntPtr( - new clang::DiagnosticIDs()), - DiagOpts.getPtr(), &DiagnosticPrinter, false), - Sources(Diagnostics, Files), - Rewrite(Sources, DefaultLangOptions) { - - // Overwrite source manager's file contents with data from InputStates - for (FileContentsByPath::const_iterator I = InputStates.begin(), - E = InputStates.end(); - I != E; ++I) { - Sources.overrideFileContents(Files.getFile(I->first), - llvm::MemoryBuffer::getMemBuffer(I->second)); - } - } + const FileContentsByPath &InputStates); clang::Rewriter &getRewriter() { return Rewrite; }