diff options
Diffstat (limited to 'llvm/examples/Kaleidoscope/BuildingAJIT')
10 files changed, 87 insertions, 87 deletions
diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h index 8b79f2eefd9..a7fa3afc470 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/KaleidoscopeJIT.h @@ -42,10 +42,10 @@ private: public: KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL) : ObjectLayer(ES, - []() { return llvm::make_unique<SectionMemoryManager>(); }), + []() { return std::make_unique<SectionMemoryManager>(); }), CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))), DL(std::move(DL)), Mangle(ES, this->DL), - Ctx(llvm::make_unique<LLVMContext>()) { + Ctx(std::make_unique<LLVMContext>()) { ES.getMainJITDylib().addGenerator( cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess( DL.getGlobalPrefix()))); @@ -61,7 +61,7 @@ public: if (!DL) return DL.takeError(); - return llvm::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL)); + return std::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL)); } const DataLayout &getDataLayout() const { return DL; } diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp index 8cbd5d6f2f7..b4605bae4ed 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp @@ -329,7 +329,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); } @@ -356,7 +356,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 ( @@ -380,7 +380,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 @@ -409,7 +409,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)); } @@ -455,7 +455,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)); } @@ -504,7 +504,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 @@ -545,7 +545,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; } @@ -582,7 +582,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)); } } @@ -659,7 +659,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); } @@ -671,7 +671,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; } @@ -679,9 +679,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() { static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) { if (auto E = ParseExpression()) { // Make an anonymous proto. - auto Proto = llvm::make_unique<PrototypeAST> + auto Proto = std::make_unique<PrototypeAST> (("__anon_expr" + Twine(ExprCount)).str(), 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; } @@ -1103,11 +1103,11 @@ 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->getDataLayout()); // Create a new builder for the module. - Builder = llvm::make_unique<IRBuilder<>>(*TheContext); + Builder = std::make_unique<IRBuilder<>>(*TheContext); } static void HandleDefinition() { diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h index bf89d3b7597..e9999efd37a 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/KaleidoscopeJIT.h @@ -48,11 +48,11 @@ private: public: KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL) : ObjectLayer(ES, - []() { return llvm::make_unique<SectionMemoryManager>(); }), + []() { return std::make_unique<SectionMemoryManager>(); }), CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))), OptimizeLayer(ES, CompileLayer, optimizeModule), DL(std::move(DL)), Mangle(ES, this->DL), - Ctx(llvm::make_unique<LLVMContext>()) { + Ctx(std::make_unique<LLVMContext>()) { ES.getMainJITDylib().addGenerator( cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess( DL.getGlobalPrefix()))); @@ -72,7 +72,7 @@ public: if (!DL) return DL.takeError(); - return llvm::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL)); + return std::make_unique<KaleidoscopeJIT>(std::move(*JTMB), std::move(*DL)); } Error addModule(std::unique_ptr<Module> M) { @@ -89,7 +89,7 @@ private: optimizeModule(ThreadSafeModule TSM, const MaterializationResponsibility &R) { TSM.withModuleDo([](Module &M) { // Create a function pass manager. - auto FPM = llvm::make_unique<legacy::FunctionPassManager>(&M); + auto FPM = std::make_unique<legacy::FunctionPassManager>(&M); // Add some optimizations. FPM->add(createInstructionCombiningPass()); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp index e7c3624aa04..743d50829dc 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp @@ -329,7 +329,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); } @@ -356,7 +356,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 ( @@ -380,7 +380,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 @@ -409,7 +409,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)); } @@ -455,7 +455,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)); } @@ -504,7 +504,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 @@ -545,7 +545,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; } @@ -582,7 +582,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)); } } @@ -659,7 +659,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); } @@ -671,7 +671,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; } @@ -679,9 +679,9 @@ static std::unique_ptr<FunctionAST> ParseDefinition() { static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) { if (auto E = ParseExpression()) { // Make an anonymous proto. - auto Proto = llvm::make_unique<PrototypeAST>( + auto Proto = std::make_unique<PrototypeAST>( ("__anon_expr" + Twine(ExprCount)).str(), 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; } @@ -1103,11 +1103,11 @@ 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->getDataLayout()); // Create a new builder for the module. - Builder = llvm::make_unique<IRBuilder<>>(*TheContext); + Builder = std::make_unique<IRBuilder<>>(*TheContext); } static void HandleDefinition() { diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h index 35104f926d4..add38fdb819 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/KaleidoscopeJIT.h @@ -131,7 +131,7 @@ public: private: std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) { // Create a function pass manager. - auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get()); + auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get()); // Add some optimizations. FPM->add(createInstructionCombiningPass()); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp index 2471344c6d6..e9505033106 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp @@ -329,7 +329,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); } @@ -356,7 +356,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 ( @@ -380,7 +380,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 @@ -409,7 +409,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)); } @@ -455,7 +455,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)); } @@ -504,7 +504,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 @@ -545,7 +545,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; } @@ -582,7 +582,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)); } } @@ -659,7 +659,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); } @@ -671,7 +671,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; } @@ -679,9 +679,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; } @@ -1102,7 +1102,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()); } @@ -1222,7 +1222,7 @@ int main() { fprintf(stderr, "ready> "); getNextToken(); - TheJIT = llvm::make_unique<KaleidoscopeJIT>(); + TheJIT = std::make_unique<KaleidoscopeJIT>(); InitializeModule(); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h index ee5225672fc..dd6304b7a78 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/KaleidoscopeJIT.h @@ -207,7 +207,7 @@ private: std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) { // Create a function pass manager. - auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get()); + auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get()); // Add some optimizations. FPM->add(createInstructionCombiningPass()); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp index ed8ae31ba0f..bfd57e621cd 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp @@ -314,7 +314,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); } @@ -341,7 +341,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 ( @@ -365,7 +365,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 @@ -394,7 +394,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)); } @@ -440,7 +440,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)); } @@ -489,7 +489,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 @@ -530,7 +530,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; } @@ -567,7 +567,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)); } } @@ -644,7 +644,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); } @@ -656,7 +656,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; } @@ -664,9 +664,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; } @@ -1095,7 +1095,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()); } @@ -1114,7 +1114,7 @@ irgenAndTakeOwnership(FunctionAST &FnAST, const std::string &Suffix) { static void HandleDefinition() { if (auto FnAST = ParseDefinition()) { FunctionProtos[FnAST->getProto().getName()] = - llvm::make_unique<PrototypeAST>(FnAST->getProto()); + std::make_unique<PrototypeAST>(FnAST->getProto()); ExitOnErr(TheJIT->addFunctionAST(std::move(FnAST))); } else { // Skip token for error recovery. @@ -1140,7 +1140,7 @@ static void HandleTopLevelExpression() { // Evaluate a top-level expression into an anonymous function. if (auto FnAST = ParseTopLevelExpr()) { FunctionProtos[FnAST->getName()] = - llvm::make_unique<PrototypeAST>(FnAST->getProto()); + std::make_unique<PrototypeAST>(FnAST->getProto()); if (FnAST->codegen()) { // JIT the module containing the anonymous expression, keeping a handle so // we can free it later. @@ -1227,7 +1227,7 @@ int main() { fprintf(stderr, "ready> "); getNextToken(); - TheJIT = llvm::make_unique<KaleidoscopeJIT>(); + TheJIT = std::make_unique<KaleidoscopeJIT>(); InitializeModule(); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h index 5cc64da68cc..1d9c98a9d72 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/KaleidoscopeJIT.h @@ -224,7 +224,7 @@ private: std::unique_ptr<Module> optimizeModule(std::unique_ptr<Module> M) { // Create a function pass manager. - auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get()); + auto FPM = std::make_unique<legacy::FunctionPassManager>(M.get()); // Add some optimizations. FPM->add(createInstructionCombiningPass()); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp index 415cc751277..eff61fb954d 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter5/toy.cpp @@ -331,7 +331,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); } @@ -358,7 +358,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 ( @@ -382,7 +382,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 @@ -411,7 +411,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)); } @@ -457,7 +457,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)); } @@ -506,7 +506,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 @@ -547,7 +547,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; } @@ -584,7 +584,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)); } } @@ -661,7 +661,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); } @@ -673,7 +673,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; } @@ -684,12 +684,12 @@ static std::unique_ptr<FunctionAST> ParseTopLevelExpr() { auto PEArgs = std::vector<std::unique_ptr<ExprAST>>(); PEArgs.push_back(std::move(E)); auto PrintExpr = - llvm::make_unique<CallExprAST>("printExprResult", std::move(PEArgs)); + std::make_unique<CallExprAST>("printExprResult", std::move(PEArgs)); // 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), + return std::make_unique<FunctionAST>(std::move(Proto), std::move(PrintExpr)); } return nullptr; @@ -1119,7 +1119,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()); } @@ -1138,7 +1138,7 @@ irgenAndTakeOwnership(FunctionAST &FnAST, const std::string &Suffix) { static void HandleDefinition() { if (auto FnAST = ParseDefinition()) { FunctionProtos[FnAST->getProto().getName()] = - llvm::make_unique<PrototypeAST>(FnAST->getProto()); + std::make_unique<PrototypeAST>(FnAST->getProto()); ExitOnErr(TheJIT->addFunctionAST(std::move(FnAST))); } else { // Skip token for error recovery. @@ -1164,7 +1164,7 @@ static void HandleTopLevelExpression() { // Evaluate a top-level expression into an anonymous function. if (auto FnAST = ParseTopLevelExpr()) { FunctionProtos[FnAST->getName()] = - llvm::make_unique<PrototypeAST>(FnAST->getProto()); + std::make_unique<PrototypeAST>(FnAST->getProto()); if (FnAST->codegen()) { // JIT the module containing the anonymous expression, keeping a handle so // we can free it later. @@ -1253,7 +1253,7 @@ std::unique_ptr<FDRPCChannel> connect() { exit(1); } - return llvm::make_unique<FDRPCChannel>(sockfd, sockfd); + return std::make_unique<FDRPCChannel>(sockfd, sockfd); } //===----------------------------------------------------------------------===// @@ -1281,11 +1281,11 @@ int main(int argc, char *argv[]) { ExecutionSession ES; auto TCPChannel = connect(); auto Remote = ExitOnErr(MyRemote::Create(*TCPChannel, ES)); - TheJIT = llvm::make_unique<KaleidoscopeJIT>(ES, *Remote); + TheJIT = std::make_unique<KaleidoscopeJIT>(ES, *Remote); // Automatically inject a definition for 'printExprResult'. FunctionProtos["printExprResult"] = - llvm::make_unique<PrototypeAST>("printExprResult", + std::make_unique<PrototypeAST>("printExprResult", std::vector<std::string>({"Val"})); // Prime the first token. |