diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-01-06 19:49:01 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-01-06 19:49:01 +0000 |
commit | e781b71dd0fa9835aff199285aba0f83d47aed27 (patch) | |
tree | 746c15203e97a6e9bf75f556dea4fd5608c7fdcc /unittests/Frontend/CodeGenActionTest.cpp | |
parent | 8dc751fddfd5052e23e51170699fb2bf2d242550 (diff) |
Reapply "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"
Aleksey Shlypanikov pointed out my mistake in migrating an explicit
unique_ptr to auto - I was expecting the function returned a unique_ptr,
but instead it returned a raw pointer - introducing a leak.
Thanks Aleksey!
This reapplies r291184, reverted in r291249.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Frontend/CodeGenActionTest.cpp')
-rw-r--r-- | unittests/Frontend/CodeGenActionTest.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/unittests/Frontend/CodeGenActionTest.cpp b/unittests/Frontend/CodeGenActionTest.cpp index 356b5130fc..1d2a50c8bc 100644 --- a/unittests/Frontend/CodeGenActionTest.cpp +++ b/unittests/Frontend/CodeGenActionTest.cpp @@ -41,7 +41,7 @@ public: TEST(CodeGenTest, TestNullCodeGen) { - CompilerInvocation *Invocation = new CompilerInvocation; + auto Invocation = std::make_shared<CompilerInvocation>(); Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("").release()); @@ -50,7 +50,7 @@ TEST(CodeGenTest, TestNullCodeGen) { Invocation->getFrontendOpts().ProgramAction = EmitLLVM; Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance Compiler; - Compiler.setInvocation(Invocation); + Compiler.setInvocation(std::move(Invocation)); Compiler.createDiagnostics(); EXPECT_TRUE(Compiler.hasDiagnostics()); |