forked from OSchip/llvm-project
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:
parent
a6bbcdd707
commit
59175a1523
|
@ -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) {
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue