Unique_ptrify PPCallbacks ownership.

Unique_ptr creation stil needs to be moved earlier at some of the call sites.

llvm-svn: 217474
This commit is contained in:
Craig Topper
2014-09-10 04:53:53 +00:00
parent 7ff1592960
commit b8a7053055
18 changed files with 50 additions and 45 deletions

View File

@@ -121,7 +121,8 @@ bool DependencyCollector::sawDependency(StringRef Filename, bool FromModule,
DependencyCollector::~DependencyCollector() { }
void DependencyCollector::attachToPreprocessor(Preprocessor &PP) {
PP.addPPCallbacks(new DepCollectorPPCallbacks(*this, PP.getSourceManager()));
PP.addPPCallbacks(
llvm::make_unique<DepCollectorPPCallbacks>(*this, PP.getSourceManager()));
}
void DependencyCollector::attachToASTReader(ASTReader &R) {
R.addListener(llvm::make_unique<DepCollectorASTListener>(*this));
@@ -203,7 +204,7 @@ DependencyFileGenerator *DependencyFileGenerator::CreateAndAttachToPreprocessor(
PP.SetSuppressIncludeNotFoundError(true);
DFGImpl *Callback = new DFGImpl(&PP, Opts);
PP.addPPCallbacks(Callback); // PP owns the Callback
PP.addPPCallbacks(std::unique_ptr<PPCallbacks>(Callback));
return new DependencyFileGenerator(Callback);
}