diff options
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter2/toy.cpp')
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter2/toy.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter2/toy.cpp b/llvm/examples/Kaleidoscope/Chapter2/toy.cpp index 24cb424c985..31a998faadc 100644 --- a/llvm/examples/Kaleidoscope/Chapter2/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter2/toy.cpp @@ -1,5 +1,6 @@ #include <cctype> #include <cstdio> +#include <cstdlib> #include <map> #include <memory> #include <string> @@ -15,7 +16,7 @@ static make_unique(Args &&... args) { return std::unique_ptr<T>(new T(std::forward<Args>(args)...)); } -} +} // end namespace helper //===----------------------------------------------------------------------===// // Lexer @@ -234,7 +235,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { getNextToken(); // eat ( std::vector<std::unique_ptr<ExprAST>> Args; if (CurTok != ')') { - while (1) { + while (true) { if (auto Arg = ParseExpression()) Args.push_back(std::move(Arg)); else @@ -277,7 +278,7 @@ static std::unique_ptr<ExprAST> ParsePrimary() { static std::unique_ptr<ExprAST> ParseBinOpRHS(int ExprPrec, std::unique_ptr<ExprAST> LHS) { // If this is a binop, find its precedence. - while (1) { + while (true) { int TokPrec = GetTokPrecedence(); // If this is a binop that binds at least as tightly as the current binop, @@ -407,7 +408,7 @@ static void HandleTopLevelExpression() { /// top ::= definition | external | expression | ';' static void MainLoop() { - while (1) { + while (true) { fprintf(stderr, "ready> "); switch (CurTok) { case tok_eof: |