llvm.org GIT mirror llvm / 114087c
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369013 91177308-0d34-0410-b5e6-96231b3b80d8 Jonas Devlieghere a month ago
430 changed file(s) with 1485 addition(s) and 1485 deletion(s). Raw diff Collapse all Expand all
173173
174174 ExecutionSession ES;
175175 RTDyldObjectLinkingLayer ObjLinkingLayer(
176 ES, []() { return llvm::make_unique(); });
176 ES, []() { return std::make_unique(); });
177177 CXXCompileLayer CXXLayer(ES, ObjLinkingLayer);
178178
179179 // Create JITDylib "A" and add code to it using the CXX layer.
452452
453453 .. code-block:: c++
454454
455 ThreadSafeContext TSCtx(llvm::make_unique());
455 ThreadSafeContext TSCtx(std::make_unique());
456456
457457 ThreadSafeModules can be constructed from a pair of a std::unique_ptr
458458 and a ThreadSafeContext value. ThreadSafeContext values may be shared between
461461 .. code-block:: c++
462462
463463 ThreadSafeModule TSM1(
464 llvm::make_unique("M1", *TSCtx.getContext()), TSCtx);
464 std::make_unique("M1", *TSCtx.getContext()), TSCtx);
465465
466466 ThreadSafeModule TSM2(
467 llvm::make_unique("M2", *TSCtx.getContext()), TSCtx);
467 std::make_unique("M2", *TSCtx.getContext()), TSCtx);
468468
469469 Before using a ThreadSafeContext, clients should ensure that either the context
470470 is only accessible on the current thread, or that the context is locked. In the
475475
476476 .. code-block:: c++
477477
478 ThreadSafeContext TSCtx(llvm::make_unique());
478 ThreadSafeContext TSCtx(std::make_unique());
479479
480480 ThreadPool TP(NumThreads);
481481 JITStack J;
518518 // Maximize concurrency opportunities by loading every module on a
519519 // separate context.
520520 for (const auto &IRPath : IRPaths) {
521 auto Ctx = llvm::make_unique();
522 auto M = llvm::make_unique("M", *Ctx);
521 auto Ctx = std::make_unique();
522 auto M = std::make_unique("M", *Ctx);
523523 CompileLayer.add(ES.getMainJITDylib(),
524524 ThreadSafeModule(std::move(M), std::move(Ctx)));
525525 }
530530 .. code-block:: c++
531531
532532 // Save memory by using one context for all Modules:
533 ThreadSafeContext TSCtx(llvm::make_unique());
533 ThreadSafeContext TSCtx(std::make_unique());
534534 for (const auto &IRPath : IRPaths) {
535535 ThreadSafeModule TSM(parsePath(IRPath, *TSCtx.getContext()), TSCtx);
536536 CompileLayer.add(ES.getMainJITDylib(), ThreadSafeModule(std::move(TSM));
137137 public:
138138 KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
139139 : ObjectLayer(ES,
140 []() { return llvm::make_unique(); }),
140 []() { return std::make_unique(); }),
141141 CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
142142 DL(std::move(DL)), Mangle(ES, this->DL),
143 Ctx(llvm::make_unique()) {
143 Ctx(std::make_unique()) {
144144 ES.getMainJITDylib().setGenerator(
145145 cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
146146 }
194194 if (!DL)
195195 return DL.takeError();
196196
197 return llvm::make_unique(std::move(*JTMB), std::move(*DL));
197 return std::make_unique(std::move(*JTMB), std::move(*DL));
198198 }
199199
200200 const DataLayout &getDataLayout() const { return DL; }
7070
7171 KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
7272 : ObjectLayer(ES,
73 []() { return llvm::make_unique(); }),
73 []() { return std::make_unique(); }),
7474 CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
7575 TransformLayer(ES, CompileLayer, optimizeModule),
7676 DL(std::move(DL)), Mangle(ES, this->DL),
77 Ctx(llvm::make_unique()) {
77 Ctx(std::make_unique()) {
7878 ES.getMainJITDylib().setGenerator(
7979 cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(DL)));
8080 }
101101 static Expected
102102 optimizeModule(ThreadSafeModule M, const MaterializationResponsibility &R) {
103103 // Create a function pass manager.
104 auto FPM = llvm::make_unique(M.get());
104 auto FPM = std::make_unique(M.get());
105105
106106 // Add some optimizations.
107107 FPM->add(createInstructionCombiningPass());
212212 .. code-block:: c++
213213
214214 Error IRLayer::add(JITDylib &JD, ThreadSafeModule TSM, VModuleKey K) {
215 return JD.define(llvm::make_unique(
215 return JD.define(std::make_unique(
216216 *this, std::move(K), std::move(TSM)));
217217 }
218218
154154
155155 .. code-block:: c++
156156
157 auto LHS = llvm::make_unique("x");
158 auto RHS = llvm::make_unique("y");
157 auto LHS = std::make_unique("x");
158 auto RHS = std::make_unique("y");
159159 auto Result = std::make_unique('+', std::move(LHS),
160160 std::move(RHS));
161161
209209
210210 /// numberexpr ::= number
211211 static std::unique_ptr ParseNumberExpr() {
212 auto Result = llvm::make_unique(NumVal);
212 auto Result = std::make_unique(NumVal);
213213 getNextToken(); // consume the number
214214 return std::move(Result);
215215 }
275275 getNextToken(); // eat identifier.
276276
277277 if (CurTok != '(') // Simple variable ref.
278 return llvm::make_unique(IdName);
278 return std::make_unique(IdName);
279279
280280 // Call.
281281 getNextToken(); // eat (
299299 // Eat the ')'.
300300 getNextToken();
301301
302 return llvm::make_unique(IdName, std::move(Args));
302 return std::make_unique(IdName, std::move(Args));
303303 }
304304
305305 This routine follows the same style as the other routines. (It expects
502502 }
503503
504504 // Merge LHS/RHS.
505 LHS = llvm::make_unique(BinOp, std::move(LHS),
505 LHS = std::make_unique(BinOp, std::move(LHS),
506506 std::move(RHS));
507507 } // loop around to the top of the while loop.
508508 }
532532 return nullptr;
533533 }
534534 // Merge LHS/RHS.
535 LHS = llvm::make_unique(BinOp, std::move(LHS),
535 LHS = std::make_unique(BinOp, std::move(LHS),
536536 std::move(RHS));
537537 } // loop around to the top of the while loop.
538538 }
592592 // success.
593593 getNextToken(); // eat ')'.
594594
595 return llvm::make_unique(FnName, std::move(ArgNames));
595 return std::make_unique(FnName, std::move(ArgNames));
596596 }
597597
598598 Given this, a function definition is very simple, just a prototype plus
607607 if (!Proto) return nullptr;
608608
609609 if (auto E = ParseExpression())
610 return llvm::make_unique(std::move(Proto), std::move(E));
610 return std::make_unique(std::move(Proto), std::move(E));
611611 return nullptr;
612612 }
613613
633633 static std::unique_ptr ParseTopLevelExpr() {
634634 if (auto E = ParseExpression()) {
635635 // Make an anonymous proto.
636 auto Proto = llvm::make_unique("", std::vector());
637 return llvm::make_unique(std::move(Proto), std::move(E));
636 auto Proto = std::make_unique("", std::vector());
637 return std::make_unique(std::move(Proto), std::move(E));
638638 }
639639 return nullptr;
640640 }
140140
141141 void InitializeModuleAndPassManager(void) {
142142 // Open a new module.
143 TheModule = llvm::make_unique("my cool jit", TheContext);
143 TheModule = std::make_unique("my cool jit", TheContext);
144144
145145 // Create a new pass manager attached to it.
146 TheFPM = llvm::make_unique(TheModule.get());
146 TheFPM = std::make_unique(TheModule.get());
147147
148148 // Do simple "peephole" optimizations and bit-twiddling optzns.
149149 TheFPM->add(createInstructionCombiningPass());
258258 fprintf(stderr, "ready> ");
259259 getNextToken();
260260
261 TheJIT = llvm::make_unique();
261 TheJIT = std::make_unique();
262262
263263 // Run the main "interpreter loop" now.
264264 MainLoop();
272272
273273 void InitializeModuleAndPassManager(void) {
274274 // Open a new module.
275 TheModule = llvm::make_unique("my cool jit", TheContext);
275 TheModule = std::make_unique("my cool jit", TheContext);
276276 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
277277
278278 // Create a new pass manager attached to it.
279 TheFPM = llvm::make_unique(TheModule.get());
279 TheFPM = std::make_unique(TheModule.get());
280280 ...
281281
282282 The KaleidoscopeJIT class is a simple JIT built specifically for these
145145 if (!Else)
146146 return nullptr;
147147
148 return llvm::make_unique(std::move(Cond), std::move(Then),
148 return std::make_unique(std::move(Cond), std::move(Then),
149149 std::move(Else));
150150 }
151151
559559 if (!Body)
560560 return nullptr;
561561
562 return llvm::make_unique(IdName, std::move(Start),
562 return std::make_unique(IdName, std::move(Start),
563563 std::move(End), std::move(Step),
564564 std::move(Body));
565565 }
219219 if (Kind && ArgNames.size() != Kind)
220220 return LogErrorP("Invalid number of operands for operator");
221221
222 return llvm::make_unique(FnName, std::move(ArgNames), Kind != 0,
222 return std::make_unique(FnName, std::move(ArgNames), Kind != 0,
223223 BinaryPrecedence);
224224 }
225225
347347 int Opc = CurTok;
348348 getNextToken();
349349 if (auto Operand = ParseUnary())
350 return llvm::make_unique(Opc, std::move(Operand));
350 return std::make_unique(Opc, std::move(Operand));
351351 return nullptr;
352352 }
353353
779779 if (!Body)
780780 return nullptr;
781781
782 return llvm::make_unique(std::move(VarNames),
782 return std::make_unique(std::move(VarNames),
783783 std::move(Body));
784784 }
785785
7676
7777 .. code-block:: udiff
7878
79 - auto Proto = llvm::make_unique("", std::vector());
80 + auto Proto = llvm::make_unique("main", std::vector());
79 - auto Proto = std::make_unique("", std::vector());
80 + auto Proto = std::make_unique("main", std::vector());
8181
8282 just with the simple change of giving it a name.
8383
324324
325325 .. code-block:: c++
326326
327 LHS = llvm::make_unique(BinLoc, BinOp, std::move(LHS),
327 LHS = std::make_unique(BinLoc, BinOp, std::move(LHS),
328328 std::move(RHS));
329329
330330 giving us locations for each of our expressions and variables.
19031903
19041904 // Make the module, which holds all the code.
19051905 std::unique_ptr Owner =
1906 llvm::make_unique("my cool jit", Context);
1906 std::make_unique("my cool jit", Context);
19071907 llvm::Module *module = Owner.get();
19081908
19091909 std::unique_ptr MemMgr(new llvm::SectionMemoryManager());
6262 LLVMContext Context;
6363
6464 // Create some module to put our function into it.
65 std::unique_ptr Owner = make_unique("test", Context);
65 std::unique_ptr Owner = std::make_unique("test", Context);
6666 Module *M = Owner.get();
6767
6868 // Create the add1 function entry and insert this entry into module M. The
1919 ExitOnError ExitOnErr;
2020
2121 ThreadSafeModule createDemoModule() {
22 auto Context = llvm::make_unique();
23 auto M = make_unique("test", *Context);
22 auto Context = std::make_unique();
23 auto M = std::make_unique("test", *Context);
2424
2525 // Create the add1 function entry and insert this entry into module M. The
2626 // function will have a return type of "int" and take an argument of "int".
4141 public:
4242 KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
4343 : ObjectLayer(ES,
44 []() { return llvm::make_unique(); }),
44 []() { return std::make_unique(); }),
4545 CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
4646 DL(std::move(DL)), Mangle(ES, this->DL),
47 Ctx(llvm::make_unique()) {
47 Ctx(std::make_unique()) {
4848 ES.getMainJITDylib().addGenerator(
4949 cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
5050 DL.getGlobalPrefix())));
6060 if (!DL)
6161 return DL.takeError();
6262
63 return llvm::make_unique(std::move(*JTMB), std::move(*DL));
63 return std::make_unique(std::move(*JTMB), std::move(*DL));
6464 }
6565
6666 const DataLayout &getDataLayout() const { return DL; }
328328
329329 /// numberexpr ::= number
330330 static std::unique_ptr ParseNumberExpr() {
331 auto Result = llvm::make_unique(NumVal);
331 auto Result = std::make_unique(NumVal);
332332 getNextToken(); // consume the number
333333 return std::move(Result);
334334 }
355355 getNextToken(); // eat identifier.
356356
357357 if (CurTok != '(') // Simple variable ref.
358 return llvm::make_unique(IdName);
358 return std::make_unique(IdName);
359359
360360 // Call.
361361 getNextToken(); // eat (
379379 // Eat the ')'.
380380 getNextToken();
381381
382 return llvm::make_unique(IdName, std::move(Args));
382 return std::make_unique(IdName, std::move(Args));
383383 }
384384
385385 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
408408 if (!Else)
409409 return nullptr;
410410
411 return llvm::make_unique(std::move(Cond), std::move(Then),
411 return std::make_unique(std::move(Cond), std::move(Then),
412412 std::move(Else));
413413 }
414414
454454 if (!Body)
455455 return nullptr;
456456
457 return llvm::make_unique(IdName, std::move(Start), std::move(End),
457 return std::make_unique(IdName, std::move(Start), std::move(End),
458458 std::move(Step), std::move(Body));
459459 }
460460
503503 if (!Body)
504504 return nullptr;
505505
506 return llvm::make_unique(std::move(VarNames), std::move(Body));
506 return std::make_unique(std::move(VarNames), std::move(Body));
507507 }
508508
509509 /// primary
544544 int Opc = CurTok;
545545 getNextToken();
546546 if (auto Operand = ParseUnary())
547 return llvm::make_unique(Opc, std::move(Operand));
547 return std::make_unique(Opc, std::move(Operand));
548548 return nullptr;
549549 }
550550
581581
582582 // Merge LHS/RHS.
583583 LHS =
584 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
584 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
585585 }
586586 }
587587
658658 if (Kind && ArgNames.size() != Kind)
659659 return LogErrorP("Invalid number of operands for operator");
660660
661 return llvm::make_unique(FnName, ArgNames, Kind != 0,
661 return std::make_unique(FnName, ArgNames, Kind != 0,
662662 BinaryPrecedence);
663663 }
664664
670670 return nullptr;
671671
672672 if (auto E = ParseExpression())
673 return llvm::make_unique(std::move(Proto), std::move(E));
673 return std::make_unique(std::move(Proto), std::move(E));
674674 return nullptr;
675675 }
676676
678678 static std::unique_ptr ParseTopLevelExpr(unsigned ExprCount) {
679679 if (auto E = ParseExpression()) {
680680 // Make an anonymous proto.
681 auto Proto = llvm::make_unique
681 auto Proto = std::make_unique
682682 (("__anon_expr" + Twine(ExprCount)).str(), std::vector());
683 return llvm::make_unique(std::move(Proto), std::move(E));
683 return std::make_unique(std::move(Proto), std::move(E));
684684 }
685685 return nullptr;
686686 }
11021102
11031103 static void InitializeModule() {
11041104 // Open a new module.
1105 TheModule = llvm::make_unique("my cool jit", *TheContext);
1105 TheModule = std::make_unique("my cool jit", *TheContext);
11061106 TheModule->setDataLayout(TheJIT->getDataLayout());
11071107
11081108 // Create a new builder for the module.
1109 Builder = llvm::make_unique>(*TheContext);
1109 Builder = std::make_unique>(*TheContext);
11101110 }
11111111
11121112 static void HandleDefinition() {
4747 public:
4848 KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
4949 : ObjectLayer(ES,
50 []() { return llvm::make_unique(); }),
50 []() { return std::make_unique(); }),
5151 CompileLayer(ES, ObjectLayer, ConcurrentIRCompiler(std::move(JTMB))),
5252 OptimizeLayer(ES, CompileLayer, optimizeModule),
5353 DL(std::move(DL)), Mangle(ES, this->DL),
54 Ctx(llvm::make_unique()) {
54 Ctx(std::make_unique()) {
5555 ES.getMainJITDylib().addGenerator(
5656 cantFail(DynamicLibrarySearchGenerator::GetForCurrentProcess(
5757 DL.getGlobalPrefix())));
7171 if (!DL)
7272 return DL.takeError();
7373
74 return llvm::make_unique(std::move(*JTMB), std::move(*DL));
74 return std::make_unique(std::move(*JTMB), std::move(*DL));
7575 }
7676
7777 Error addModule(std::unique_ptr M) {
8888 optimizeModule(ThreadSafeModule TSM, const MaterializationResponsibility &R) {
8989 TSM.withModuleDo([](Module &M) {
9090 // Create a function pass manager.
91 auto FPM = llvm::make_unique(&M);
91 auto FPM = std::make_unique(&M);
9292
9393 // Add some optimizations.
9494 FPM->add(createInstructionCombiningPass());
328328
329329 /// numberexpr ::= number
330330 static std::unique_ptr ParseNumberExpr() {
331 auto Result = llvm::make_unique(NumVal);
331 auto Result = std::make_unique(NumVal);
332332 getNextToken(); // consume the number
333333 return std::move(Result);
334334 }
355355 getNextToken(); // eat identifier.
356356
357357 if (CurTok != '(') // Simple variable ref.
358 return llvm::make_unique(IdName);
358 return std::make_unique(IdName);
359359
360360 // Call.
361361 getNextToken(); // eat (
379379 // Eat the ')'.
380380 getNextToken();
381381
382 return llvm::make_unique(IdName, std::move(Args));
382 return std::make_unique(IdName, std::move(Args));
383383 }
384384
385385 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
408408 if (!Else)
409409 return nullptr;
410410
411 return llvm::make_unique(std::move(Cond), std::move(Then),
411 return std::make_unique(std::move(Cond), std::move(Then),
412412 std::move(Else));
413413 }
414414
454454 if (!Body)
455455 return nullptr;
456456
457 return llvm::make_unique(IdName, std::move(Start), std::move(End),
457 return std::make_unique(IdName, std::move(Start), std::move(End),
458458 std::move(Step), std::move(Body));
459459 }
460460
503503 if (!Body)
504504 return nullptr;
505505
506 return llvm::make_unique(std::move(VarNames), std::move(Body));
506 return std::make_unique(std::move(VarNames), std::move(Body));
507507 }
508508
509509 /// primary
544544 int Opc = CurTok;
545545 getNextToken();
546546 if (auto Operand = ParseUnary())
547 return llvm::make_unique(Opc, std::move(Operand));
547 return std::make_unique(Opc, std::move(Operand));
548548 return nullptr;
549549 }
550550
581581
582582 // Merge LHS/RHS.
583583 LHS =
584 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
584 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
585585 }
586586 }
587587
658658 if (Kind && ArgNames.size() != Kind)
659659 return LogErrorP("Invalid number of operands for operator");
660660
661 return llvm::make_unique(FnName, ArgNames, Kind != 0,
661 return std::make_unique(FnName, ArgNames, Kind != 0,
662662 BinaryPrecedence);
663663 }
664664
670670 return nullptr;
671671
672672 if (auto E = ParseExpression())
673 return llvm::make_unique(std::move(Proto), std::move(E));
673 return std::make_unique(std::move(Proto), std::move(E));
674674 return nullptr;
675675 }
676676
678678 static std::unique_ptr ParseTopLevelExpr(unsigned ExprCount) {
679679 if (auto E = ParseExpression()) {
680680 // Make an anonymous proto.
681 auto Proto = llvm::make_unique(
681 auto Proto = std::make_unique(
682682 ("__anon_expr" + Twine(ExprCount)).str(), std::vector());
683 return llvm::make_unique(std::move(Proto), std::move(E));
683 return std::make_unique(std::move(Proto), std::move(E));
684684 }
685685 return nullptr;
686686 }
11021102
11031103 static void InitializeModule() {
11041104 // Open a new module.
1105 TheModule = llvm::make_unique("my cool jit", *TheContext);
1105 TheModule = std::make_unique("my cool jit", *TheContext);
11061106 TheModule->setDataLayout(TheJIT->getDataLayout());
11071107
11081108 // Create a new builder for the module.
1109 Builder = llvm::make_unique>(*TheContext);
1109 Builder = std::make_unique>(*TheContext);
11101110 }
11111111
11121112 static void HandleDefinition() {
130130 private:
131131 std::unique_ptr optimizeModule(std::unique_ptr M) {
132132 // Create a function pass manager.
133 auto FPM = llvm::make_unique(M.get());
133 auto FPM = std::make_unique(M.get());
134134
135135 // Add some optimizations.
136136 FPM->add(createInstructionCombiningPass());
328328
329329 /// numberexpr ::= number
330330 static std::unique_ptr ParseNumberExpr() {
331 auto Result = llvm::make_unique(NumVal);
331 auto Result = std::make_unique(NumVal);
332332 getNextToken(); // consume the number
333333 return std::move(Result);
334334 }
355355 getNextToken(); // eat identifier.
356356
357357 if (CurTok != '(') // Simple variable ref.
358 return llvm::make_unique(IdName);
358 return std::make_unique(IdName);
359359
360360 // Call.
361361 getNextToken(); // eat (
379379 // Eat the ')'.
380380 getNextToken();
381381
382 return llvm::make_unique(IdName, std::move(Args));
382 return std::make_unique(IdName, std::move(Args));
383383 }
384384
385385 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
408408 if (!Else)
409409 return nullptr;
410410
411 return llvm::make_unique(std::move(Cond), std::move(Then),
411 return std::make_unique(std::move(Cond), std::move(Then),
412412 std::move(Else));
413413 }
414414
454454 if (!Body)
455455 return nullptr;
456456
457 return llvm::make_unique(IdName, std::move(Start), std::move(End),
457 return std::make_unique(IdName, std::move(Start), std::move(End),
458458 std::move(Step), std::move(Body));
459459 }
460460
503503 if (!Body)
504504 return nullptr;
505505
506 return llvm::make_unique(std::move(VarNames), std::move(Body));
506 return std::make_unique(std::move(VarNames), std::move(Body));
507507 }
508508
509509 /// primary
544544 int Opc = CurTok;
545545 getNextToken();
546546 if (auto Operand = ParseUnary())
547 return llvm::make_unique(Opc, std::move(Operand));
547 return std::make_unique(Opc, std::move(Operand));
548548 return nullptr;
549549 }
550550
581581
582582 // Merge LHS/RHS.
583583 LHS =
584 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
584 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
585585 }
586586 }
587587
658658 if (Kind && ArgNames.size() != Kind)
659659 return LogErrorP("Invalid number of operands for operator");
660660
661 return llvm::make_unique(FnName, ArgNames, Kind != 0,
661 return std::make_unique(FnName, ArgNames, Kind != 0,
662662 BinaryPrecedence);
663663 }
664664
670670 return nullptr;
671671
672672 if (auto E = ParseExpression())
673 return llvm::make_unique(std::move(Proto), std::move(E));
673 return std::make_unique(std::move(Proto), std::move(E));
674674 return nullptr;
675675 }
676676
678678 static std::unique_ptr ParseTopLevelExpr() {
679679 if (auto E = ParseExpression()) {
680680 // Make an anonymous proto.
681 auto Proto = llvm::make_unique("__anon_expr",
681 auto Proto = std::make_unique("__anon_expr",
682682 std::vector());
683 return llvm::make_unique(std::move(Proto), std::move(E));
683 return std::make_unique(std::move(Proto), std::move(E));
684684 }
685685 return nullptr;
686686 }
11011101
11021102 static void InitializeModule() {
11031103 // Open a new module.
1104 TheModule = llvm::make_unique("my cool jit", TheContext);
1104 TheModule = std::make_unique("my cool jit", TheContext);
11051105 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
11061106 }
11071107
12211221 fprintf(stderr, "ready> ");
12221222 getNextToken();
12231223
1224 TheJIT = llvm::make_unique();
1224 TheJIT = std::make_unique();
12251225
12261226 InitializeModule();
12271227
206206
207207 std::unique_ptr optimizeModule(std::unique_ptr M) {
208208 // Create a function pass manager.
209 auto FPM = llvm::make_unique(M.get());
209 auto FPM = std::make_unique(M.get());
210210
211211 // Add some optimizations.
212212 FPM->add(createInstructionCombiningPass());
313313
314314 /// numberexpr ::= number
315315 static std::unique_ptr ParseNumberExpr() {
316 auto Result = llvm::make_unique(NumVal);
316 auto Result = std::make_unique(NumVal);
317317 getNextToken(); // consume the number
318318 return std::move(Result);
319319 }
340340 getNextToken(); // eat identifier.
341341
342342 if (CurTok != '(') // Simple variable ref.
343 return llvm::make_unique(IdName);
343 return std::make_unique(IdName);
344344
345345 // Call.
346346 getNextToken(); // eat (
364364 // Eat the ')'.
365365 getNextToken();
366366
367 return llvm::make_unique(IdName, std::move(Args));
367 return std::make_unique(IdName, std::move(Args));
368368 }
369369
370370 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
393393 if (!Else)
394394 return nullptr;
395395
396 return llvm::make_unique(std::move(Cond), std::move(Then),
396 return std::make_unique(std::move(Cond), std::move(Then),
397397 std::move(Else));
398398 }
399399
439439 if (!Body)
440440 return nullptr;
441441
442 return llvm::make_unique(IdName, std::move(Start), std::move(End),
442 return std::make_unique(IdName, std::move(Start), std::move(End),
443443 std::move(Step), std::move(Body));
444444 }
445445
488488 if (!Body)
489489 return nullptr;
490490
491 return llvm::make_unique(std::move(VarNames), std::move(Body));
491 return std::make_unique(std::move(VarNames), std::move(Body));
492492 }
493493
494494 /// primary
529529 int Opc = CurTok;
530530 getNextToken();
531531 if (auto Operand = ParseUnary())
532 return llvm::make_unique(Opc, std::move(Operand));
532 return std::make_unique(Opc, std::move(Operand));
533533 return nullptr;
534534 }
535535
566566
567567 // Merge LHS/RHS.
568568 LHS =
569 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
569 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
570570 }
571571 }
572572
643643 if (Kind && ArgNames.size() != Kind)
644644 return LogErrorP("Invalid number of operands for operator");
645645
646 return llvm::make_unique(FnName, ArgNames, Kind != 0,
646 return std::make_unique(FnName, ArgNames, Kind != 0,
647647 BinaryPrecedence);
648648 }
649649
655655 return nullptr;
656656
657657 if (auto E = ParseExpression())
658 return llvm::make_unique(std::move(Proto), std::move(E));
658 return std::make_unique(std::move(Proto), std::move(E));
659659 return nullptr;
660660 }
661661
663663 static std::unique_ptr ParseTopLevelExpr() {
664664 if (auto E = ParseExpression()) {
665665 // Make an anonymous proto.
666 auto Proto = llvm::make_unique("__anon_expr",
666 auto Proto = std::make_unique("__anon_expr",
667667 std::vector());
668 return llvm::make_unique(std::move(Proto), std::move(E));
668 return std::make_unique(std::move(Proto), std::move(E));
669669 }
670670 return nullptr;
671671 }
10941094
10951095 static void InitializeModule() {
10961096 // Open a new module.
1097 TheModule = llvm::make_unique("my cool jit", TheContext);
1097 TheModule = std::make_unique("my cool jit", TheContext);
10981098 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
10991099 }
11001100
11131113 static void HandleDefinition() {
11141114 if (auto FnAST = ParseDefinition()) {
11151115 FunctionProtos[FnAST->getProto().getName()] =
1116 llvm::make_unique(FnAST->getProto());
1116 std::make_unique(FnAST->getProto());
11171117 ExitOnErr(TheJIT->addFunctionAST(std::move(FnAST)));
11181118 } else {
11191119 // Skip token for error recovery.
11391139 // Evaluate a top-level expression into an anonymous function.
11401140 if (auto FnAST = ParseTopLevelExpr()) {
11411141 FunctionProtos[FnAST->getName()] =
1142 llvm::make_unique(FnAST->getProto());
1142 std::make_unique(FnAST->getProto());
11431143 if (FnAST->codegen()) {
11441144 // JIT the module containing the anonymous expression, keeping a handle so
11451145 // we can free it later.
12261226 fprintf(stderr, "ready> ");
12271227 getNextToken();
12281228
1229 TheJIT = llvm::make_unique();
1229 TheJIT = std::make_unique();
12301230
12311231 InitializeModule();
12321232
223223
224224 std::unique_ptr optimizeModule(std::unique_ptr M) {
225225 // Create a function pass manager.
226 auto FPM = llvm::make_unique(M.get());
226 auto FPM = std::make_unique(M.get());
227227
228228 // Add some optimizations.
229229 FPM->add(createInstructionCombiningPass());
330330
331331 /// numberexpr ::= number
332332 static std::unique_ptr ParseNumberExpr() {
333 auto Result = llvm::make_unique(NumVal);
333 auto Result = std::make_unique(NumVal);
334334 getNextToken(); // consume the number
335335 return std::move(Result);
336336 }
357357 getNextToken(); // eat identifier.
358358
359359 if (CurTok != '(') // Simple variable ref.
360 return llvm::make_unique(IdName);
360 return std::make_unique(IdName);
361361
362362 // Call.
363363 getNextToken(); // eat (
381381 // Eat the ')'.
382382 getNextToken();
383383
384 return llvm::make_unique(IdName, std::move(Args));
384 return std::make_unique(IdName, std::move(Args));
385385 }
386386
387387 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
410410 if (!Else)
411411 return nullptr;
412412
413 return llvm::make_unique(std::move(Cond), std::move(Then),
413 return std::make_unique(std::move(Cond), std::move(Then),
414414 std::move(Else));
415415 }
416416
456456 if (!Body)
457457 return nullptr;
458458
459 return llvm::make_unique(IdName, std::move(Start), std::move(End),
459 return std::make_unique(IdName, std::move(Start), std::move(End),
460460 std::move(Step), std::move(Body));
461461 }
462462
505505 if (!Body)
506506 return nullptr;
507507
508 return llvm::make_unique(std::move(VarNames), std::move(Body));
508 return std::make_unique(std::move(VarNames), std::move(Body));
509509 }
510510
511511 /// primary
546546 int Opc = CurTok;
547547 getNextToken();
548548 if (auto Operand = ParseUnary())
549 return llvm::make_unique(Opc, std::move(Operand));
549 return std::make_unique(Opc, std::move(Operand));
550550 return nullptr;
551551 }
552552
583583
584584 // Merge LHS/RHS.
585585 LHS =
586 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
586 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
587587 }
588588 }
589589
660660 if (Kind && ArgNames.size() != Kind)
661661 return LogErrorP("Invalid number of operands for operator");
662662
663 return llvm::make_unique(FnName, ArgNames, Kind != 0,
663 return std::make_unique(FnName, ArgNames, Kind != 0,
664664 BinaryPrecedence);
665665 }
666666
672672 return nullptr;
673673
674674 if (auto E = ParseExpression())
675 return llvm::make_unique(std::move(Proto), std::move(E));
675 return std::make_unique(std::move(Proto), std::move(E));
676676 return nullptr;
677677 }
678678
683683 auto PEArgs = std::vector>();
684684 PEArgs.push_back(std::move(E));
685685 auto PrintExpr =
686 llvm::make_unique("printExprResult", std::move(PEArgs));
686 std::make_unique("printExprResult", std::move(PEArgs));
687687
688688 // Make an anonymous proto.
689 auto Proto = llvm::make_unique("__anon_expr",
689 auto Proto = std::make_unique("__anon_expr",
690690 std::vector());
691 return llvm::make_unique(std::move(Proto),
691 return std::make_unique(std::move(Proto),
692692 std::move(PrintExpr));
693693 }
694694 return nullptr;
11181118
11191119 static void InitializeModule() {
11201120 // Open a new module.
1121 TheModule = llvm::make_unique("my cool jit", TheContext);
1121 TheModule = std::make_unique("my cool jit", TheContext);
11221122 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
11231123 }
11241124
11371137 static void HandleDefinition() {
11381138 if (auto FnAST = ParseDefinition()) {
11391139 FunctionProtos[FnAST->getProto().getName()] =
1140 llvm::make_unique(FnAST->getProto());
1140 std::make_unique(FnAST->getProto());
11411141 ExitOnErr(TheJIT->addFunctionAST(std::move(FnAST)));
11421142 } else {
11431143 // Skip token for error recovery.
11631163 // Evaluate a top-level expression into an anonymous function.
11641164 if (auto FnAST = ParseTopLevelExpr()) {
11651165 FunctionProtos[FnAST->getName()] =
1166 llvm::make_unique(FnAST->getProto());
1166 std::make_unique(FnAST->getProto());
11671167 if (FnAST->codegen()) {
11681168 // JIT the module containing the anonymous expression, keeping a handle so
11691169 // we can free it later.
12521252 exit(1);
12531253 }
12541254
1255 return llvm::make_unique(sockfd, sockfd);
1255 return std::make_unique(sockfd, sockfd);
12561256 }
12571257
12581258 //===----------------------------------------------------------------------===//
12801280 ExecutionSession ES;
12811281 auto TCPChannel = connect();
12821282 auto Remote = ExitOnErr(MyRemote::Create(*TCPChannel, ES));
1283 TheJIT = llvm::make_unique(ES, *Remote);
1283 TheJIT = std::make_unique(ES, *Remote);
12841284
12851285 // Automatically inject a definition for 'printExprResult'.
12861286 FunctionProtos["printExprResult"] =
1287 llvm::make_unique("printExprResult",
1287 std::make_unique("printExprResult",
12881288 std::vector({"Val"}));
12891289
12901290 // Prime the first token.
196196
197197 /// numberexpr ::= number
198198 static std::unique_ptr ParseNumberExpr() {
199 auto Result = llvm::make_unique(NumVal);
199 auto Result = std::make_unique(NumVal);
200200 getNextToken(); // consume the number
201201 return std::move(Result);
202202 }
223223 getNextToken(); // eat identifier.
224224
225225 if (CurTok != '(') // Simple variable ref.
226 return llvm::make_unique(IdName);
226 return std::make_unique(IdName);
227227
228228 // Call.
229229 getNextToken(); // eat (
247247 // Eat the ')'.
248248 getNextToken();
249249
250 return llvm::make_unique(IdName, std::move(Args));
250 return std::make_unique(IdName, std::move(Args));
251251 }
252252
253253 /// primary
299299 }
300300
301301 // Merge LHS/RHS.
302 LHS = llvm::make_unique(BinOp, std::move(LHS),
302 LHS = std::make_unique(BinOp, std::move(LHS),
303303 std::move(RHS));
304304 }
305305 }
336336 // success.
337337 getNextToken(); // eat ')'.
338338
339 return llvm::make_unique(FnName, std::move(ArgNames));
339 return std::make_unique(FnName, std::move(ArgNames));
340340 }
341341
342342 /// definition ::= 'def' prototype expression
347347 return nullptr;
348348
349349 if (auto E = ParseExpression())
350 return llvm::make_unique(std::move(Proto), std::move(E));
350 return std::make_unique(std::move(Proto), std::move(E));
351351 return nullptr;
352352 }
353353
355355 static std::unique_ptr ParseTopLevelExpr() {
356356 if (auto E = ParseExpression()) {
357357 // Make an anonymous proto.
358 auto Proto = llvm::make_unique("__anon_expr",
358 auto Proto = std::make_unique("__anon_expr",
359359 std::vector());
360 return llvm::make_unique(std::move(Proto), std::move(E));
360 return std::make_unique(std::move(Proto), std::move(E));
361361 }
362362 return nullptr;
363363 }
222222
223223 /// numberexpr ::= number
224224 static std::unique_ptr ParseNumberExpr() {
225 auto Result = llvm::make_unique(NumVal);
225 auto Result = std::make_unique(NumVal);
226226 getNextToken(); // consume the number
227227 return std::move(Result);
228228 }
249249 getNextToken(); // eat identifier.
250250
251251 if (CurTok != '(') // Simple variable ref.
252 return llvm::make_unique(IdName);
252 return std::make_unique(IdName);
253253
254254 // Call.
255255 getNextToken(); // eat (
273273 // Eat the ')'.
274274 getNextToken();
275275
276 return llvm::make_unique(IdName, std::move(Args));
276 return std::make_unique(IdName, std::move(Args));
277277 }
278278
279279 /// primary
326326
327327 // Merge LHS/RHS.
328328 LHS =
329 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
329 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
330330 }
331331 }
332332
362362 // success.
363363 getNextToken(); // eat ')'.
364364
365 return llvm::make_unique(FnName, std::move(ArgNames));
365 return std::make_unique(FnName, std::move(ArgNames));
366366 }
367367
368368 /// definition ::= 'def' prototype expression
373373 return nullptr;
374374
375375 if (auto E = ParseExpression())
376 return llvm::make_unique(std::move(Proto), std::move(E));
376 return std::make_unique(std::move(Proto), std::move(E));
377377 return nullptr;
378378 }
379379
381381 static std::unique_ptr ParseTopLevelExpr() {
382382 if (auto E = ParseExpression()) {
383383 // Make an anonymous proto.
384 auto Proto = llvm::make_unique("__anon_expr",
384 auto Proto = std::make_unique("__anon_expr",
385385 std::vector());
386 return llvm::make_unique(std::move(Proto), std::move(E));
386 return std::make_unique(std::move(Proto), std::move(E));
387387 }
388388 return nullptr;
389389 }
597597 getNextToken();
598598
599599 // Make the module, which holds all the code.
600 TheModule = llvm::make_unique("my cool jit", TheContext);
600 TheModule = std::make_unique("my cool jit", TheContext);
601601
602602 // Run the main "interpreter loop" now.
603603 MainLoop();
232232
233233 /// numberexpr ::= number
234234 static std::unique_ptr ParseNumberExpr() {
235 auto Result = llvm::make_unique(NumVal);
235 auto Result = std::make_unique(NumVal);
236236 getNextToken(); // consume the number
237237 return std::move(Result);
238238 }
259259 getNextToken(); // eat identifier.
260260
261261 if (CurTok != '(') // Simple variable ref.
262 return llvm::make_unique(IdName);
262 return std::make_unique(IdName);
263263
264264 // Call.
265265 getNextToken(); // eat (
283283 // Eat the ')'.
284284 getNextToken();
285285
286 return llvm::make_unique(IdName, std::move(Args));
286 return std::make_unique(IdName, std::move(Args));
287287 }
288288
289289 /// primary
336336
337337 // Merge LHS/RHS.
338338 LHS =
339 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
339 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
340340 }
341341 }
342342
372372 // success.
373373 getNextToken(); // eat ')'.
374374
375 return llvm::make_unique(FnName, std::move(ArgNames));
375 return std::make_unique(FnName, std::move(ArgNames));
376376 }
377377
378378 /// definition ::= 'def' prototype expression
383383 return nullptr;
384384
385385 if (auto E = ParseExpression())
386 return llvm::make_unique(std::move(Proto), std::move(E));
386 return std::make_unique(std::move(Proto), std::move(E));
387387 return nullptr;
388388 }
389389
391391 static std::unique_ptr ParseTopLevelExpr() {
392392 if (auto E = ParseExpression()) {
393393 // Make an anonymous proto.
394 auto Proto = llvm::make_unique("__anon_expr",
394 auto Proto = std::make_unique("__anon_expr",
395395 std::vector());
396 return llvm::make_unique(std::move(Proto), std::move(E));
396 return std::make_unique(std::move(Proto), std::move(E));
397397 }
398398 return nullptr;
399399 }
549549
550550 static void InitializeModuleAndPassManager() {
551551 // Open a new module.
552 TheModule = llvm::make_unique("my cool jit", TheContext);
552 TheModule = std::make_unique("my cool jit", TheContext);
553553 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
554554
555555 // Create a new pass manager attached to it.
556 TheFPM = llvm::make_unique(TheModule.get());
556 TheFPM = std::make_unique(TheModule.get());
557557
558558 // Do simple "peephole" optimizations and bit-twiddling optzns.
559559 TheFPM->add(createInstructionCombiningPass());
688688 fprintf(stderr, "ready> ");
689689 getNextToken();
690690
691 TheJIT = llvm::make_unique();
691 TheJIT = std::make_unique();
692692
693693 InitializeModuleAndPassManager();
694694
277277
278278 /// numberexpr ::= number
279279 static std::unique_ptr ParseNumberExpr() {
280 auto Result = llvm::make_unique(NumVal);
280 auto Result = std::make_unique(NumVal);
281281 getNextToken(); // consume the number
282282 return std::move(Result);
283283 }
304304 getNextToken(); // eat identifier.
305305
306306 if (CurTok != '(') // Simple variable ref.
307 return llvm::make_unique(IdName);
307 return std::make_unique(IdName);
308308
309309 // Call.
310310 getNextToken(); // eat (
328328 // Eat the ')'.
329329 getNextToken();
330330
331 return llvm::make_unique(IdName, std::move(Args));
331 return std::make_unique(IdName, std::move(Args));
332332 }
333333
334334 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
357357 if (!Else)
358358 return nullptr;
359359
360 return llvm::make_unique(std::move(Cond), std::move(Then),
360 return std::make_unique(std::move(Cond), std::move(Then),
361361 std::move(Else));
362362 }
363363
403403 if (!Body)
404404 return nullptr;
405405
406 return llvm::make_unique(IdName, std::move(Start), std::move(End),
406 return std::make_unique(IdName, std::move(Start), std::move(End),
407407 std::move(Step), std::move(Body));
408408 }
409409
463463
464464 // Merge LHS/RHS.
465465 LHS =
466 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
466 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
467467 }
468468 }
469469
499499 // success.
500500 getNextToken(); // eat ')'.
501501
502 return llvm::make_unique(FnName, std::move(ArgNames));
502 return std::make_unique(FnName, std::move(ArgNames));
503503 }
504504
505505 /// definition ::= 'def' prototype expression
510510 return nullptr;
511511
512512 if (auto E = ParseExpression())
513 return llvm::make_unique(std::move(Proto), std::move(E));
513 return std::make_unique(std::move(Proto), std::move(E));
514514 return nullptr;
515515 }
516516
518518 static std::unique_ptr ParseTopLevelExpr() {
519519 if (auto E = ParseExpression()) {
520520 // Make an anonymous proto.
521 auto Proto = llvm::make_unique("__anon_expr",
521 auto Proto = std::make_unique("__anon_expr",
522522 std::vector());
523 return llvm::make_unique(std::move(Proto), std::move(E));
523 return std::make_unique(std::move(Proto), std::move(E));
524524 }
525525 return nullptr;
526526 }
823823
824824 static void InitializeModuleAndPassManager() {
825825 // Open a new module.
826 TheModule = llvm::make_unique("my cool jit", TheContext);
826 TheModule = std::make_unique("my cool jit", TheContext);
827827 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
828828
829829 // Create a new pass manager attached to it.
830 TheFPM = llvm::make_unique(TheModule.get());
830 TheFPM = std::make_unique(TheModule.get());
831831
832832 // Do simple "peephole" optimizations and bit-twiddling optzns.
833833 TheFPM->add(createInstructionCombiningPass());
962962 fprintf(stderr, "ready> ");
963963 getNextToken();
964964
965 TheJIT = llvm::make_unique();
965 TheJIT = std::make_unique();
966966
967967 InitializeModuleAndPassManager();
968968
311311
312312 /// numberexpr ::= number
313313 static std::unique_ptr ParseNumberExpr() {
314 auto Result = llvm::make_unique(NumVal);
314 auto Result = std::make_unique(NumVal);
315315 getNextToken(); // consume the number
316316 return std::move(Result);
317317 }
338338 getNextToken(); // eat identifier.
339339
340340 if (CurTok != '(') // Simple variable ref.
341 return llvm::make_unique(IdName);
341 return std::make_unique(IdName);
342342
343343 // Call.
344344 getNextToken(); // eat (
362362 // Eat the ')'.
363363 getNextToken();
364364
365 return llvm::make_unique(IdName, std::move(Args));
365 return std::make_unique(IdName, std::move(Args));
366366 }
367367
368368 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
391391 if (!Else)
392392 return nullptr;
393393
394 return llvm::make_unique(std::move(Cond), std::move(Then),
394 return std::make_unique(std::move(Cond), std::move(Then),
395395 std::move(Else));
396396 }
397397
437437 if (!Body)
438438 return nullptr;
439439
440 return llvm::make_unique(IdName, std::move(Start), std::move(End),
440 return std::make_unique(IdName, std::move(Start), std::move(End),
441441 std::move(Step), std::move(Body));
442442 }
443443
476476 int Opc = CurTok;
477477 getNextToken();
478478 if (auto Operand = ParseUnary())
479 return llvm::make_unique(Opc, std::move(Operand));
479 return std::make_unique(Opc, std::move(Operand));
480480 return nullptr;
481481 }
482482
513513
514514 // Merge LHS/RHS.
515515 LHS =
516 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
516 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
517517 }
518518 }
519519
590590 if (Kind && ArgNames.size() != Kind)
591591 return LogErrorP("Invalid number of operands for operator");
592592
593 return llvm::make_unique(FnName, ArgNames, Kind != 0,
593 return std::make_unique(FnName, ArgNames, Kind != 0,
594594 BinaryPrecedence);
595595 }
596596
602602 return nullptr;
603603
604604 if (auto E = ParseExpression())
605 return llvm::make_unique(std::move(Proto), std::move(E));
605 return std::make_unique(std::move(Proto), std::move(E));
606606 return nullptr;
607607 }
608608
610610 static std::unique_ptr ParseTopLevelExpr() {
611611 if (auto E = ParseExpression()) {
612612 // Make an anonymous proto.
613 auto Proto = llvm::make_unique("__anon_expr",
613 auto Proto = std::make_unique("__anon_expr",
614614 std::vector());
615 return llvm::make_unique(std::move(Proto), std::move(E));
615 return std::make_unique(std::move(Proto), std::move(E));
616616 }
617617 return nullptr;
618618 }
942942
943943 static void InitializeModuleAndPassManager() {
944944 // Open a new module.
945 TheModule = llvm::make_unique("my cool jit", TheContext);
945 TheModule = std::make_unique("my cool jit", TheContext);
946946 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
947947
948948 // Create a new pass manager attached to it.
949 TheFPM = llvm::make_unique(TheModule.get());
949 TheFPM = std::make_unique(TheModule.get());
950950
951951 // Do simple "peephole" optimizations and bit-twiddling optzns.
952952 TheFPM->add(createInstructionCombiningPass());
10811081 fprintf(stderr, "ready> ");
10821082 getNextToken();
10831083
1084 TheJIT = llvm::make_unique();
1084 TheJIT = std::make_unique();
10851085
10861086 InitializeModuleAndPassManager();
10871087
333333
334334 /// numberexpr ::= number
335335 static std::unique_ptr ParseNumberExpr() {
336 auto Result = llvm::make_unique(NumVal);
336 auto Result = std::make_unique(NumVal);
337337 getNextToken(); // consume the number
338338 return std::move(Result);
339339 }
360360 getNextToken(); // eat identifier.
361361
362362 if (CurTok != '(') // Simple variable ref.
363 return llvm::make_unique(IdName);
363 return std::make_unique(IdName);
364364
365365 // Call.
366366 getNextToken(); // eat (
384384 // Eat the ')'.
385385 getNextToken();
386386
387 return llvm::make_unique(IdName, std::move(Args));
387 return std::make_unique(IdName, std::move(Args));
388388 }
389389
390390 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
413413 if (!Else)
414414 return nullptr;
415415
416 return llvm::make_unique(std::move(Cond), std::move(Then),
416 return std::make_unique(std::move(Cond), std::move(Then),
417417 std::move(Else));
418418 }
419419
459459 if (!Body)
460460 return nullptr;
461461
462 return llvm::make_unique(IdName, std::move(Start), std::move(End),
462 return std::make_unique(IdName, std::move(Start), std::move(End),
463463 std::move(Step), std::move(Body));
464464 }
465465
508508 if (!Body)
509509 return nullptr;
510510
511 return llvm::make_unique(std::move(VarNames), std::move(Body));
511 return std::make_unique(std::move(VarNames), std::move(Body));
512512 }
513513
514514 /// primary
549549 int Opc = CurTok;
550550 getNextToken();
551551 if (auto Operand = ParseUnary())
552 return llvm::make_unique(Opc, std::move(Operand));
552 return std::make_unique(Opc, std::move(Operand));
553553 return nullptr;
554554 }
555555
586586
587587 // Merge LHS/RHS.
588588 LHS =
589 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
589 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
590590 }
591591 }
592592
663663 if (Kind && ArgNames.size() != Kind)
664664 return LogErrorP("Invalid number of operands for operator");
665665
666 return llvm::make_unique(FnName, ArgNames, Kind != 0,
666 return std::make_unique(FnName, ArgNames, Kind != 0,
667667 BinaryPrecedence);
668668 }
669669
675675 return nullptr;
676676
677677 if (auto E = ParseExpression())
678 return llvm::make_unique(std::move(Proto), std::move(E));
678 return std::make_unique(std::move(Proto), std::move(E));
679679 return nullptr;
680680 }
681681
683683 static std::unique_ptr ParseTopLevelExpr() {
684684 if (auto E = ParseExpression()) {
685685 // Make an anonymous proto.
686 auto Proto = llvm::make_unique("__anon_expr",
686 auto Proto = std::make_unique("__anon_expr",
687687 std::vector());
688 return llvm::make_unique(std::move(Proto), std::move(E));
688 return std::make_unique(std::move(Proto), std::move(E));
689689 }
690690 return nullptr;
691691 }
11101110
11111111 static void InitializeModuleAndPassManager() {
11121112 // Open a new module.
1113 TheModule = llvm::make_unique("my cool jit", TheContext);
1113 TheModule = std::make_unique("my cool jit", TheContext);
11141114 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
11151115
11161116 // Create a new pass manager attached to it.
1117 TheFPM = llvm::make_unique(TheModule.get());
1117 TheFPM = std::make_unique(TheModule.get());
11181118
11191119 // Promote allocas to registers.
11201120 TheFPM->add(createPromoteMemoryToRegisterPass());
12521252 fprintf(stderr, "ready> ");
12531253 getNextToken();
12541254
1255 TheJIT = llvm::make_unique();
1255 TheJIT = std::make_unique();
12561256
12571257 InitializeModuleAndPassManager();
12581258
334334
335335 /// numberexpr ::= number
336336 static std::unique_ptr ParseNumberExpr() {
337 auto Result = llvm::make_unique(NumVal);
337 auto Result = std::make_unique(NumVal);
338338 getNextToken(); // consume the number
339339 return std::move(Result);
340340 }
361361 getNextToken(); // eat identifier.
362362
363363 if (CurTok != '(') // Simple variable ref.
364 return llvm::make_unique(IdName);
364 return std::make_unique(IdName);
365365
366366 // Call.
367367 getNextToken(); // eat (
385385 // Eat the ')'.
386386 getNextToken();
387387
388 return llvm::make_unique(IdName, std::move(Args));
388 return std::make_unique(IdName, std::move(Args));
389389 }
390390
391391 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
414414 if (!Else)
415415 return nullptr;
416416
417 return llvm::make_unique(std::move(Cond), std::move(Then),
417 return std::make_unique(std::move(Cond), std::move(Then),
418418 std::move(Else));
419419 }
420420
460460 if (!Body)
461461 return nullptr;
462462
463 return llvm::make_unique(IdName, std::move(Start), std::move(End),
463 return std::make_unique(IdName, std::move(Start), std::move(End),
464464 std::move(Step), std::move(Body));
465465 }
466466
509509 if (!Body)
510510 return nullptr;
511511
512 return llvm::make_unique(std::move(VarNames), std::move(Body));
512 return std::make_unique(std::move(VarNames), std::move(Body));
513513 }
514514
515515 /// primary
550550 int Opc = CurTok;
551551 getNextToken();
552552 if (auto Operand = ParseUnary())
553 return llvm::make_unique(Opc, std::move(Operand));
553 return std::make_unique(Opc, std::move(Operand));
554554 return nullptr;
555555 }
556556
587587
588588 // Merge LHS/RHS.
589589 LHS =
590 llvm::make_unique(BinOp, std::move(LHS), std::move(RHS));
590 std::make_unique(BinOp, std::move(LHS), std::move(RHS));
591591 }
592592 }
593593
664664 if (Kind && ArgNames.size() != Kind)
665665 return LogErrorP("Invalid number of operands for operator");
666666
667 return llvm::make_unique(FnName, ArgNames, Kind != 0,
667 return std::make_unique(FnName, ArgNames, Kind != 0,
668668 BinaryPrecedence);
669669 }
670670
676676 return nullptr;
677677
678678 if (auto E = ParseExpression())
679 return llvm::make_unique(std::move(Proto), std::move(E));
679 return std::make_unique(std::move(Proto), std::move(E));
680680 return nullptr;
681681 }
682682
684684 static std::unique_ptr ParseTopLevelExpr() {
685685 if (auto E = ParseExpression()) {
686686 // Make an anonymous proto.
687 auto Proto = llvm::make_unique("__anon_expr",
687 auto Proto = std::make_unique("__anon_expr",
688688 std::vector());
689 return llvm::make_unique(std::move(Proto), std::move(E));
689 return std::make_unique(std::move(Proto), std::move(E));
690690 }
691691 return nullptr;
692692 }
11061106
11071107 static void InitializeModuleAndPassManager() {
11081108 // Open a new module.
1109 TheModule = llvm::make_unique("my cool jit", TheContext);
1109 TheModule = std::make_unique("my cool jit", TheContext);
11101110 }
11111111
11121112 static void HandleDefinition() {
441441
442442 /// numberexpr ::= number
443443 static std::unique_ptr ParseNumberExpr() {
444 auto Result = llvm::make_unique(NumVal);
444 auto Result = std::make_unique(NumVal);
445445 getNextToken(); // consume the number
446446 return std::move(Result);
447447 }
470470 getNextToken(); // eat identifier.
471471
472472 if (CurTok != '(') // Simple variable ref.
473 return llvm::make_unique(LitLoc, IdName);
473 return std::make_unique(LitLoc, IdName);
474474
475475 // Call.
476476 getNextToken(); // eat (
494494 // Eat the ')'.
495495 getNextToken();
496496
497 return llvm::make_unique(LitLoc, IdName, std::move(Args));
497 return std::make_unique(LitLoc, IdName, std::move(Args));
498498 }
499499
500500 /// ifexpr ::= 'if' expression 'then' expression 'else' expression
525525 if (!Else)
526526 return nullptr;
527527
528 return llvm::make_unique(IfLoc, std::move(Cond), std::move(Then),
528 return std::make_unique(IfLoc, std::move(Cond), std::move(Then),
529529 std::move(Else));
530530 }
531531
571571 if (!Body)
572572 return nullptr;
573573
574 return llvm::make_unique(IdName, std::move(Start), std::move(End),
574 return std::make_unique(IdName, std::move(Start), std::move(End),
575575 std::move(Step), std::move(Body));
576576 }
577577
620620 if (!Body)
621621 return nullptr;
622622
623 return llvm::make_unique(std::move(VarNames), std::move(Body));
623 return std::make_unique(std::move(VarNames), std::move(Body));
624624 }
625625
626626 /// primary
661661 int Opc = CurTok;
662662 getNextToken();
663663 if (auto Operand = ParseUnary())
664 return llvm::make_unique(Opc, std::move(Operand));
664 return std::make_unique(Opc, std::move(Operand));
665665 return nullptr;
666666 }
667667
698698 }
699699
700700 // Merge LHS/RHS.
701 LHS = llvm::make_unique(BinLoc, BinOp, std::move(LHS),
701 LHS = std::make_unique(BinLoc, BinOp, std::move(LHS),
702702 std::move(RHS));
703703 }
704704 }
778778 if (Kind && ArgNames.size() != Kind)
779779 return LogErrorP("Invalid number of operands for operator");
780780
781 return llvm::make_unique(FnLoc, FnName, ArgNames, Kind != 0,
781 return std::make_unique(FnLoc, FnName, ArgNames, Kind != 0,
782782 BinaryPrecedence);
783783 }
784784
790790 return nullptr;
791791
792792 if (auto E = ParseExpression())
793 return llvm::make_unique(std::move(Proto), std::move(E));
793 return std::make_unique(std::move(Proto), std::move(E));
794794 return nullptr;
795795 }
796796
799799 SourceLocation FnLoc = CurLoc;
800800 if (auto E = ParseExpression()) {
801801 // Make an anonymous proto.
802 auto Proto = llvm::make_unique(FnLoc, "__anon_expr",
802 auto Proto = std::make_unique(FnLoc, "__anon_expr",
803803 std::vector());
804 return llvm::make_unique(std::move(Proto), std::move(E));
804 return std::make_unique(std::move(Proto), std::move(E));
805805 }
806806 return nullptr;
807807 }
13131313
13141314 static void InitializeModule() {
13151315 // Open a new module.
1316 TheModule = llvm::make_unique("my cool jit", TheContext);
1316 TheModule = std::make_unique("my cool jit", TheContext);
13171317 TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
13181318 }
13191319
14151415 // Prime the first token.
14161416 getNextToken();
14171417
1418 TheJIT = llvm::make_unique();
1418 TheJIT = std::make_unique();
14191419
14201420 InitializeModule();
14211421
14281428 TheModule->addModuleFlag(llvm::Module::Warning, "Dwarf Version", 2);
14291429
14301430 // Construct the DIBuilder, we do this here because we need the module.
1431 DBuilder = llvm::make_unique(*TheModule);
1431 DBuilder = std::make_unique(*TheModule);
14321432
14331433 // Create the compile unit for the module.
14341434 // Currently down as "fib.ks" as a filename since we're redirecting stdin
3434 using namespace llvm;
3535 using namespace llvm::orc;
3636
37 auto Ctx = llvm::make_unique();
37 auto Ctx = std::make_unique();
3838 SMDiagnostic Err;
3939 auto M = parseIR(MemoryBufferRef(Source, Name), Err, *Ctx);
4040
258258 LLVMContext Context;
259259
260260 // Create some module to put our function into it.
261 std::unique_ptr Owner = make_unique("test", Context);
261 std::unique_ptr Owner = std::make_unique("test", Context);
262262 Module *M = Owner.get();
263263
264264 Function* add1F = createAdd1( M );
4747 if (!DL)
4848 return DL.takeError();
4949
50 auto ES = llvm::make_unique();
50 auto ES = std::make_unique();
5151
5252 auto LCTMgr = createLocalLazyCallThroughManager(
5353 JTMB->getTargetTriple(), *ES,
127127 }
128128
129129 static std::unique_ptr createMemMgr() {
130 return llvm::make_unique();
130 return std::make_unique();
131131 }
132132
133133 std::unique_ptr ES;
167167 // Load the IR inputs.
168168 for (const auto &InputFile : InputFiles) {
169169 SMDiagnostic Err;
170 auto Ctx = llvm::make_unique();
170 auto Ctx = std::make_unique();
171171 auto M = parseIRFile(InputFile, Err, *Ctx);
172172 if (!M) {
173173 Err.print(argv[0], errs());
3737 explicit StorageImpl(T &&Value) : Value(std::move(Value)) {}
3838
3939 std::unique_ptr clone() const override {
40 return llvm::make_unique>(Value);
40 return std::make_unique>(Value);
4141 }
4242
4343 const void *id() const override { return &TypeId::Id; }
7777 int>::type = 0>
7878 Any(T &&Value) {
7979 using U = typename std::decay::type;
80 Storage = llvm::make_unique>(std::forward(Value));
80 Storage = std::make_unique>(std::forward(Value));
8181 }
8282
8383 Any(Any &&Other) : Storage(std::move(Other.Storage)) {}
364364 auto Deconst = const_cast *>(this);
365365 typename BBNodeMapT::value_type V = {
366366 BB,
367 llvm::make_unique(static_cast(Deconst), BB)};
367 std::make_unique(static_cast(Deconst), BB)};
368368 at = BBNodeMap.insert(std::move(V)).first;
369369 }
370370 return at->second.get();
8686 }
8787 GISelKnownBits &get(MachineFunction &MF) {
8888 if (!Info)
89 Info = make_unique(MF);
89 Info = std::make_unique(MF);
9090 return *Info.get();
9191 }
9292 void getAnalysisUsage(AnalysisUsage &AU) const override;
223223
224224 /// Constructs a new LiveRange object.
225225 LiveRange(bool UseSegmentSet = false)
226 : segmentSet(UseSegmentSet ? llvm::make_unique()
226 : segmentSet(UseSegmentSet ? std::make_unique()
227227 : nullptr) {}
228228
229229 /// Constructs a new LiveRange object by copying segments and valnos from
199199 RegClassInfo(rci), II_setByPragma(II), Topo(SUnits, &ExitSU) {
200200 P.MF->getSubtarget().getSMSMutations(Mutations);
201201 if (SwpEnableCopyToPhi)
202 Mutations.push_back(llvm::make_unique());
202 Mutations.push_back(std::make_unique());
203203 }
204204
205205 void schedule() override;
2727 public:
2828 /// Construct a PBQP vector of the given size.
2929 explicit Vector(unsigned Length)
30 : Length(Length), Data(llvm::make_unique(Length)) {}
30 : Length(Length), Data(std::make_unique(Length)) {}
3131
3232 /// Construct a PBQP vector with initializer.
3333 Vector(unsigned Length, PBQPNum InitVal)
34 : Length(Length), Data(llvm::make_unique(Length)) {
34 : Length(Length), Data(std::make_unique(Length)) {
3535 std::fill(Data.get(), Data.get() + Length, InitVal);
3636 }
3737
3838 /// Copy construct a PBQP vector.
3939 Vector(const Vector &V)
40 : Length(V.Length), Data(llvm::make_unique(Length)) {
40 : Length(V.Length), Data(std::make_unique(Length)) {
4141 std::copy(V.Data.get(), V.Data.get() + Length, Data.get());
4242 }
4343
124124 public:
125125 /// Construct a PBQP Matrix with the given dimensions.
126126 Matrix(unsigned Rows, unsigned Cols) :
127 Rows(Rows), Cols(Cols), Data(llvm::make_unique(Rows * Cols)) {
127 Rows(Rows), Cols(Cols), Data(std::make_unique(Rows * Cols)) {
128128 }
129129
130130 /// Construct a PBQP Matrix with the given dimensions and initial
131131 /// value.
132132 Matrix(unsigned Rows, unsigned Cols, PBQPNum InitVal)
133133 : Rows(Rows), Cols(Cols),
134 Data(llvm::make_unique(Rows * Cols)) {
134 Data(std::make_unique(Rows * Cols)) {
135135 std::fill(Data.get(), Data.get() + (Rows * Cols), InitVal);
136136 }
137137
138138 /// Copy construct a PBQP matrix.
139139 Matrix(const Matrix &M)
140140 : Rows(M.Rows), Cols(M.Cols),
141 Data(llvm::make_unique(Rows * Cols)) {
141 Data(std::make_unique(Rows * Cols)) {
142142 std::copy(M.Data.get(), M.Data.get() + (Rows * Cols), Data.get());
143143 }
144144
279279 ///
280280 /// This can also be used to plug a new MachineSchedStrategy into an instance
281281 /// of the standard ScheduleDAGMI:
282 /// return new ScheduleDAGMI(C, make_unique(C), /*RemoveKillFlags=*/false)
282 /// return new ScheduleDAGMI(C, std::make_unique(C), /*RemoveKillFlags=*/false)
283283 ///
284284 /// Return NULL to select the default (generic) machine scheduler.
285285 virtual ScheduleDAGInstrs *
6161
6262 Error visitSymbolBegin(CVSymbol &Record) override {
6363 assert(!Mapping && "Already in a symbol mapping!");
64 Mapping = llvm::make_unique(Record.content(), Container);
64 Mapping = std::make_unique(Record.content(), Container);
6565 return Mapping->Mapping.visitSymbolBegin(Record);
6666 }
6767 Error visitSymbolEnd(CVSymbol &Record) override {
6565
6666 Error visitTypeBegin(CVType &Record) override {
6767 assert(!Mapping && "Already in a type mapping!");
68 Mapping = llvm::make_unique(Record.content());
68 Mapping = std::make_unique(Record.content());
6969 return Mapping->Mapping.visitTypeBegin(Record);
7070 }
7171
292292 LoadedObjectInfoHelper(Ts &&... Args) : Base(std::forward(Args)...) {}
293293
294294 std::unique_ptr clone() const override {
295 return llvm::make_unique(static_cast(*this));
295 return std::make_unique(static_cast(*this));
296296 }
297297 };
298298
8686
8787 // Initial construction must not access the cache, since it must be done
8888 // atomically.
89 auto Result = llvm::make_unique(
89 auto Result = std::make_unique(
9090 Session, Id, std::forward(ConstructorArgs)...);
9191 Result->SymbolId = Id;
9292
130130 auto BaseIter = RawSymbol->findChildren(T::Tag);
131131 if (!BaseIter)
132132 return nullptr;
133 return llvm::make_unique>(std::move(BaseIter));
133 return std::make_unique>(std::move(BaseIter));
134134 }
135135 std::unique_ptr findAllChildren(PDB_SymType Type) const;
136136 std::unique_ptr findAllChildren() const;
190190 std::unique_ptr>
191191 wrapOwnership(ResourcePtrT ResourcePtr) {
192192 using RO = ResourceOwnerImpl;
193 return llvm::make_unique(std::move(ResourcePtr));
193 return std::make_unique(std::move(ResourcePtr));
194194 }
195195
196196 struct LogicalDylib {
443443 return Error::success();
444444
445445 // Create the GlobalValues module.
446 auto GVsM = llvm::make_unique((SrcM.getName() + ".globals").str(),
446 auto GVsM = std::make_unique((SrcM.getName() + ".globals").str(),
447447 SrcM.getContext());
448448 GVsM->setDataLayout(DL);
449449
636636 NewName += F->getName();
637637 }
638638
639 auto M = llvm::make_unique(NewName, SrcM.getContext());
639 auto M = std::make_unique(NewName, SrcM.getContext());
640640 M->setDataLayout(SrcM.getDataLayout());
641641 ValueToValueMapTy VMap;
642642
345345 ///
346346 inline std::unique_ptr
347347 absoluteSymbols(SymbolMap Symbols, VModuleKey K = VModuleKey()) {
348 return llvm::make_unique(
348 return std::make_unique(
349349 std::move(Symbols), std::move(K));
350350 }
351351
389389 /// \endcode
390390 inline std::unique_ptr
391391 symbolAliases(SymbolAliasMap Aliases, VModuleKey K = VModuleKey()) {
392 return llvm::make_unique(
392 return std::make_unique(
393393 nullptr, true, std::move(Aliases), std::move(K));
394394 }
395395
401401 inline std::unique_ptr
402402 reexports(JITDylib &SourceJD, SymbolAliasMap Aliases,
403403 bool MatchNonExported = false, VModuleKey K = VModuleKey()) {
404 return llvm::make_unique(
404 return std::make_unique(
405405 &SourceJD, MatchNonExported, std::move(Aliases), std::move(K));
406406 }
407407
6262 createLambdaResolver(DylibLookupFtorT DylibLookupFtor,
6363 ExternalLookupFtorT ExternalLookupFtor) {
6464 using LR = LambdaResolver;
65 return make_unique(std::move(DylibLookupFtor),
65 return std::make_unique(std::move(DylibLookupFtor),
6666 std::move(ExternalLookupFtor));
6767 }
6868
7272 DylibLookupFtorT DylibLookupFtor,
7373 ExternalLookupFtorT ExternalLookupFtor) {
7474 using LR = LambdaResolver;
75 return make_unique(AcknowledgeORCv1Deprecation,
75 return std::make_unique(AcknowledgeORCv1Deprecation,
7676 std::move(DylibLookupFtor),
7777 std::move(ExternalLookupFtor));
7878 }
170170 bool ExportedSymbolsOnly) const {
171171 assert(!MangledSymbols && "Mangled symbols map already exists?");
172172
173 auto Symbols = llvm::make_unique>();
173 auto Symbols = std::make_unique>();
174174
175175 Mangler Mang;
176176
208208 Error addModule(VModuleKey K, std::unique_ptr M) {
209209 assert(!ModuleMap.count(K) && "VModuleKey K already in use");
210210 ModuleMap[K] =
211 llvm::make_unique(std::move(K), std::move(M));
211 std::make_unique(std::move(K), std::move(M));
212212 return Error::success();
213213 }
214214
7070 template
7171 static std::unique_ptr
7272 createNotifyResolvedFunction(NotifyResolvedImpl NotifyResolved) {
73 return llvm::make_unique>(
73 return std::make_unique>(
7474 std::move(NotifyResolved));
7575 }
7676
185185 IndirectStubsManager &ISManager, JITDylib &SourceJD,
186186 SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc = nullptr,
187187 VModuleKey K = VModuleKey()) {
188 return llvm::make_unique(
188 return std::make_unique(
189189 LCTManager, ISManager, SourceJD, std::move(CallableAliases), SrcJDLoc,
190190 std::move(K));
191191 }
8383 typename std::remove_reference::type>::type,
8484 typename std::remove_cv<
8585 typename std::remove_reference::type>::type>;
86 return llvm::make_unique(
86 return std::make_unique(
8787 std::forward(GetResponsibilitySet),
8888 std::forward(Lookup));
8989 }
492492 ExecutionSession &ES,
493493 JITTargetAddress ErrorHandlerAddress)
494494 : JITCompileCallbackManager(
495 llvm::make_unique(Client), ES,
495 std::make_unique(Client), ES,
496496 ErrorHandlerAddress) {}
497497 };
498498
552552 auto Id = IndirectStubOwnerIds.getNext();
553553 if (auto Err = callB(Id))
554554 return std::move(Err);
555 return llvm::make_unique(*this, Id);
555 return std::make_unique(*this, Id);
556556 }
557557
558558 Expected
763763 // Create a ResponseHandler from a given user handler.
764764 template
765765 std::unique_ptr> createResponseHandler(HandlerT H) {
766 return llvm::make_unique>(
766 return std::make_unique>(
767767 std::move(H));
768768 }
769769
215215 : K(std::move(K)),
216216 Parent(Parent),
217217 MemMgr(std::move(MemMgr)),
218 PFC(llvm::make_unique(
218 PFC(std::make_unique(
219219 std::move(Obj), std::move(Resolver),
220220 ProcessAllSections)) {
221221 buildInitialSymbolTable(PFC->Obj);
233233
234234 JITSymbolResolverAdapter ResolverAdapter(Parent.ES, *PFC->Resolver,
235235 nullptr);
236 PFC->RTDyld = llvm::make_unique(*MemMgr, ResolverAdapter);
236 PFC->RTDyld = std::make_unique(*MemMgr, ResolverAdapter);
237237 PFC->RTDyld->setProcessAllSections(PFC->ProcessAllSections);
238238
239239 Finalized = true;
337337 std::shared_ptr Resolver,
338338 bool ProcessAllSections) {
339339 using LOS = ConcreteLinkedObject;
340 return llvm::make_unique(Parent, std::move(K), std::move(Obj),
340 return std::make_unique(Parent, std::move(K), std::move(Obj),
341341 std::move(MemMgr), std::move(Resolver),
342342 ProcessAllSections);
343343 }
471471 }
472472
473473 Expected addObject(std::string ObjBuffer) {
474 auto Buffer = llvm::make_unique(std::move(ObjBuffer));
474 auto Buffer = std::make_unique(std::move(ObjBuffer));
475475 auto Id = HandleIdMgr.getNext();
476476 assert(!BaseLayerHandles.count(Id) && "Id already in use?");
477477
805805 /// Ensure that this has RAUW support, and then return it.
806806 ReplaceableMetadataImpl *getOrCreateReplaceableUses() {
807807 if (!hasReplaceableUses())
808 makeReplaceable(llvm::make_unique(getContext()));
808 makeReplaceable(std::make_unique(getContext()));
809809 return getReplaceableUses();
810810 }
811811
602602 if (!TypeTests.empty() || !TypeTestAssumeVCalls.empty() ||
603603 !TypeCheckedLoadVCalls.empty() || !TypeTestAssumeConstVCalls.empty() ||
604604 !TypeCheckedLoadConstVCalls.empty())
605 TIdInfo = llvm::make_unique(TypeIdInfo{
605 TIdInfo = std::make_unique(TypeIdInfo{
606606 std::move(TypeTests), std::move(TypeTestAssumeVCalls),
607607 std::move(TypeCheckedLoadVCalls),
608608 std::move(TypeTestAssumeConstVCalls),
681681 /// were unable to devirtualize a checked call.
682682 void addTypeTest(GlobalValue::GUID Guid) {
683683 if (!TIdInfo)
684 TIdInfo = llvm::make_unique();
684 TIdInfo = std::make_unique();
685685 TIdInfo->TypeTests.push_back(Guid);
686686 }
687687
781781
782782 void setVTableFuncs(VTableFuncList Funcs) {
783783 assert(!VTableFuncs);
784 VTableFuncs = llvm::make_unique(std::move(Funcs));
784 VTableFuncs = std::make_unique(std::move(Funcs));
785785 }
786786
787787 ArrayRef vTableFuncs() const {
14181418 struct GraphTraits : public GraphTraits {
14191419 static NodeRef getEntryNode(ModuleSummaryIndex *I) {
14201420 std::unique_ptr Root =
1421 make_unique(I->calculateCallGraphRoot());
1421 std::make_unique(I->calculateCallGraphRoot());
14221422 GlobalValueSummaryInfo G(I->haveGVs());
14231423 G.SummaryList.push_back(std::move(Root));
14241424 static auto P =
219219 V.emplace(RefGUID, /*IsAnalysis=*/false);
220220 Refs.push_back(ValueInfo(/*IsAnalysis=*/false, &*V.find(RefGUID)));
221221 }
222 Elem.SummaryList.push_back(llvm::make_unique(
222 Elem.SummaryList.push_back(std::make_unique(
223223 GlobalValueSummary::GVFlags(
224224 static_cast(FSum.Linkage),
225225 FSum.NotEligibleToImport, FSum.Live, FSum.IsLocal, FSum.CanAutoHide),
288288 AnalysisResultConcept>
289289 run(IRUnitT &IR, AnalysisManager &AM,
290290 ExtraArgTs... ExtraArgs) override {
291 return llvm::make_unique(
291 return std::make_unique(
292292 Pass.run(IR, AM, std::forward(ExtraArgs)...));
293293 }
294294
225225 setDiscardValueNames(C.ShouldDiscardValueNames);
226226 enableDebugTypeODRUniquing();
227227 setDiagnosticHandler(
228 llvm::make_unique(&DiagHandler), true);
228 std::make_unique(&DiagHandler), true);
229229 }
230230 DiagnosticHandlerFunction DiagHandler;
231231 };
284284
285285 unsigned createMemoryGroup() {
286286 Groups.insert(
287 std::make_pair(NextGroupID, llvm::make_unique()));
287 std::make_pair(NextGroupID, std::make_unique()));
288288 return NextGroupID++;
289289 }
290290
158158
159159 Scheduler(const MCSchedModel &Model, LSUnit &Lsu,
160160 std::unique_ptr SelectStrategy)
161 : Scheduler(make_unique(Model), Lsu,
161 : Scheduler(std::make_unique(Model), Lsu,
162162 std::move(SelectStrategy)) {}
163163
164164 Scheduler(std::unique_ptr RM, LSUnit &Lsu,
694694 InstrProfRecord(const InstrProfRecord &RHS)
695695 : Counts(RHS.Counts),
696696 ValueData(RHS.ValueData
697 ? llvm::make_unique(*RHS.ValueData)
697 ? std::make_unique(*RHS.ValueData)
698698 : nullptr) {}
699699 InstrProfRecord &operator=(InstrProfRecord &&) = default;
700700 InstrProfRecord &operator=(const InstrProfRecord &RHS) {
704704 return *this;
705705 }
706706 if (!ValueData)
707 ValueData = llvm::make_unique(*RHS.ValueData);
707 ValueData = std::make_unique(*RHS.ValueData);
708708 else
709709 *ValueData = *RHS.ValueData;
710710 return *this;
816816 std::vector &
817817 getOrCreateValueSitesForKind(uint32_t ValueKind) {
818818 if (!ValueData)
819 ValueData = llvm::make_unique();
819 ValueData = std::make_unique();
820820 switch (ValueKind) {
821821 case IPVK_IndirectCallTarget:
822822 return ValueData->IndirectCallSites;
896896 return std::unique_ptr(nullptr);
897897 }
898898
899 auto VD = llvm::make_unique(N);
899 auto VD = std::make_unique(N);
900900 TotalCount = getValueForSite(VD.get(), ValueKind, Site);
901901
902902 return VD;
327327 /// Make a Error instance representing failure using the given error info
328328 /// type.
329329 template Error make_error(ArgTs &&... Args) {
330 return Error(llvm::make_unique(std::forward(Args)...));
330 return Error(std::make_unique(std::forward(Args)...));
331331 }
332332
333333 /// Base class for user error types. Users should declare their error types
570570 assert(IDomNode && "Not immediate dominator specified for block!");
571571 DFSInfoValid = false;
572572 return (DomTreeNodes[BB] = IDomNode->addChild(
573 llvm::make_unique>(BB, IDomNode))).get();
573 std::make_unique>(BB, IDomNode))).get();
574574 }
575575
576576 /// Add a new node to the forward dominator tree and make it a new root.
584584 "Cannot change root of post-dominator tree");
585585 DFSInfoValid = false;
586586 DomTreeNodeBase *NewNode = (DomTreeNodes[BB] =
587 llvm::make_unique>(BB, nullptr)).get();
587 std::make_unique>(BB, nullptr)).get();
588588 if (Roots.empty()) {
589589 addRoot(BB);
590590 } else {
185185 // Add a new tree node for this NodeT, and link it as a child of
186186 // IDomNode
187187 return (DT.DomTreeNodes[BB] = IDomNode->addChild(
188 llvm::make_unique>(BB, IDomNode)))
188 std::make_unique>(BB, IDomNode)))
189189 .get();
190190 }
191191
585585 NodePtr Root = IsPostDom ? nullptr : DT.Roots[0];
586586
587587 DT.RootNode = (DT.DomTreeNodes[Root] =
588 llvm::make_unique>(Root, nullptr))
588 std::make_unique>(Root, nullptr))
589589 .get();
590590 SNCA.attachNewSubtree(DT, DT.RootNode);
591591 }
610610 // Add a new tree node for this BasicBlock, and link it as a child of
611611 // IDomNode.
612612 DT.DomTreeNodes[W] = IDomNode->addChild(
613 llvm::make_unique>(W, IDomNode));
613 std::make_unique>(W, IDomNode));
614614 }
615615 }
616616
662662 TreeNodePtr VirtualRoot = DT.getNode(nullptr);
663663 FromTN =
664664 (DT.DomTreeNodes[From] = VirtualRoot->addChild(
665 llvm::make_unique>(From, VirtualRoot)))
665 std::make_unique>(From, VirtualRoot)))
666666 .get();
667667 DT.Roots.push_back(From);
668668 }
114114 entry Entry;
115115 node Node;
116116
117 static std::unique_ptr CtorFn() { return make_unique(); }
117 static std::unique_ptr CtorFn() { return std::make_unique(); }
118118
119119 public:
120120 Add(StringRef Name, StringRef Desc)
251251 // Ok, build a new cache by scanning the function, insert it and the value
252252 // handle into our map, and return the newly populated cache.
253253 auto IP = AssumptionCaches.insert(std::make_pair(
254 FunctionCallbackVH(&F, this), llvm::make_unique(F)));
254 FunctionCallbackVH(&F, this), std::make_unique(F)));
255255 assert(IP.second && "Scanning function already in the map?");
256256 return *IP.first->second;
257257 }
2828
2929 CallGraph::CallGraph(Module &M)
3030 : M(M), ExternalCallingNode(getOrInsertFunction(nullptr)),
31 CallsExternalNode(llvm::make_unique(nullptr)) {
31 CallsExternalNode(std::make_unique(nullptr)) {
3232 // Add every function to the call graph.
3333 for (Function &F : M)
3434 addToCallGraph(&F);
149149 return CGN.get();
150150
151151 assert((!F || F->getParent() == &M) && "Function not in current module!");
152 CGN = llvm::make_unique(const_cast(F));
152 CGN = std::make_unique(const_cast(F));
153153 return CGN.get();
154154 }
155155
253253 LoopIndependent(PossiblyLoopIndependent) {
254254 Consistent = true;
255255 if (CommonLevels)
256 DV = make_unique(CommonLevels);
256 DV = std::make_unique(CommonLevels);
257257 }
258258
259259 // The rest are simple getters that hide the implementation.
34143414 if (!isLoadOrStore(Src) || !isLoadOrStore(Dst)) {
34153415 // can only analyze simple loads and stores, i.e., no calls, invokes, etc.
34163416 LLVM_DEBUG(dbgs() << "can only handle simple loads and stores\n");
3417 return make_unique(Src, Dst);
3417 return std::make_unique(Src, Dst);
34183418 }
34193419
34203420 assert(isLoadOrStore(Src) && "instruction is not load or store");
34293429 case PartialAlias:
34303430 // cannot analyse objects if we don't understand their aliasing.
34313431 LLVM_DEBUG(dbgs() << "can't analyze may or partial alias\n");
3432 return make_unique(Src, Dst);
3432 return std::make_unique(Src, Dst);
34333433 case NoAlias:
34343434 // If the objects noalias, they are distinct, accesses are independent.
34353435 LLVM_DEBUG(dbgs() << "no alias\n");
37763776 return nullptr;
37773777 }
37783778
3779 return make_unique(std::move(Result));
3779 return std::make_unique(std::move(Result));
37803780 }
37813781
37823782
5252 "call callsite"));
5353
5454 ICallPromotionAnalysis::ICallPromotionAnalysis() {
55 ValueDataArray = llvm::make_unique(MaxNumPromotions);
55 ValueDataArray = std::make_unique(MaxNumPromotions);
5656 }
5757
5858 bool ICallPromotionAnalysis::isPromotionProfitable(uint64_t Count,
5555 bool LazyBranchProbabilityInfoPass::runOnFunction(Function &F) {
5656 LoopInfo &LI = getAnalysis().getLoopInfo();
5757 TargetLibraryInfo &TLI = getAnalysis().getTLI();
58 LBPI = llvm::make_unique(&F, &LI, &TLI);
58 LBPI = std::make_unique(&F, &LI, &TLI);
5959 return false;
6060 }
6161
187187 else {
188188 auto It = ValueCache.find_as(Val);
189189 if (It == ValueCache.end()) {
190 ValueCache[Val] = make_unique(Val, this);
190 ValueCache[Val] = std::make_unique(Val, this);
191191 It = ValueCache.find_as(Val);
192192 assert(It != ValueCache.end() && "Val was just added to the map!");
193193 }
335335 if (shouldUseGPUDivergenceAnalysis(F)) {
336336 // run the new GPU divergence analysis
337337 auto &LI = getAnalysis().getLoopInfo();
338 gpuDA = llvm::make_unique(F, DT, PDT, LI, TTI);
338 gpuDA = std::make_unique(F, DT, PDT, LI, TTI);
339339
340340 } else {
341341 // run LLVM's existing DivergenceAnalysis
20982098 DL = I->getDebugLoc();
20992099 }
21002100
2101 Report = make_unique(DEBUG_TYPE, RemarkName, DL,
2101 Report = std::make_unique(DEBUG_TYPE, RemarkName, DL,
21022102 CodeRegion);
21032103 return *Report;
21042104 }
23432343 LoopAccessInfo::LoopAccessInfo(Loop *L, ScalarEvolution *SE,
23442344 const TargetLibraryInfo *TLI, AliasAnalysis *AA,
23452345 DominatorTree *DT, LoopInfo *LI)
2346 : PSE(llvm::make_unique(*SE, *L)),
2347 PtrRtChecking(llvm::make_unique(SE)),
2348 DepChecker(llvm::make_unique(*PSE, L)), TheLoop(L),
2346 : PSE(std::make_unique(*SE, *L)),
2347 PtrRtChecking(std::make_unique(SE)),
2348 DepChecker(std::make_unique(*PSE, L)), TheLoop(L),
23492349 NumLoads(0), NumStores(0), MaxSafeDepDistBytes(-1), CanVecMem(false),
23502350 HasConvergentOp(false),
23512351 HasDependenceInvolvingLoopInvariantAddress(false) {
24002400 auto &LAI = LoopAccessInfoMap[L];
24012401
24022402 if (!LAI)
2403 LAI = llvm::make_unique(L, SE, TLI, AA, DT, LI);
2403 LAI = std::make_unique(L, SE, TLI, AA, DT, LI);
24042404
24052405 return *LAI.get();
24062406 }
483483 return nullptr;
484484 }
485485
486 return make_unique(Loops, AR.LI, AR.SE, AR.TTI, AR.AA, DI, TRT);
486 return std::make_unique(Loops, AR.LI, AR.SE, AR.TTI, AR.AA, DI, TRT);
487487 }
488488
489489 void CacheCost::calculateCacheFootprint() {
12371237 auto Res = PerBlockAccesses.insert(std::make_pair(BB, nullptr));
12381238
12391239 if (Res.second)
1240 Res.first->second = llvm::make_unique();
1240 Res.first->second = std::make_unique();
12411241 return Res.first->second.get();
12421242 }
12431243
12451245 auto Res = PerBlockDefs.insert(std::make_pair(BB, nullptr));
12461246
12471247 if (Res.second)
1248 Res.first->second = llvm::make_unique();
1248 Res.first->second = std::make_unique();
12491249 return Res.first->second.get();
12501250 }
12511251
15541554
15551555 if (!WalkerBase)
15561556 WalkerBase =
1557 llvm::make_unique>(this, AA, DT);
1557 std::make_unique>(this, AA, DT);
15581558
15591559 Walker =
1560 llvm::make_unique>(this, WalkerBase.get());
1560 std::make_unique>(this, WalkerBase.get());
15611561 return Walker.get();
15621562 }
15631563
15671567
15681568 if (!WalkerBase)
15691569 WalkerBase =
1570 llvm::make_unique>(this, AA, DT);
1570 std::make_unique>(this, AA, DT);
15711571
15721572 SkipWalker =
1573 llvm::make_unique>(this, WalkerBase.get());
1573 std::make_unique>(this, WalkerBase.get());
15741574 return SkipWalker.get();
15751575 }
15761576
22552255 FunctionAnalysisManager &AM) {
22562256 auto &DT = AM.getResult(F);
22572257 auto &AA = AM.getResult(F);
2258 return MemorySSAAnalysis::Result(llvm::make_unique(F, &AA, &DT));
2258 return MemorySSAAnalysis::Result(std::make_unique(F, &AA, &DT));
22592259 }
22602260
22612261 bool MemorySSAAnalysis::Result::invalidate(
466466 // FIXME: refactor this to use the same code that inliner is using.
467467 // Don't try to import functions with noinline attribute.
468468 F.getAttributes().hasFnAttribute(Attribute::NoInline)};
469 auto FuncSummary = llvm::make_unique(
469 auto FuncSummary = std::make_unique(
470470 Flags, NumInsts, FunFlags, /*EntryCount=*/0, std::move(Refs),
471471 CallGraphEdges.takeVector(), TypeTests.takeVector(),
472472 TypeTestAssumeVCalls.takeVector(), TypeCheckedLoadVCalls.takeVector(),
597597 !V.hasComdat() && !V.hasAppendingLinkage() && !V.isInterposable() &&
598598 !V.hasAvailableExternallyLinkage() && !V.hasDLLExportStorageClass();
599599 GlobalVarSummary::GVarFlags VarFlags(CanBeInternalized, CanBeInternalized);
600 auto GVarSummary = llvm::make_unique(Flags, VarFlags,
600 auto GVarSummary = std::make_unique(Flags, VarFlags,
601601 RefEdges.takeVector());
602602 if (NonRenamableLocal)
603603 CantBePromoted.insert(V.getGUID());
615615 GlobalValueSummary::GVFlags Flags(A.getLinkage(), NonRenamableLocal,
616616 /* Live = */ false, A.isDSOLocal(),
617617 A.hasLinkOnceODRLinkage() && A.hasGlobalUnnamedAddr());
618 auto AS = llvm::make_unique(Flags);
618 auto AS = std::make_unique(Flags);
619619 auto *Aliasee = A.getBaseObject();
620620 auto AliaseeVI = Index.getValueInfo(Aliasee->getGUID());
621621 assert(AliaseeVI && "Alias expects aliasee summary to be available");
695695 // Create the appropriate summary type.
696696 if (Function *F = dyn_cast(GV)) {
697697 std::unique_ptr Summary =
698 llvm::make_unique(
698 std::make_unique(
699699 GVFlags, /*InstCount=*/0,
700700 FunctionSummary::FFlags{
701701 F->hasFnAttribute(Attribute::ReadNone),
713713 Index.addGlobalValueSummary(*GV, std::move(Summary));
714714 } else {
715715 std::unique_ptr Summary =
716 llvm::make_unique(
716 std::make_unique(
717717 GVFlags, GlobalVarSummary::GVarFlags(false, false),
718718 ArrayRef{});
719719 Index.addGlobalValueSummary(*GV, std::move(Summary));
740740 else if (F.hasProfileData()) {
741741 LoopInfo LI{DT};
742742 BranchProbabilityInfo BPI{F, LI};
743 BFIPtr = llvm::make_unique(F, BPI, LI);
743 BFIPtr = std::make_unique(F, BPI, LI);
744744 BFI = BFIPtr.get();
745745 }
746746
3838 BPI.calculate(*F, LI);
3939
4040 // Finally compute BFI.
41 OwnedBFI = llvm::make_unique(*F, BPI, LI);
41 OwnedBFI = std::make_unique(*F, BPI, LI);
4242 BFI = OwnedBFI.get();
4343 }
4444
9696 else
9797 BFI = nullptr;
9898
99 ORE = llvm::make_unique(&Fn, BFI);
99 ORE = std::make_unique(&Fn, BFI);
100100 return false;
101101 }
102102
2020 const BasicBlock *IBB = InstA->getParent();
2121 auto OBB = OBBMap.find(IBB);
2222 if (OBB == OBBMap.end())
23 OBB = OBBMap.insert({IBB, make_unique(IBB)}).first;
23 OBB = OBBMap.insert({IBB, std::make_unique(IBB)}).first;
2424 return OBB->second->dominates(InstA, InstB);
2525 }
2626
31063106 ParseToken(lltok::rbrace, "expected end of struct constant"))
31073107 return true;
31083108
3109 ID.ConstantStructElts = make_unique(Elts.size());
3109 ID.ConstantStructElts = std::make_unique(Elts.size());
31103110 ID.UIntVal = Elts.size();
31113111 memcpy(ID.ConstantStructElts.get(), Elts.data(),
31123112 Elts.size() * sizeof(Elts[0]));
31283128 return true;
31293129
31303130 if (isPackedStruct) {
3131 ID.ConstantStructElts = make_unique(Elts.size());
3131 ID.ConstantStructElts = std::make_unique(Elts.size());
31323132 memcpy(ID.ConstantStructElts.get(), Elts.data(),
31333133 Elts.size() * sizeof(Elts[0]));
31343134 ID.UIntVal = Elts.size();
80878087 if (ParseToken(lltok::rparen, "expected ')' here"))
80888088 return true;
80898089
8090 auto FS = llvm::make_unique(
8090 auto FS = std::make_unique(
80918091 GVFlags, InstCount, FFlags, /*EntryCount=*/0, std::move(Refs),
80928092 std::move(Calls), std::move(TypeIdInfo.TypeTests),
80938093 std::move(TypeIdInfo.TypeTestAssumeVCalls),
81478147 return true;
81488148
81498149 auto GS =
8150 llvm::make_unique(GVFlags, GVarFlags, std::move(Refs));
8150 std::make_unique(GVFlags, GVarFlags, std::move(Refs));
81518151
81528152 GS->setModulePath(ModulePath);
81538153 GS->setVTableFuncs(std::move(VTableFuncs));
81888188 if (ParseToken(lltok::rparen, "expected ')' here"))
81898189 return true;
81908190
8191 auto AS = llvm::make_unique(GVFlags);
8191 auto AS = std::make_unique(GVFlags);
81928192
81938193 AS->setModulePath(ModulePath);
81948194
4141 SlotMapping *Slots, bool UpgradeDebugInfo,
4242 StringRef DataLayoutString) {
4343 std::unique_ptr M =
44 make_unique(F.getBufferIdentifier(), Context);
44 std::make_unique(F.getBufferIdentifier(), Context);
4545
4646 if (parseAssemblyInto(F, M.get(), nullptr, Err, Slots, UpgradeDebugInfo,
4747 DataLayoutString))
7070 MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
7171 SlotMapping *Slots, bool UpgradeDebugInfo, StringRef DataLayoutString) {
7272 std::unique_ptr M =
73 make_unique(F.getBufferIdentifier(), Context);
73 std::make_unique(F.getBufferIdentifier(), Context);
7474 std::unique_ptr Index =
75 make_unique(/*HaveGVs=*/true);
75 std::make_unique(/*HaveGVs=*/true);
7676
7777 if (parseAssemblyInto(F, M.get(), Index.get(), Err, Slots, UpgradeDebugInfo,
7878 DataLayoutString))
122122 std::unique_ptr
123123 llvm::parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err) {
124124 std::unique_ptr Index =
125 make_unique(/*HaveGVs=*/false);
125 std::make_unique(/*HaveGVs=*/false);
126126
127127 if (parseSummaryIndexAssemblyInto(F, *Index, Err))
128128 return nullptr;
58735873 ArrayRef(Record).slice(CallGraphEdgeStartIndex),
58745874 IsOldProfileFormat, HasProfile, HasRelBF);
58755875 setSpecialRefs(Refs, NumRORefs, NumWORefs);
5876 auto FS = llvm::make_unique(
5876 auto FS = std::make_unique(
58775877 Flags, InstCount, getDecodedFFlags(RawFunFlags), /*EntryCount=*/0,
58785878 std::move(Refs), std::move(Calls), std::move(PendingTypeTests),
58795879 std::move(PendingTypeTestAssumeVCalls),
58995899 uint64_t RawFlags = Record[1];
59005900 unsigned AliaseeID = Record[2];
59015901 auto Flags = getDecodedGVSummaryFlags(RawFlags, Version);
5902 auto AS = llvm::make_unique(Flags);
5902 auto AS = std::make_unique(Flags);
59035903 // The module path string ref set in the summary must be owned by the
59045904 // index's module string table. Since we don't have a module path
59055905 // string table section in the per-module index, we create a single
59335933 std::vector Refs =
59345934 makeRefList(ArrayRef(Record).slice(RefArrayStart));
59355935 auto FS =
5936 llvm::make_unique(Flags, GVF, std::move(Refs));
5936 std::make_unique(Flags, GVF, std::move(Refs));
59375937 FS->setModulePath(getThisModule()->first());
59385938 auto GUID = getValueInfoFromValueId(ValueID);
59395939 FS->setOriginalName(GUID.second);
59605960 VTableFuncs.push_back({Callee, Offset});
59615961 }
59625962 auto VS =
5963 llvm::make_unique(Flags, GVF, std::move(Refs));
5963 std::make_unique(Flags, GVF, std::move(Refs));
59645964 VS->setModulePath(getThisModule()->first());
59655965 VS->setVTableFuncs(VTableFuncs);
59665966 auto GUID = getValueInfoFromValueId(ValueID);
60186018 IsOldProfileFormat, HasProfile, false);
60196019 ValueInfo VI = getValueInfoFromValueId(ValueID).first;
60206020 setSpecialRefs(Refs, NumRORefs, NumWORefs);
6021 auto FS = llvm::make_unique(
6021 auto FS = std::make_unique(
60226022 Flags, InstCount, getDecodedFFlags(RawFunFlags), EntryCount,
60236023 std::move(Refs), std::move(Edges), std::move(PendingTypeTests),
60246024 std::move(PendingTypeTestAssumeVCalls),
60456045 uint64_t RawFlags = Record[2];
60466046 unsigned AliaseeValueId = Record[3];
60476047 auto Flags = getDecodedGVSummaryFlags(RawFlags, Version);
6048 auto AS = llvm::make_unique(Flags);
6048 auto AS = std::make_unique(Flags);
60496049 LastSeenSummary = AS.get();
60506050 AS->setModulePath(ModuleIdMap[ModuleId]);
60516051
60746074 std::vector Refs =
60756075 makeRefList(ArrayRef(Record).slice(RefArrayStart));
60766076 auto FS =
6077 llvm::make_unique(Flags, GVF, std::move(Refs));
6077 std::make_unique(Flags, GVF, std::move(Refs));
60786078 LastSeenSummary = FS.get();
60796079 FS->setModulePath(ModuleIdMap[ModuleId]);
60806080 ValueInfo VI = getValueInfoFromValueId(ValueID).first;
64376437 Context);
64386438
64396439 std::unique_ptr M =
6440 llvm::make_unique(ModuleIdentifier, Context);
6440 std::make_unique(ModuleIdentifier, Context);
64416441 M->setMaterializer(R);
64426442
64436443 // Delay parsing Metadata if ShouldLazyLoadMetadata is true.
64846484 if (Error JumpFailed = Stream.JumpToBit(ModuleBit))
64856485 return std::move(JumpFailed);
64866486
6487 auto Index = llvm::make_unique(/*HaveGVs=*/false);
6487 auto Index = std::make_unique(/*HaveGVs=*/false);
64886488 ModuleSummaryIndexBitcodeReader R(std::move(Stream), Strtab, *Index,
64896489 ModuleIdentifier, 0);
64906490
21322132 BitcodeReaderValueList &ValueList,
21332133 bool IsImporting,
21342134 std::function getTypeByID)
2135 : Pimpl(llvm::make_unique(
2135 : Pimpl(std::make_unique(
21362136 Stream, TheModule, ValueList, std::move(getTypeByID), IsImporting)) {}
21372137
21382138 Error MetadataLoader::parseMetadata(bool ModuleLevel) {
310310 if (MAI->doesSupportDebugInformation()) {
311311 bool EmitCodeView = MMI->getModule()->getCodeViewFlag();
312312 if (EmitCodeView && TM.getTargetTriple().isOSWindows()) {
313 Handlers.emplace_back(llvm::make_unique(this),
313 Handlers.emplace_back(std::make_unique(this),
314314 DbgTimerName, DbgTimerDescription,
315315 CodeViewLineTablesGroupName,
316316 CodeViewLineTablesGroupDescription);
379379
380380 if (mdconst::extract_or_null(
381381 MMI->getModule()->getModuleFlag("cfguardtable")))
382 Handlers.emplace_back(llvm::make_unique(this), CFGuardName,
382 Handlers.emplace_back(std::make_unique(this), CFGuardName,
383383 CFGuardDescription, DWARFGroupName,
384384 DWARFGroupDescription);
385385
10241024 // Get MachineDominatorTree or compute it on the fly if it's unavailable
10251025 MDT = getAnalysisIfAvailable();
10261026 if (!MDT) {
1027 OwnedMDT = make_unique();
1027 OwnedMDT = std::make_unique();
10281028 OwnedMDT->getBase().recalculate(*MF);
10291029 MDT = OwnedMDT.get();
10301030 }
10321032 // Get MachineLoopInfo or compute it on the fly if it's unavailable
10331033 MLI = getAnalysisIfAvailable();
10341034 if (!MLI) {
1035 OwnedMLI = make_unique();
1035 OwnedMLI = std::make_unique();
10361036 OwnedMLI->getBase().analyze(MDT->getBase());
10371037 MLI = OwnedMLI.get();
10381038 }
7171 unsigned AsmPrinter::addInlineAsmDiagBuffer(StringRef AsmStr,
7272 const MDNode *LocMDNode) const {
7373 if (!DiagInfo) {
74 DiagInfo = make_unique();
74 DiagInfo = std::make_unique();
7575
7676 MCContext &Context = MMI->getContext();
7777 Context.setInlineSourceManager(&DiagInfo->SrcMgr);
647647
648648 if (OS.isVerboseAsm()) {
649649 // To construct block comment describing the type record for readability.
650 SP = llvm::make_unique(CommentOS);
650 SP = std::make_unique(CommentOS);
651651 SP->setPrefix(CommentPrefix);
652 TDV = llvm::make_unique(Table, SP.get(), false);
652 TDV = std::make_unique(Table, SP.get(), false);
653653 Pipeline.addCallbackToPipeline(*TDV);
654654 }
655655
13621362 const TargetRegisterInfo *TRI = TSI.getRegisterInfo();
13631363 const MachineFrameInfo &MFI = MF->getFrameInfo();
13641364 const Function &GV = MF->getFunction();
1365 auto Insertion = FnDebugInfo.insert({&GV, llvm::make_unique()});
1365 auto Insertion = FnDebugInfo.insert({&GV, std::make_unique()});
13661366 assert(Insertion.second && "function already has info");
13671367 CurFn = Insertion.first->second.get();
13681368 CurFn->FuncId = NextFuncId++;
30143014 auto Insertion = ScopeGlobals.insert(
30153015 {Scope, std::unique_ptr()});
30163016 if (Insertion.second)
3017 Insertion.first->second = llvm::make_unique();
3017 Insertion.first->second = std::make_unique();
30183018 VariableList = Insertion.first->second.get();
30193019 } else if (GV->hasComdat())
30203020 // Emit this global variable into a COMDAT section.
207207 if (!Loc) {
208208 addToAccelTable = true;
209209 Loc = new (DIEValueAllocator) DIELoc;
210 DwarfExpr = llvm::make_unique(*Asm, *this, *Loc);
210 DwarfExpr = std::make_unique(*Asm, *this, *Loc);
211211 }
212212
213213 if (Expr) {
10701070 assert(Scope && Scope->isAbstractScope());
10711071 auto &Entity = getAbstractEntities()[Node];
10721072 if (isa(Node)) {
1073 Entity = llvm::make_unique(
1073 Entity = std::make_unique(
10741074 cast(Node), nullptr /* IA */);;
10751075 DU->addScopeVariable(Scope, cast(Entity.get()));
10761076 } else if (isa(Node)) {
1077 Entity = llvm::make_unique(
1077 Entity = std::make_unique(
10781078 cast(Node), nullptr /* IA */);
10791079 DU->addScopeLabel(Scope, cast(Entity.get()));
10801080 }
278278 assert(getInlinedAt() == DbgValue->getDebugLoc()->getInlinedAt() &&
279279 "Wrong inlined-at");
280280
281 ValueLoc = llvm::make_unique(getDebugLocValue(DbgValue));
281 ValueLoc = std::make_unique(getDebugLocValue(DbgValue));
282282 if (auto *E = DbgValue->getDebugExpression())
283283 if (E->getNumElements())
284284 FrameIndexExprs.push_back({0, E});
863863
864864 CompilationDir = DIUnit->getDirectory();
865865
866 auto OwnedUnit = llvm::make_unique(
866 auto OwnedUnit = std::make_unique(
867867 InfoHolder.getUnits().size(), DIUnit, Asm, this, &InfoHolder);
868868 DwarfCompileUnit &NewCU = *OwnedUnit;
869869 InfoHolder.addUnit(std::move(OwnedUnit));
12881288 continue;
12891289
12901290 ensureAbstractEntityIsCreatedIfScoped(TheCU, Var.first, Scope->getScopeNode());
1291 auto RegVar = llvm::make_unique(
1291 auto RegVar = std::make_unique(
12921292 cast(Var.first), Var.second);
12931293 RegVar->initializeMMI(VI.Expr, VI.Slot);
12941294 if (DbgVariable *DbgVar = MFVars.lookup(Var))
14991499 ensureAbstractEntityIsCreatedIfScoped(TheCU, Node, Scope.getScopeNode());
15001500 if (isa(Node)) {
15011501 ConcreteEntities.push_back(
1502 llvm::make_unique(cast(Node),
1502 std::make_unique(cast(Node),
15031503 Location));
15041504 InfoHolder.addScopeVariable(&Scope,
15051505 cast(ConcreteEntities.back().get()));
15061506 } else if (isa(Node)) {
15071507 ConcreteEntities.push_back(
1508 llvm::make_unique(cast(Node),
1508 std::make_unique(cast(Node),
15091509 Location, Sym));
15101510 InfoHolder.addScopeLabel(&Scope,
15111511 cast(ConcreteEntities.back().get()));
28232823
28242824 DwarfCompileUnit &DwarfDebug::constructSkeletonCU(const DwarfCompileUnit &CU) {
28252825
2826 auto OwnedUnit = llvm::make_unique(
2826 auto OwnedUnit = std::make_unique(
28272827 CU.getUniqueID(), CU.getCUNode(), Asm, this, &SkeletonHolder);
28282828 DwarfCompileUnit &NewCU = *OwnedUnit;
28292829 NewCU.setSection(Asm->getObjFileLowering().getDwarfInfoSection());
29232923 bool TopLevelType = TypeUnitsUnderConstruction.empty();
29242924 AddrPool.resetUsedFlag();
29252925
2926 auto OwnedUnit = llvm::make_unique(CU, Asm, this, &InfoHolder,
2926 auto OwnedUnit = std::make_unique(CU, Asm, this, &InfoHolder,
29272927 getDwoLineTable(CU));
29282928 DwarfTypeUnit &NewTU = *OwnedUnit;
29292929 DIE &UnitDie = NewTU.getUnitDie();
152152 assert(!ValueLoc && "Already initialized?");
153153 assert(!Value.getExpression()->isFragment() && "Fragments not supported.");
154154
155 ValueLoc = llvm::make_unique(Value);
155 ValueLoc = std::make_unique(Value);
156156 if (auto *E = ValueLoc->getExpression())
157157 if (E->getNumElements())
158158 FrameIndexExprs.push_back({0, E});
343343 // Get the DominatorTree, building if necessary.
344344 DominatorTree &getDT(Function &F) {
345345 if (!DT)
346 DT = llvm::make_unique(F);
346 DT = std::make_unique(F);
347347 return *DT;
348348 }
349349
26792679
26802680 void TypePromotionTransaction::setOperand(Instruction *Inst, unsigned Idx,
26812681 Value *NewVal) {
2682 Actions.push_back(llvm::make_unique(
2682 Actions.push_back(std::make_unique(
26832683 Inst, Idx, NewVal));
26842684 }
26852685
26862686 void TypePromotionTransaction::eraseInstruction(Instruction *Inst,
26872687 Value *NewVal) {
26882688 Actions.push_back(
2689 llvm::make_unique(
2689 std::make_unique(
26902690 Inst, RemovedInsts, NewVal));
26912691 }
26922692
26932693 void TypePromotionTransaction::replaceAllUsesWith(Instruction *Inst,
26942694 Value *New) {
26952695 Actions.push_back(
2696 llvm::make_unique(Inst, New));
2696 std::make_unique(Inst, New));
26972697 }
26982698
26992699 void TypePromotionTransaction::mutateType(Instruction *Inst, Type *NewTy) {
27002700 Actions.push_back(
2701 llvm::make_unique(Inst, NewTy));
2701 std::make_unique(Inst, NewTy));
27022702 }
27032703
27042704 Value *TypePromotionTransaction::createTrunc(Instruction *Opnd,
27282728 void TypePromotionTransaction::moveBefore(Instruction *Inst,
27292729 Instruction *Before) {
27302730 Actions.push_back(
2731 llvm::make_unique(
2731 std::make_unique(
27322732 Inst, Before));
27332733 }
27342734