@@ -221,34 +221,37 @@ class ExternalSemaSourceInstaller : public clang::ASTFrontendAction {
221221
222222// Make sure that the DiagnosticWatcher is not miscounting.
223223TEST (ExternalSemaSource, SanityCheck) {
224- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
224+ std::unique_ptr<ExternalSemaSourceInstaller> Installer (
225+ new ExternalSemaSourceInstaller);
225226 DiagnosticWatcher Watcher (" AAB" , " BBB" );
226227 Installer->PushWatcher (&Watcher);
227228 std::vector<std::string> Args (1 , " -std=c++11" );
228229 ASSERT_TRUE (clang::tooling::runToolOnCodeWithArgs (
229- std::move ( Installer), " namespace AAA { } using namespace AAB;" , Args));
230+ Installer. release ( ), " namespace AAA { } using namespace AAB;" , Args));
230231 ASSERT_EQ (0 , Watcher.SeenCount );
231232}
232233
233234// Check that when we add a NamespaceTypeProvider, we use that suggestion
234235// instead of the usual suggestion we would use above.
235236TEST (ExternalSemaSource, ExternalTypoCorrectionPrioritized) {
236- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
237+ std::unique_ptr<ExternalSemaSourceInstaller> Installer (
238+ new ExternalSemaSourceInstaller);
237239 NamespaceTypoProvider Provider (" AAB" , " BBB" );
238240 DiagnosticWatcher Watcher (" AAB" , " BBB" );
239241 Installer->PushSource (&Provider);
240242 Installer->PushWatcher (&Watcher);
241243 std::vector<std::string> Args (1 , " -std=c++11" );
242244 ASSERT_TRUE (clang::tooling::runToolOnCodeWithArgs (
243- std::move ( Installer), " namespace AAA { } using namespace AAB;" , Args));
245+ Installer. release ( ), " namespace AAA { } using namespace AAB;" , Args));
244246 ASSERT_LE (0 , Provider.CallCount );
245247 ASSERT_EQ (1 , Watcher.SeenCount );
246248}
247249
248250// Check that we use the first successful TypoCorrection returned from an
249251// ExternalSemaSource.
250252TEST (ExternalSemaSource, ExternalTypoCorrectionOrdering) {
251- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
253+ std::unique_ptr<ExternalSemaSourceInstaller> Installer (
254+ new ExternalSemaSourceInstaller);
252255 NamespaceTypoProvider First (" XXX" , " BBB" );
253256 NamespaceTypoProvider Second (" AAB" , " CCC" );
254257 NamespaceTypoProvider Third (" AAB" , " DDD" );
@@ -259,22 +262,23 @@ TEST(ExternalSemaSource, ExternalTypoCorrectionOrdering) {
259262 Installer->PushWatcher (&Watcher);
260263 std::vector<std::string> Args (1 , " -std=c++11" );
261264 ASSERT_TRUE (clang::tooling::runToolOnCodeWithArgs (
262- std::move ( Installer), " namespace AAA { } using namespace AAB;" , Args));
265+ Installer. release ( ), " namespace AAA { } using namespace AAB;" , Args));
263266 ASSERT_LE (1 , First.CallCount );
264267 ASSERT_LE (1 , Second.CallCount );
265268 ASSERT_EQ (0 , Third.CallCount );
266269 ASSERT_EQ (1 , Watcher.SeenCount );
267270}
268271
269272TEST (ExternalSemaSource, ExternalDelayedTypoCorrection) {
270- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
273+ std::unique_ptr<ExternalSemaSourceInstaller> Installer (
274+ new ExternalSemaSourceInstaller);
271275 FunctionTypoProvider Provider (" aaa" , " bbb" );
272276 DiagnosticWatcher Watcher (" aaa" , " bbb" );
273277 Installer->PushSource (&Provider);
274278 Installer->PushWatcher (&Watcher);
275279 std::vector<std::string> Args (1 , " -std=c++11" );
276280 ASSERT_TRUE (clang::tooling::runToolOnCodeWithArgs (
277- std::move ( Installer), " namespace AAA { } void foo() { AAA::aaa(); }" ,
281+ Installer. release ( ), " namespace AAA { } void foo() { AAA::aaa(); }" ,
278282 Args));
279283 ASSERT_LE (0 , Provider.CallCount );
280284 ASSERT_EQ (1 , Watcher.SeenCount );
@@ -283,14 +287,15 @@ TEST(ExternalSemaSource, ExternalDelayedTypoCorrection) {
283287// We should only try MaybeDiagnoseMissingCompleteType if we can't otherwise
284288// solve the problem.
285289TEST (ExternalSemaSource, TryOtherTacticsBeforeDiagnosing) {
286- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
290+ std::unique_ptr<ExternalSemaSourceInstaller> Installer (
291+ new ExternalSemaSourceInstaller);
287292 CompleteTypeDiagnoser Diagnoser (false );
288293 Installer->PushSource (&Diagnoser);
289294 std::vector<std::string> Args (1 , " -std=c++11" );
290295 // This code hits the class template specialization/class member of a class
291296 // template specialization checks in Sema::RequireCompleteTypeImpl.
292297 ASSERT_TRUE (clang::tooling::runToolOnCodeWithArgs (
293- std::move ( Installer),
298+ Installer. release ( ),
294299 " template <typename T> struct S { class C { }; }; S<char>::C SCInst;" ,
295300 Args));
296301 ASSERT_EQ (0 , Diagnoser.CallCount );
@@ -299,7 +304,8 @@ TEST(ExternalSemaSource, TryOtherTacticsBeforeDiagnosing) {
299304// The first ExternalSemaSource where MaybeDiagnoseMissingCompleteType returns
300305// true should be the last one called.
301306TEST (ExternalSemaSource, FirstDiagnoserTaken) {
302- auto Installer = llvm::make_unique<ExternalSemaSourceInstaller>();
307+ std::unique_ptr<ExternalSemaSourceInstaller> Installer (
308+ new ExternalSemaSourceInstaller);
303309 CompleteTypeDiagnoser First (false );
304310 CompleteTypeDiagnoser Second (true );
305311 CompleteTypeDiagnoser Third (true );
@@ -308,7 +314,7 @@ TEST(ExternalSemaSource, FirstDiagnoserTaken) {
308314 Installer->PushSource (&Third);
309315 std::vector<std::string> Args (1 , " -std=c++11" );
310316 ASSERT_FALSE (clang::tooling::runToolOnCodeWithArgs (
311- std::move ( Installer), " class Incomplete; Incomplete IncompleteInstance;" ,
317+ Installer. release ( ), " class Incomplete; Incomplete IncompleteInstance;" ,
312318 Args));
313319 ASSERT_EQ (1 , First.CallCount );
314320 ASSERT_EQ (1 , Second.CallCount );
0 commit comments