diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-15 15:54:37 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-15 15:54:37 +0000 |
commit | 0eaee545eef49ff9498234d3a51a5cbde59bf976 (patch) | |
tree | fd7691e102022fb97622c5485fa8c4f506fc124e /llvm/examples/Kaleidoscope/Chapter6/toy.cpp | |
parent | 1c34d10776828c0756ff4f0b2b9aa8bda2be348a (diff) | |
download | bcm5719-llvm-0eaee545eef49ff9498234d3a51a5cbde59bf976.tar.gz bcm5719-llvm-0eaee545eef49ff9498234d3a51a5cbde59bf976.zip |
[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
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter6/toy.cpp')
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter6/toy.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp index 4b58117bd4a..5b3dd5a6c4e 100644 --- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp @@ -312,7 +312,7 @@ static std::unique_ptr<ExprAST> ParseExpression(); /// numberexpr ::= number static std::unique_ptr<ExprAST> ParseNumberExpr() { - auto Result = llvm::make_unique<NumberExprAST>(NumVal); + auto Result = std::make_unique<NumberExprAST>(NumVal); getNextToken(); // consume the number return std::move(Result); } @@ -339,7 +339,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { getNextToken(); // eat identifier. if (CurTok != '(') // Simple variable ref. - return llvm::make_unique<VariableExprAST>(IdName); + return std::make_unique<VariableExprAST>(IdName); // Call. getNextToken(); // eat ( @@ -363,7 +363,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { // Eat the ')'. getNextToken(); - return llvm::make_unique<CallExprAST>(IdName, std::move(Args)); + return std::make_unique<CallExprAST>(IdName, std::move(Args)); } /// ifexpr ::= 'if' expression 'then' expression 'else' expression @@ -392,7 +392,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() { if (!Else) return nullptr; - return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then), + return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then), std::move(Else)); } @@ -438,7 +438,7 @@ static std::unique_ptr<ExprAST> ParseForExpr() { if (!Body) return nullptr; - return llvm::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End), + return std::make_unique<ForExprAST>(IdName, std::move(Start), std::move(End), std::move(Step), std::move(Body)); } @@ -477,7 +477,7 @@ static std::unique_ptr<ExprAST> ParseUnary() { int Opc = CurTok; getNextToken(); if (auto Operand = ParseUnary()) - return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand)); + return std::make_unique<UnaryExprAST>(Opc, std::move(Operand)); return nullptr; } @@ -514,7 +514,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec, // Merge LHS/RHS. LHS = - llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS)); + std::make_unique<BinaryExprAST>(BinOp, std::move(LHS), std::move(RHS)); } } @@ -591,7 +591,7 @@ static std::unique_ptr<PrototypeAST> ParsePrototype() { if (Kind && ArgNames.size() != Kind) return LogErrorP("Invalid number of operands for operator"); - return llvm::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0, + return std::make_unique<PrototypeAST>(FnName, ArgNames, Kind != 0, BinaryPrecedence); } @@ -603,7 +603,7 @@ static std::unique_ptr<FunctionAST> ParseDefinition() { return nullptr; if (auto E = ParseExpression()) - return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E)); + return std::make_unique<FunctionAST>(std::move(Proto), std::move(E)); return nullptr; } @@ -611,9 +611,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() { static std::unique_ptr<FunctionAST> ParseTopLevelExpr() { if (auto E = ParseExpression()) { // Make an anonymous proto. - auto Proto = llvm::make_unique<PrototypeAST>("__anon_expr", + auto Proto = std::make_unique<PrototypeAST>("__anon_expr", std::vector<std::string>()); - return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E)); + return std::make_unique<FunctionAST>(std::move(Proto), std::move(E)); } return nullptr; } @@ -943,11 +943,11 @@ Function *FunctionAST::codegen() { static void InitializeModuleAndPassManager() { // Open a new module. - TheModule = llvm::make_unique<Module>("my cool jit", TheContext); + TheModule = std::make_unique<Module>("my cool jit", TheContext); TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout()); // Create a new pass manager attached to it. - TheFPM = llvm::make_unique<legacy::FunctionPassManager>(TheModule.get()); + TheFPM = std::make_unique<legacy::FunctionPassManager>(TheModule.get()); // Do simple "peephole" optimizations and bit-twiddling optzns. TheFPM->add(createInstructionCombiningPass()); @@ -1082,7 +1082,7 @@ int main() { fprintf(stderr, "ready> "); getNextToken(); - TheJIT = llvm::make_unique<KaleidoscopeJIT>(); + TheJIT = std::make_unique<KaleidoscopeJIT>(); InitializeModuleAndPassManager(); |