summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Sema/ExternalSemaSourceTest.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-02-27 15:54:55 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-02-27 15:54:55 +0000
commit497fd98af2fff16b5b885f1bdac3b9b039f5080f (patch)
tree1aa1c150c739fec069916ed7f0b0aeed818b5e64 /clang/unittests/Sema/ExternalSemaSourceTest.cpp
parent12b40745abb776d596caf12c4b17444c9369e4bf (diff)
downloadbcm5719-llvm-497fd98af2fff16b5b885f1bdac3b9b039f5080f.tar.gz
bcm5719-llvm-497fd98af2fff16b5b885f1bdac3b9b039f5080f.zip
Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"
This reverts commit rL326201 This broke gcc4.8 builds, compiler just segfaults:¬ http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬ http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬ llvm-svn: 326204
Diffstat (limited to 'clang/unittests/Sema/ExternalSemaSourceTest.cpp')
-rw-r--r--clang/unittests/Sema/ExternalSemaSourceTest.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/clang/unittests/Sema/ExternalSemaSourceTest.cpp b/clang/unittests/Sema/ExternalSemaSourceTest.cpp
index 840861fb85d..d2cdd633fa1 100644
--- a/clang/unittests/Sema/ExternalSemaSourceTest.cpp
+++ b/clang/unittests/Sema/ExternalSemaSourceTest.cpp
@@ -221,26 +221,28 @@ public:
// Make sure that the DiagnosticWatcher is not miscounting.
TEST(ExternalSemaSource, SanityCheck) {
- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
+ std::unique_ptr<ExternalSemaSourceInstaller> Installer(
+ new ExternalSemaSourceInstaller);
DiagnosticWatcher Watcher("AAB", "BBB");
Installer->PushWatcher(&Watcher);
std::vector<std::string> Args(1, "-std=c++11");
ASSERT_TRUE(clang::tooling::runToolOnCodeWithArgs(
- std::move(Installer), "namespace AAA { } using namespace AAB;", Args));
+ Installer.release(), "namespace AAA { } using namespace AAB;", Args));
ASSERT_EQ(0, Watcher.SeenCount);
}
// Check that when we add a NamespaceTypeProvider, we use that suggestion
// instead of the usual suggestion we would use above.
TEST(ExternalSemaSource, ExternalTypoCorrectionPrioritized) {
- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
+ std::unique_ptr<ExternalSemaSourceInstaller> Installer(
+ new ExternalSemaSourceInstaller);
NamespaceTypoProvider Provider("AAB", "BBB");
DiagnosticWatcher Watcher("AAB", "BBB");
Installer->PushSource(&Provider);
Installer->PushWatcher(&Watcher);
std::vector<std::string> Args(1, "-std=c++11");
ASSERT_TRUE(clang::tooling::runToolOnCodeWithArgs(
- std::move(Installer), "namespace AAA { } using namespace AAB;", Args));
+ Installer.release(), "namespace AAA { } using namespace AAB;", Args));
ASSERT_LE(0, Provider.CallCount);
ASSERT_EQ(1, Watcher.SeenCount);
}
@@ -248,7 +250,8 @@ TEST(ExternalSemaSource, ExternalTypoCorrectionPrioritized) {
// Check that we use the first successful TypoCorrection returned from an
// ExternalSemaSource.
TEST(ExternalSemaSource, ExternalTypoCorrectionOrdering) {
- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
+ std::unique_ptr<ExternalSemaSourceInstaller> Installer(
+ new ExternalSemaSourceInstaller);
NamespaceTypoProvider First("XXX", "BBB");
NamespaceTypoProvider Second("AAB", "CCC");
NamespaceTypoProvider Third("AAB", "DDD");
@@ -259,7 +262,7 @@ TEST(ExternalSemaSource, ExternalTypoCorrectionOrdering) {
Installer->PushWatcher(&Watcher);
std::vector<std::string> Args(1, "-std=c++11");
ASSERT_TRUE(clang::tooling::runToolOnCodeWithArgs(
- std::move(Installer), "namespace AAA { } using namespace AAB;", Args));
+ Installer.release(), "namespace AAA { } using namespace AAB;", Args));
ASSERT_LE(1, First.CallCount);
ASSERT_LE(1, Second.CallCount);
ASSERT_EQ(0, Third.CallCount);
@@ -267,14 +270,15 @@ TEST(ExternalSemaSource, ExternalTypoCorrectionOrdering) {
}
TEST(ExternalSemaSource, ExternalDelayedTypoCorrection) {
- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
+ std::unique_ptr<ExternalSemaSourceInstaller> Installer(
+ new ExternalSemaSourceInstaller);
FunctionTypoProvider Provider("aaa", "bbb");
DiagnosticWatcher Watcher("aaa", "bbb");
Installer->PushSource(&Provider);
Installer->PushWatcher(&Watcher);
std::vector<std::string> Args(1, "-std=c++11");
ASSERT_TRUE(clang::tooling::runToolOnCodeWithArgs(
- std::move(Installer), "namespace AAA { } void foo() { AAA::aaa(); }",
+ Installer.release(), "namespace AAA { } void foo() { AAA::aaa(); }",
Args));
ASSERT_LE(0, Provider.CallCount);
ASSERT_EQ(1, Watcher.SeenCount);
@@ -283,14 +287,15 @@ TEST(ExternalSemaSource, ExternalDelayedTypoCorrection) {
// We should only try MaybeDiagnoseMissingCompleteType if we can't otherwise
// solve the problem.
TEST(ExternalSemaSource, TryOtherTacticsBeforeDiagnosing) {
- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
+ std::unique_ptr<ExternalSemaSourceInstaller> Installer(
+ new ExternalSemaSourceInstaller);
CompleteTypeDiagnoser Diagnoser(false);
Installer->PushSource(&Diagnoser);
std::vector<std::string> Args(1, "-std=c++11");
// This code hits the class template specialization/class member of a class
// template specialization checks in Sema::RequireCompleteTypeImpl.
ASSERT_TRUE(clang::tooling::runToolOnCodeWithArgs(
- std::move(Installer),
+ Installer.release(),
"template <typename T> struct S { class C { }; }; S<char>::C SCInst;",
Args));
ASSERT_EQ(0, Diagnoser.CallCount);
@@ -299,7 +304,8 @@ TEST(ExternalSemaSource, TryOtherTacticsBeforeDiagnosing) {
// The first ExternalSemaSource where MaybeDiagnoseMissingCompleteType returns
// true should be the last one called.
TEST(ExternalSemaSource, FirstDiagnoserTaken) {
- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
+ std::unique_ptr<ExternalSemaSourceInstaller> Installer(
+ new ExternalSemaSourceInstaller);
CompleteTypeDiagnoser First(false);
CompleteTypeDiagnoser Second(true);
CompleteTypeDiagnoser Third(true);
@@ -308,7 +314,7 @@ TEST(ExternalSemaSource, FirstDiagnoserTaken) {
Installer->PushSource(&Third);
std::vector<std::string> Args(1, "-std=c++11");
ASSERT_FALSE(clang::tooling::runToolOnCodeWithArgs(
- std::move(Installer), "class Incomplete; Incomplete IncompleteInstance;",
+ Installer.release(), "class Incomplete; Incomplete IncompleteInstance;",
Args));
ASSERT_EQ(1, First.CallCount);
ASSERT_EQ(1, Second.CallCount);
OpenPOWER on IntegriCloud