diff options
-rw-r--r-- | clang-tools-extra/cpp11-migrate/Core/Transform.cpp | 18 | ||||
-rw-r--r-- | clang-tools-extra/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 a781e912002..718ed0785ad 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<clang::DiagnosticIDs>( + 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 632d30b1496..1312cf42ed6 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<clang::DiagnosticIDs>( - 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; } |