diff options
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter2/toy.cpp')
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter2/toy.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter2/toy.cpp b/llvm/examples/Kaleidoscope/Chapter2/toy.cpp index 69f35996129..24cb424c985 100644 --- a/llvm/examples/Kaleidoscope/Chapter2/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter2/toy.cpp @@ -187,13 +187,13 @@ static int GetTokPrecedence() { return TokPrec; } -/// Error* - These are little helper functions for error handling. -std::unique_ptr<ExprAST> Error(const char *Str) { +/// LogError* - These are little helper functions for error handling. +std::unique_ptr<ExprAST> LogError(const char *Str) { fprintf(stderr, "Error: %s\n", Str); return nullptr; } -std::unique_ptr<PrototypeAST> ErrorP(const char *Str) { - Error(Str); +std::unique_ptr<PrototypeAST> LogErrorP(const char *Str) { + LogError(Str); return nullptr; } @@ -214,7 +214,7 @@ static std::unique_ptr<ExprAST> ParseParenExpr() { return nullptr; if (CurTok != ')') - return Error("expected ')'"); + return LogError("expected ')'"); getNextToken(); // eat ). return V; } @@ -244,7 +244,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { break; if (CurTok != ',') - return Error("Expected ')' or ',' in argument list"); + return LogError("Expected ')' or ',' in argument list"); getNextToken(); } } @@ -262,7 +262,7 @@ static std::unique_ptr<ExprAST> ParseIdentifierExpr() { static std::unique_ptr<ExprAST> ParsePrimary() { switch (CurTok) { default: - return Error("unknown token when expecting an expression"); + return LogError("unknown token when expecting an expression"); case tok_identifier: return ParseIdentifierExpr(); case tok_number: @@ -324,19 +324,19 @@ static std::unique_ptr<ExprAST> ParseExpression() { /// ::= id '(' id* ')' static std::unique_ptr<PrototypeAST> ParsePrototype() { if (CurTok != tok_identifier) - return ErrorP("Expected function name in prototype"); + return LogErrorP("Expected function name in prototype"); std::string FnName = IdentifierStr; getNextToken(); if (CurTok != '(') - return ErrorP("Expected '(' in prototype"); + return LogErrorP("Expected '(' in prototype"); std::vector<std::string> ArgNames; while (getNextToken() == tok_identifier) ArgNames.push_back(IdentifierStr); if (CurTok != ')') - return ErrorP("Expected ')' in prototype"); + return LogErrorP("Expected ')' in prototype"); // success. getNextToken(); // eat ')'. |