From 0eaee545eef49ff9498234d3a51a5cbde59bf976 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 15 Aug 2019 15:54:37 +0000 Subject: [llvm] 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. llvm-svn: 369013 --- llvm/examples/Kaleidoscope/Chapter5/toy.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'llvm/examples/Kaleidoscope/Chapter5/toy.cpp') diff --git a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp index 534c8e529e4..3eeb1c14a36 100644 --- a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp @@ -278,7 +278,7 @@ static std::unique_ptr ParseExpression(); /// numberexpr ::= number static std::unique_ptr ParseNumberExpr() { - auto Result = llvm::make_unique(NumVal); + auto Result = std::make_unique(NumVal); getNextToken(); // consume the number return std::move(Result); } @@ -305,7 +305,7 @@ static std::unique_ptr ParseIdentifierExpr() { getNextToken(); // eat identifier. if (CurTok != '(') // Simple variable ref. - return llvm::make_unique(IdName); + return std::make_unique(IdName); // Call. getNextToken(); // eat ( @@ -329,7 +329,7 @@ static std::unique_ptr ParseIdentifierExpr() { // Eat the ')'. getNextToken(); - return llvm::make_unique(IdName, std::move(Args)); + return std::make_unique(IdName, std::move(Args)); } /// ifexpr ::= 'if' expression 'then' expression 'else' expression @@ -358,7 +358,7 @@ static std::unique_ptr ParseIfExpr() { if (!Else) return nullptr; - return llvm::make_unique(std::move(Cond), std::move(Then), + return std::make_unique(std::move(Cond), std::move(Then), std::move(Else)); } @@ -404,7 +404,7 @@ static std::unique_ptr ParseForExpr() { if (!Body) return nullptr; - return llvm::make_unique(IdName, std::move(Start), std::move(End), + return std::make_unique(IdName, std::move(Start), std::move(End), std::move(Step), std::move(Body)); } @@ -464,7 +464,7 @@ static std::unique_ptr ParseBinOpRHS(int ExprPrec, // Merge LHS/RHS. LHS = - llvm::make_unique(BinOp, std::move(LHS), std::move(RHS)); + std::make_unique(BinOp, std::move(LHS), std::move(RHS)); } } @@ -500,7 +500,7 @@ static std::unique_ptr ParsePrototype() { // success. getNextToken(); // eat ')'. - return llvm::make_unique(FnName, std::move(ArgNames)); + return std::make_unique(FnName, std::move(ArgNames)); } /// definition ::= 'def' prototype expression @@ -511,7 +511,7 @@ static std::unique_ptr ParseDefinition() { return nullptr; if (auto E = ParseExpression()) - return llvm::make_unique(std::move(Proto), std::move(E)); + return std::make_unique(std::move(Proto), std::move(E)); return nullptr; } @@ -519,9 +519,9 @@ static std::unique_ptr ParseDefinition() { static std::unique_ptr ParseTopLevelExpr() { if (auto E = ParseExpression()) { // Make an anonymous proto. - auto Proto = llvm::make_unique("__anon_expr", + auto Proto = std::make_unique("__anon_expr", std::vector()); - return llvm::make_unique(std::move(Proto), std::move(E)); + return std::make_unique(std::move(Proto), std::move(E)); } return nullptr; } @@ -824,11 +824,11 @@ Function *FunctionAST::codegen() { static void InitializeModuleAndPassManager() { // Open a new module. - TheModule = llvm::make_unique("my cool jit", TheContext); + TheModule = std::make_unique("my cool jit", TheContext); TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout()); // Create a new pass manager attached to it. - TheFPM = llvm::make_unique(TheModule.get()); + TheFPM = std::make_unique(TheModule.get()); // Do simple "peephole" optimizations and bit-twiddling optzns. TheFPM->add(createInstructionCombiningPass()); @@ -963,7 +963,7 @@ int main() { fprintf(stderr, "ready> "); getNextToken(); - TheJIT = llvm::make_unique(); + TheJIT = std::make_unique(); InitializeModuleAndPassManager(); -- cgit v1.2.3