diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-14 23:04:18 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-14 23:04:18 +0000 |
commit | 2b3d49b610bd2a45884115edcb21110bfa325f51 (patch) | |
tree | 4c64632086b8cf0a8d7ee68306f564532a5ea78f /clang/unittests/Tooling | |
parent | 5cd312d352dc663aec3b658e2bf5da347f365eb1 (diff) | |
download | llvm-2b3d49b610bd2a45884115edcb21110bfa325f51.zip llvm-2b3d49b610bd2a45884115edcb21110bfa325f51.tar.gz llvm-2b3d49b610bd2a45884115edcb21110bfa325f51.tar.bz2 |
[Clang] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.
Differential revision: https://reviews.llvm.org/D66259
llvm-svn: 368942
Diffstat (limited to 'clang/unittests/Tooling')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 6 | ||||
-rw-r--r-- | clang/unittests/Tooling/ExecutionTest.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Tooling/RefactoringTest.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Tooling/Syntax/TokensTest.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Tooling/Syntax/TreeTest.cpp | 6 | ||||
-rw-r--r-- | clang/unittests/Tooling/TestVisitor.h | 2 | ||||
-rw-r--r-- | clang/unittests/Tooling/ToolingTest.cpp | 16 |
7 files changed, 18 insertions, 18 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index fde9544..6189071 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -696,7 +696,7 @@ protected: // The input file is not included in the returned command. std::string getCommand(llvm::StringRef F) { auto Results = - inferMissingCompileCommands(llvm::make_unique<MemCDB>(Entries)) + inferMissingCompileCommands(std::make_unique<MemCDB>(Entries)) ->getCompileCommands(path(F)); if (Results.empty()) return "none"; @@ -710,7 +710,7 @@ protected: // Parse the file whose command was used out of the Heuristic string. std::string getProxy(llvm::StringRef F) { auto Results = - inferMissingCompileCommands(llvm::make_unique<MemCDB>(Entries)) + inferMissingCompileCommands(std::make_unique<MemCDB>(Entries)) ->getCompileCommands(path(F)); if (Results.empty()) return "none"; @@ -843,7 +843,7 @@ public: protected: // Look up the command from a relative path, and return it in string form. std::string getCommand(llvm::StringRef F) { - auto Results = inferTargetAndDriverMode(llvm::make_unique<MemCDB>(Entries)) + auto Results = inferTargetAndDriverMode(std::make_unique<MemCDB>(Entries)) ->getCompileCommands(path(F)); if (Results.empty()) return "none"; diff --git a/clang/unittests/Tooling/ExecutionTest.cpp b/clang/unittests/Tooling/ExecutionTest.cpp index 6c2c91c..3e1e51e 100644 --- a/clang/unittests/Tooling/ExecutionTest.cpp +++ b/clang/unittests/Tooling/ExecutionTest.cpp @@ -125,7 +125,7 @@ class TestToolExecutorPlugin : public ToolExecutorPlugin { public: llvm::Expected<std::unique_ptr<ToolExecutor>> create(CommonOptionsParser &OptionsParser) override { - return llvm::make_unique<TestToolExecutor>(std::move(OptionsParser)); + return std::make_unique<TestToolExecutor>(std::move(OptionsParser)); } }; diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp index b04c9a9..b5c56e90 100644 --- a/clang/unittests/Tooling/RefactoringTest.cpp +++ b/clang/unittests/Tooling/RefactoringTest.cpp @@ -680,7 +680,7 @@ private: Visitor->SM = &compiler.getSourceManager(); Visitor->Context = &compiler.getASTContext(); /// TestConsumer will be deleted by the framework calling us. - return llvm::make_unique<FindConsumer>(Visitor); + return std::make_unique<FindConsumer>(Visitor); } private: diff --git a/clang/unittests/Tooling/Syntax/TokensTest.cpp b/clang/unittests/Tooling/Syntax/TokensTest.cpp index a1398bd..78f0d2f 100644 --- a/clang/unittests/Tooling/Syntax/TokensTest.cpp +++ b/clang/unittests/Tooling/Syntax/TokensTest.cpp @@ -106,7 +106,7 @@ public: std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { - return llvm::make_unique<ASTConsumer>(); + return std::make_unique<ASTConsumer>(); } private: diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp index e83d2b72..c88a112 100644 --- a/clang/unittests/Tooling/Syntax/TreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -40,7 +40,7 @@ protected: } void HandleTranslationUnit(ASTContext &Ctx) override { - Arena = llvm::make_unique<syntax::Arena>(Ctx.getSourceManager(), + Arena = std::make_unique<syntax::Arena>(Ctx.getSourceManager(), Ctx.getLangOpts(), std::move(*Tokens).consume()); Tokens = nullptr; // make sure we fail if this gets called twice. @@ -63,8 +63,8 @@ protected: CreateASTConsumer(CompilerInstance &CI, StringRef InFile) override { // We start recording the tokens, ast consumer will take on the result. auto Tokens = - llvm::make_unique<syntax::TokenCollector>(CI.getPreprocessor()); - return llvm::make_unique<BuildSyntaxTree>(Root, Arena, + std::make_unique<syntax::TokenCollector>(CI.getPreprocessor()); + return std::make_unique<BuildSyntaxTree>(Root, Arena, std::move(Tokens)); } diff --git a/clang/unittests/Tooling/TestVisitor.h b/clang/unittests/Tooling/TestVisitor.h index ff90a77..95252b8 100644 --- a/clang/unittests/Tooling/TestVisitor.h +++ b/clang/unittests/Tooling/TestVisitor.h @@ -109,7 +109,7 @@ protected: std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(CompilerInstance &, llvm::StringRef dummy) override { /// TestConsumer will be deleted by the framework calling us. - return llvm::make_unique<FindConsumer>(Visitor); + return std::make_unique<FindConsumer>(Visitor); } protected: diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index f9f4de3..447b997 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -63,7 +63,7 @@ class FindTopLevelDeclConsumer : public clang::ASTConsumer { TEST(runToolOnCode, FindsNoTopLevelDeclOnEmptyCode) { bool FoundTopLevelDecl = false; EXPECT_TRUE( - runToolOnCode(new TestAction(llvm::make_unique<FindTopLevelDeclConsumer>( + runToolOnCode(new TestAction(std::make_unique<FindTopLevelDeclConsumer>( &FoundTopLevelDecl)), "")); EXPECT_FALSE(FoundTopLevelDecl); @@ -103,14 +103,14 @@ bool FindClassDeclX(ASTUnit *AST) { TEST(runToolOnCode, FindsClassDecl) { bool FoundClassDeclX = false; EXPECT_TRUE( - runToolOnCode(new TestAction(llvm::make_unique<FindClassDeclXConsumer>( + runToolOnCode(new TestAction(std::make_unique<FindClassDeclXConsumer>( &FoundClassDeclX)), "class X;")); EXPECT_TRUE(FoundClassDeclX); FoundClassDeclX = false; EXPECT_TRUE( - runToolOnCode(new TestAction(llvm::make_unique<FindClassDeclXConsumer>( + runToolOnCode(new TestAction(std::make_unique<FindClassDeclXConsumer>( &FoundClassDeclX)), "class Y;")); EXPECT_FALSE(FoundClassDeclX); @@ -135,7 +135,7 @@ TEST(newFrontendActionFactory, CreatesFrontendActionFactoryFromType) { struct IndependentFrontendActionCreator { std::unique_ptr<ASTConsumer> newASTConsumer() { - return llvm::make_unique<FindTopLevelDeclConsumer>(nullptr); + return std::make_unique<FindTopLevelDeclConsumer>(nullptr); } }; @@ -207,7 +207,7 @@ struct VerifyEndCallback : public SourceFileCallbacks { } void handleEndSource() override { ++EndCalled; } std::unique_ptr<ASTConsumer> newASTConsumer() { - return llvm::make_unique<FindTopLevelDeclConsumer>(&Matched); + return std::make_unique<FindTopLevelDeclConsumer>(&Matched); } unsigned BeginCalled; unsigned EndCalled; @@ -249,7 +249,7 @@ struct SkipBodyAction : public clang::ASTFrontendAction { std::unique_ptr<ASTConsumer> CreateASTConsumer(CompilerInstance &Compiler, StringRef) override { Compiler.getFrontendOpts().SkipFunctionBodies = true; - return llvm::make_unique<SkipBodyConsumer>(); + return std::make_unique<SkipBodyConsumer>(); } }; @@ -340,7 +340,7 @@ struct CheckColoredDiagnosticsAction : public clang::ASTFrontendAction { Compiler.getDiagnostics().getCustomDiagID( DiagnosticsEngine::Fatal, "getDiagnosticOpts().ShowColors != ShouldShowColor")); - return llvm::make_unique<ASTConsumer>(); + return std::make_unique<ASTConsumer>(); } private: @@ -651,7 +651,7 @@ TEST(runToolOnCode, TestResetDiagnostics) { return true; } }; - return llvm::make_unique<Consumer>(); + return std::make_unique<Consumer>(); } }; |