summaryrefslogtreecommitdiffstats
path: root/llvm/docs/tutorial/MyFirstLanguageFrontend
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-08-15 15:54:37 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-08-15 15:54:37 +0000
commit0eaee545eef49ff9498234d3a51a5cbde59bf976 (patch)
treefd7691e102022fb97622c5485fa8c4f506fc124e /llvm/docs/tutorial/MyFirstLanguageFrontend
parent1c34d10776828c0756ff4f0b2b9aa8bda2be348a (diff)
downloadbcm5719-llvm-0eaee545eef49ff9498234d3a51a5cbde59bf976.tar.gz
bcm5719-llvm-0eaee545eef49ff9498234d3a51a5cbde59bf976.zip
[llvm] Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. llvm-svn: 369013
Diffstat (limited to 'llvm/docs/tutorial/MyFirstLanguageFrontend')
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst22
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst10
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst4
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl06.rst4
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst2
-rw-r--r--llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.rst6
6 files changed, 24 insertions, 24 deletions
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
index 3a2680099df..dec9f36ed56 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
@@ -155,8 +155,8 @@ be generated with calls like this:
.. code-block:: c++
- auto LHS = llvm::make_unique<VariableExprAST>("x");
- auto RHS = llvm::make_unique<VariableExprAST>("y");
+ auto LHS = std::make_unique<VariableExprAST>("x");
+ auto RHS = std::make_unique<VariableExprAST>("y");
auto Result = std::make_unique<BinaryExprAST>('+', std::move(LHS),
std::move(RHS));
@@ -210,7 +210,7 @@ which parses that production. For numeric literals, we have:
/// numberexpr ::= number
static std::unique_ptr<ExprAST> ParseNumberExpr() {
- auto Result = llvm::make_unique<NumberExprAST>(NumVal);
+ auto Result = std::make_unique<NumberExprAST>(NumVal);
getNextToken(); // consume the number
return std::move(Result);
}
@@ -276,7 +276,7 @@ function calls:
getNextToken(); // eat identifier.
if (CurTok != '(') // Simple variable ref.
- return llvm::make_unique<VariableExprAST>(IdName);
+ return std::make_unique<VariableExprAST>(IdName);
// Call.
getNextToken(); // eat (
@@ -300,7 +300,7 @@ function calls:
// Eat the ')'.
getNextToken();
- return llvm::make_unique<CallExprAST>(IdName, std::move(Args));
+ return std::make_unique<CallExprAST>(IdName, std::move(Args));
}
This routine follows the same style as the other routines. (It expects
@@ -503,7 +503,7 @@ then continue parsing:
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
+ LHS = std::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
std::move(RHS));
} // loop around to the top of the while loop.
}
@@ -533,7 +533,7 @@ above two blocks duplicated for context):
return nullptr;
}
// Merge LHS/RHS.
- LHS = llvm::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
+ LHS = std::make_unique<BinaryExprAST>(BinOp, std::move(LHS),
std::move(RHS));
} // loop around to the top of the while loop.
}
@@ -593,7 +593,7 @@ expressions):
// success.
getNextToken(); // eat ')'.
- return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
+ return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames));
}
Given this, a function definition is very simple, just a prototype plus
@@ -608,7 +608,7 @@ an expression to implement the body:
if (!Proto) return nullptr;
if (auto E = ParseExpression())
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
return nullptr;
}
@@ -634,8 +634,8 @@ nullary (zero argument) functions for them:
static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
if (auto E = ParseExpression()) {
// Make an anonymous proto.
- auto Proto = llvm::make_unique<PrototypeAST>("", std::vector<std::string>());
- return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
+ auto Proto = std::make_unique<PrototypeAST>("", std::vector<std::string>());
+ return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
}
return nullptr;
}
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
index 773ce55eca0..f5a46a68fcf 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl04.rst
@@ -141,10 +141,10 @@ for us:
void InitializeModuleAndPassManager(void) {
// Open a new module.
- TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
+ TheModule = std::make_unique<Module>("my cool jit", TheContext);
// Create a new pass manager attached to it.
- TheFPM = llvm::make_unique<FunctionPassManager>(TheModule.get());
+ TheFPM = std::make_unique<FunctionPassManager>(TheModule.get());
// Do simple "peephole" optimizations and bit-twiddling optzns.
TheFPM->add(createInstructionCombiningPass());
@@ -259,7 +259,7 @@ adding a global variable ``TheJIT``, and initializing it in
fprintf(stderr, "ready> ");
getNextToken();
- TheJIT = llvm::make_unique<KaleidoscopeJIT>();
+ TheJIT = std::make_unique<KaleidoscopeJIT>();
// Run the main "interpreter loop" now.
MainLoop();
@@ -273,11 +273,11 @@ We also need to setup the data layout for the JIT:
void InitializeModuleAndPassManager(void) {
// Open a new module.
- TheModule = llvm::make_unique<Module>("my cool jit", TheContext);
+ TheModule = std::make_unique<Module>("my cool jit", TheContext);
TheModule->setDataLayout(TheJIT->getTargetMachine().createDataLayout());
// Create a new pass manager attached to it.
- TheFPM = llvm::make_unique<FunctionPassManager>(TheModule.get());
+ TheFPM = std::make_unique<FunctionPassManager>(TheModule.get());
...
The KaleidoscopeJIT class is a simple JIT built specifically for these
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst
index 685e5fb69e4..0e61c07659d 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl05.rst
@@ -146,7 +146,7 @@ First we define a new parsing function:
if (!Else)
return nullptr;
- return llvm::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
+ return std::make_unique<IfExprAST>(std::move(Cond), std::move(Then),
std::move(Else));
}
@@ -560,7 +560,7 @@ value to null in the AST node:
if (!Body)
return nullptr;
- return llvm::make_unique<ForExprAST>(IdName, std::move(Start),
+ return std::make_unique<ForExprAST>(IdName, std::move(Start),
std::move(End), std::move(Step),
std::move(Body));
}
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl06.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl06.rst
index 911a7dc92bc..a05ed0b1a3b 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl06.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl06.rst
@@ -220,7 +220,7 @@ user-defined operator, we need to parse it:
if (Kind && ArgNames.size() != Kind)
return LogErrorP("Invalid number of operands for operator");
- return llvm::make_unique<PrototypeAST>(FnName, std::move(ArgNames), Kind != 0,
+ return std::make_unique<PrototypeAST>(FnName, std::move(ArgNames), Kind != 0,
BinaryPrecedence);
}
@@ -348,7 +348,7 @@ simple: we'll add a new function to do it:
int Opc = CurTok;
getNextToken();
if (auto Operand = ParseUnary())
- return llvm::make_unique<UnaryExprAST>(Opc, std::move(Operand));
+ return std::make_unique<UnaryExprAST>(Opc, std::move(Operand));
return nullptr;
}
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
index 8013dec326a..218e4419135 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl07.rst
@@ -780,7 +780,7 @@ AST node:
if (!Body)
return nullptr;
- return llvm::make_unique<VarExprAST>(std::move(VarNames),
+ return std::make_unique<VarExprAST>(std::move(VarNames),
std::move(Body));
}
diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.rst
index 1dcc0a8aa90..87584cdb394 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl09.rst
@@ -77,8 +77,8 @@ statement be our "main":
.. code-block:: udiff
- - auto Proto = llvm::make_unique<PrototypeAST>("", std::vector<std::string>());
- + auto Proto = llvm::make_unique<PrototypeAST>("main", std::vector<std::string>());
+ - auto Proto = std::make_unique<PrototypeAST>("", std::vector<std::string>());
+ + auto Proto = std::make_unique<PrototypeAST>("main", std::vector<std::string>());
just with the simple change of giving it a name.
@@ -325,7 +325,7 @@ that we pass down through when we create a new expression:
.. code-block:: c++
- LHS = llvm::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS),
+ LHS = std::make_unique<BinaryExprAST>(BinLoc, BinOp, std::move(LHS),
std::move(RHS));
giving us locations for each of our expressions and variables.
OpenPOWER on IntegriCloud