From 471e0b27d79c13f6c350c555e41668cc66d69a26 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 6 Jan 2017 17:47:10 +0000 Subject: Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer" Caused a memory leak reported by asan. Reverting while I investigate. This reverts commit r291184. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291249 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Frontend/CodeGenActionTest.cpp | 4 ++-- unittests/Frontend/FrontendActionTest.cpp | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'unittests/Frontend') diff --git a/unittests/Frontend/CodeGenActionTest.cpp b/unittests/Frontend/CodeGenActionTest.cpp index 1d2a50c8bc..356b5130fc 100644 --- a/unittests/Frontend/CodeGenActionTest.cpp +++ b/unittests/Frontend/CodeGenActionTest.cpp @@ -41,7 +41,7 @@ public: TEST(CodeGenTest, TestNullCodeGen) { - auto Invocation = std::make_shared(); + CompilerInvocation *Invocation = new 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(std::move(Invocation)); + Compiler.setInvocation(Invocation); Compiler.createDiagnostics(); EXPECT_TRUE(Compiler.hasDiagnostics()); diff --git a/unittests/Frontend/FrontendActionTest.cpp b/unittests/Frontend/FrontendActionTest.cpp index dd6be5fd4b..c3e6adb632 100644 --- a/unittests/Frontend/FrontendActionTest.cpp +++ b/unittests/Frontend/FrontendActionTest.cpp @@ -79,7 +79,7 @@ private: }; TEST(ASTFrontendAction, Sanity) { - auto invocation = std::make_shared(); + CompilerInvocation *invocation = new CompilerInvocation; invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("int main() { float x; }").release()); @@ -88,7 +88,7 @@ TEST(ASTFrontendAction, Sanity) { invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly; invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; - compiler.setInvocation(std::move(invocation)); + compiler.setInvocation(invocation); compiler.createDiagnostics(); TestASTFrontendAction test_action; @@ -99,7 +99,7 @@ TEST(ASTFrontendAction, Sanity) { } TEST(ASTFrontendAction, IncrementalParsing) { - auto invocation = std::make_shared(); + CompilerInvocation *invocation = new CompilerInvocation; invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("int main() { float x; }").release()); @@ -108,7 +108,7 @@ TEST(ASTFrontendAction, IncrementalParsing) { invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly; invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; - compiler.setInvocation(std::move(invocation)); + compiler.setInvocation(invocation); compiler.createDiagnostics(); TestASTFrontendAction test_action(/*enableIncrementalProcessing=*/true); @@ -119,7 +119,7 @@ TEST(ASTFrontendAction, IncrementalParsing) { } TEST(ASTFrontendAction, LateTemplateIncrementalParsing) { - auto invocation = std::make_shared(); + CompilerInvocation *invocation = new CompilerInvocation; invocation->getLangOpts()->CPlusPlus = true; invocation->getLangOpts()->DelayedTemplateParsing = true; invocation->getPreprocessorOpts().addRemappedFile( @@ -135,7 +135,7 @@ TEST(ASTFrontendAction, LateTemplateIncrementalParsing) { invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly; invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance compiler; - compiler.setInvocation(std::move(invocation)); + compiler.setInvocation(invocation); compiler.createDiagnostics(); TestASTFrontendAction test_action(/*enableIncrementalProcessing=*/true, @@ -172,7 +172,7 @@ public: }; TEST(PreprocessorFrontendAction, EndSourceFile) { - auto Invocation = std::make_shared(); + CompilerInvocation *Invocation = new CompilerInvocation; Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("int main() { float x; }").release()); @@ -181,7 +181,7 @@ TEST(PreprocessorFrontendAction, EndSourceFile) { Invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly; Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance Compiler; - Compiler.setInvocation(std::move(Invocation)); + Compiler.setInvocation(Invocation); Compiler.createDiagnostics(); TestPPCallbacks *Callbacks = new TestPPCallbacks; @@ -231,7 +231,7 @@ struct TypoDiagnosticConsumer : public DiagnosticConsumer { }; TEST(ASTFrontendAction, ExternalSemaSource) { - auto Invocation = std::make_shared(); + auto *Invocation = new CompilerInvocation; Invocation->getLangOpts()->CPlusPlus = true; Invocation->getPreprocessorOpts().addRemappedFile( "test.cc", MemoryBuffer::getMemBuffer("void fooo();\n" @@ -242,7 +242,7 @@ TEST(ASTFrontendAction, ExternalSemaSource) { Invocation->getFrontendOpts().ProgramAction = frontend::ParseSyntaxOnly; Invocation->getTargetOpts().Triple = "i386-unknown-linux-gnu"; CompilerInstance Compiler; - Compiler.setInvocation(std::move(Invocation)); + Compiler.setInvocation(Invocation); auto *TDC = new TypoDiagnosticConsumer; Compiler.createDiagnostics(TDC, /*ShouldOwnClient=*/true); Compiler.setExternalSemaSource(new TypoExternalSemaSource(Compiler)); -- cgit v1.2.3