aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/Rewrite/FrontendActions.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-08-10 19:56:51 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-08-10 19:56:51 +0000
commit6beb6aa8f0f6fa20e8c8de7a17f39b101ed0da59 (patch)
tree584157687d5fd851d1afa4ca2e217973ff095555 /clang/lib/Frontend/Rewrite/FrontendActions.cpp
parent4422df6fa321019aad77ea3a1aacff3fcf6d0280 (diff)
downloadllvm-6beb6aa8f0f6fa20e8c8de7a17f39b101ed0da59.zip
llvm-6beb6aa8f0f6fa20e8c8de7a17f39b101ed0da59.tar.gz
llvm-6beb6aa8f0f6fa20e8c8de7a17f39b101ed0da59.tar.bz2
Recommit 213307: unique_ptr-ify ownership of ASTConsumers (reverted in r213325)
After post-commit review and community discussion, this seems like a reasonable direction to continue, making ownership semantics explicit in the source using the type system. llvm-svn: 215323
Diffstat (limited to 'clang/lib/Frontend/Rewrite/FrontendActions.cpp')
-rw-r--r--clang/lib/Frontend/Rewrite/FrontendActions.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Frontend/Rewrite/FrontendActions.cpp b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
index 59fef73..1b5eb28 100644
--- a/clang/lib/Frontend/Rewrite/FrontendActions.cpp
+++ b/clang/lib/Frontend/Rewrite/FrontendActions.cpp
@@ -30,8 +30,8 @@ using namespace clang;
// AST Consumer Actions
//===----------------------------------------------------------------------===//
-ASTConsumer *HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+std::unique_ptr<ASTConsumer>
+HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile))
return CreateHTMLPrinter(OS, CI.getPreprocessor());
return nullptr;
@@ -40,9 +40,9 @@ ASTConsumer *HTMLPrintAction::CreateASTConsumer(CompilerInstance &CI,
FixItAction::FixItAction() {}
FixItAction::~FixItAction() {}
-ASTConsumer *FixItAction::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
- return new ASTConsumer();
+std::unique_ptr<ASTConsumer>
+FixItAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
+ return llvm::make_unique<ASTConsumer>();
}
namespace {
@@ -148,8 +148,8 @@ bool FixItRecompile::BeginInvocation(CompilerInstance &CI) {
#ifdef CLANG_ENABLE_OBJC_REWRITER
-ASTConsumer *RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+std::unique_ptr<ASTConsumer>
+RewriteObjCAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile, "cpp")) {
if (CI.getLangOpts().ObjCRuntime.isNonFragile())
return CreateModernObjCRewriter(InFile, OS,