summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Frontend/FrontendActionTest.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2017-01-06 19:49:01 +0000
committerDavid Blaikie <dblaikie@gmail.com>2017-01-06 19:49:01 +0000
commitea4395ebcd37905487b7a978db2f460bc576a5d1 (patch)
tree92303c3c362a7eee408868cfa554f15683b0c02d /clang/unittests/Frontend/FrontendActionTest.cpp
parent9cbcc5ff0b325ef2c0638e6c5c365b35a1e4f087 (diff)
downloadbcm5719-llvm-ea4395ebcd37905487b7a978db2f460bc576a5d1.tar.gz
bcm5719-llvm-ea4395ebcd37905487b7a978db2f460bc576a5d1.zip
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. llvm-svn: 291270
Diffstat (limited to 'clang/unittests/Frontend/FrontendActionTest.cpp')
-rw-r--r--clang/unittests/Frontend/FrontendActionTest.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/unittests/Frontend/FrontendActionTest.cpp b/clang/unittests/Frontend/FrontendActionTest.cpp
index c3e6adb6324..dd6be5fd4b9 100644
--- a/clang/unittests/Frontend/FrontendActionTest.cpp
+++ b/clang/unittests/Frontend/FrontendActionTest.cpp
@@ -79,7 +79,7 @@ private:
};
TEST(ASTFrontendAction, Sanity) {
- CompilerInvocation *invocation = new CompilerInvocation;
+ auto invocation = std::make_shared<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(invocation);
+ compiler.setInvocation(std::move(invocation));
compiler.createDiagnostics();
TestASTFrontendAction test_action;
@@ -99,7 +99,7 @@ TEST(ASTFrontendAction, Sanity) {
}
TEST(ASTFrontendAction, IncrementalParsing) {
- CompilerInvocation *invocation = new CompilerInvocation;
+ auto invocation = std::make_shared<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(invocation);
+ compiler.setInvocation(std::move(invocation));
compiler.createDiagnostics();
TestASTFrontendAction test_action(/*enableIncrementalProcessing=*/true);
@@ -119,7 +119,7 @@ TEST(ASTFrontendAction, IncrementalParsing) {
}
TEST(ASTFrontendAction, LateTemplateIncrementalParsing) {
- CompilerInvocation *invocation = new CompilerInvocation;
+ auto invocation = std::make_shared<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(invocation);
+ compiler.setInvocation(std::move(invocation));
compiler.createDiagnostics();
TestASTFrontendAction test_action(/*enableIncrementalProcessing=*/true,
@@ -172,7 +172,7 @@ public:
};
TEST(PreprocessorFrontendAction, EndSourceFile) {
- CompilerInvocation *Invocation = new CompilerInvocation;
+ auto Invocation = std::make_shared<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(Invocation);
+ Compiler.setInvocation(std::move(Invocation));
Compiler.createDiagnostics();
TestPPCallbacks *Callbacks = new TestPPCallbacks;
@@ -231,7 +231,7 @@ struct TypoDiagnosticConsumer : public DiagnosticConsumer {
};
TEST(ASTFrontendAction, ExternalSemaSource) {
- auto *Invocation = new CompilerInvocation;
+ auto Invocation = std::make_shared<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(Invocation);
+ Compiler.setInvocation(std::move(Invocation));
auto *TDC = new TypoDiagnosticConsumer;
Compiler.createDiagnostics(TDC, /*ShouldOwnClient=*/true);
Compiler.setExternalSemaSource(new TypoExternalSemaSource(Compiler));
OpenPOWER on IntegriCloud