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
This commit is contained in:
Edwin Vane 2013-06-12 19:58:21 +00:00
parent a6bbcdd707
commit 59175a1523
2 changed files with 19 additions and 17 deletions

View File

@ -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) {

View File

@ -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; }