diff options
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter9/toy.cpp')
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter9/toy.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp index 19bac1a8bc7..21c8993e1a0 100644 --- a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp @@ -442,7 +442,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); } @@ -471,7 +471,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { getNextToken(); // eat identifier. if (CurTok != '(') // Simple variable ref. - return llvm::make_unique<VariableExprAST>(LitLoc, IdName); + return std::make_unique<VariableExprAST>(LitLoc, IdName); // Call. getNextToken(); // eat ( @@ -495,7 +495,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { // Eat the ')'. getNextToken(); - return llvm::make_unique<CallExprAST>(LitLoc, IdName, std::move(Args)); + return std::make_unique<CallExprAST>(LitLoc, IdName, std::move(Args)); } /// ifexpr ::= 'if' expression 'then' expression 'else' expression @@ -526,7 +526,7 @@ static std::unique_ptr<ExprAST> ParseIfExpr() { if (!Else) return nullptr; - return llvm::make_unique<IfExprAST>(IfLoc, std::move(Cond), std::move(Then), + return std::make_unique<IfExprAST>(IfLoc, std::move(Cond), std::move(Then), std::move(Else)); } @@ -572,7 +572,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)); } @@ -621,7 +621,7 @@ static std::unique_ptr<ExprAST> ParseVarExpr() { if (!Body) return nullptr; - return llvm::make_unique<VarExprAST>(std::move(VarNames), std::move(Body)); + return std::make_unique<VarExprAST>(std::move(VarNames), std::move(Body)); } /// primary @@ -662,7 +662,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; } @@ -699,7 +699,7 @@ static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec, } // Merge LHS/RHS. - LHS = llvm::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS), + LHS = std::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS), std::move(RHS)); } } @@ -779,7 +779,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>(FnLoc, FnName, ArgNames, Kind != 0, + return std::make_unique<PrototypeAST>(FnLoc, FnName, ArgNames, Kind != 0, BinaryPrecedence); } @@ -791,7 +791,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; } @@ -800,9 +800,9 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() { SourceLocation FnLoc = CurLoc; if (auto E = ParseExpression()) { // Make an anonymous proto. - auto Proto = llvm::make_unique<PrototypeAST>(FnLoc, "__anon_expr", + auto Proto = std::make_unique<PrototypeAST>(FnLoc, "__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; } @@ -1314,7 +1314,7 @@ Function *FunctionAST::codegen() { static void InitializeModule() { // 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()); } @@ -1416,7 +1416,7 @@ int main() { // Prime the first token. getNextToken(); - TheJIT = llvm::make_unique<KaleidoscopeJIT>(); + TheJIT = std::make_unique<KaleidoscopeJIT>(); InitializeModule(); @@ -1429,7 +1429,7 @@ int main() { TheModule->addModuleFlag(llvm::Module::Warning, "Dwarf Version", 2); // Construct the DIBuilder, we do this here because we need the module. - DBuilder = llvm::make_unique<DIBuilder>(*TheModule); + DBuilder = std::make_unique<DIBuilder>(*TheModule); // Create the compile unit for the module. // Currently down as "fib.ks" as a filename since we're redirecting stdin |