summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenAction.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/CodeGen/CodeGenAction.cpp
parent4422df6fa321019aad77ea3a1aacff3fcf6d0280 (diff)
downloadbcm5719-llvm-6beb6aa8f0f6fa20e8c8de7a17f39b101ed0da59.tar.gz
bcm5719-llvm-6beb6aa8f0f6fa20e8c8de7a17f39b101ed0da59.zip
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/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index d319d220dc5..a7dbd4ae159 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -607,8 +607,8 @@ static raw_ostream *GetOutputStream(CompilerInstance &CI,
llvm_unreachable("Invalid action!");
}
-ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+std::unique_ptr<ASTConsumer>
+CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) {
BackendAction BA = static_cast<BackendAction>(Act);
std::unique_ptr<raw_ostream> OS(GetOutputStream(CI, InFile, BA));
if (BA != Backend_EmitNothing && !OS)
@@ -646,12 +646,12 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI,
CoverageInfo = new CoverageSourceInfo;
CI.getPreprocessor().addPPCallbacks(CoverageInfo);
}
- BEConsumer = new BackendConsumer(BA, CI.getDiagnostics(), CI.getCodeGenOpts(),
- CI.getTargetOpts(), CI.getLangOpts(),
- CI.getFrontendOpts().ShowTimers, InFile,
- LinkModuleToUse, OS.release(), *VMContext,
- CoverageInfo);
- return BEConsumer;
+ auto Result = llvm::make_unique<BackendConsumer>(
+ BA, CI.getDiagnostics(), CI.getCodeGenOpts(), CI.getTargetOpts(),
+ CI.getLangOpts(), (bool)CI.getFrontendOpts().ShowTimers, InFile,
+ LinkModuleToUse, OS.release(), *VMContext, CoverageInfo);
+ BEConsumer = Result.get();
+ return std::move(Result);
}
void CodeGenAction::ExecuteAction() {
OpenPOWER on IntegriCloud