diff options
Diffstat (limited to 'llvm/docs/tutorial/LangImpl3.rst')
-rw-r--r-- | llvm/docs/tutorial/LangImpl3.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/docs/tutorial/LangImpl3.rst b/llvm/docs/tutorial/LangImpl3.rst index 83ad35f14ae..89ecee9d729 100644 --- a/llvm/docs/tutorial/LangImpl3.rst +++ b/llvm/docs/tutorial/LangImpl3.rst @@ -67,7 +67,7 @@ way to model this. Again, this tutorial won't dwell on good software engineering practices: for our purposes, adding a virtual method is simplest. -The second thing we want is an "Error" method like we used for the +The second thing we want is an "LogError" method like we used for the parser, which will be used to report errors found during code generation (for example, use of an undeclared parameter): @@ -77,8 +77,8 @@ parser, which will be used to report errors found during code generation static IRBuilder<> Builder(getGlobalContext()); static std::map<std::string, Value*> NamedValues; - Value *ErrorV(const char *Str) { - Error(Str); + Value *LogErrorV(const char *Str) { + LogError(Str); return nullptr; } @@ -133,7 +133,7 @@ are all uniqued together and shared. For this reason, the API uses the // Look this variable up in the function. Value *V = NamedValues[Name]; if (!V) - ErrorV("Unknown variable name"); + LogErrorV("Unknown variable name"); return V; } @@ -168,7 +168,7 @@ variables <LangImpl7.html#user-defined-local-variables>`_. return Builder.CreateUIToFP(L, Type::getDoubleTy(getGlobalContext()), "booltmp"); default: - return ErrorV("invalid binary operator"); + return LogErrorV("invalid binary operator"); } } @@ -214,11 +214,11 @@ would return 0.0 and -1.0, depending on the input value. // Look up the name in the global module table. Function *CalleeF = TheModule->getFunction(Callee); if (!CalleeF) - return ErrorV("Unknown function referenced"); + return LogErrorV("Unknown function referenced"); // If argument mismatch error. if (CalleeF->arg_size() != Args.size()) - return ErrorV("Incorrect # arguments passed"); + return LogErrorV("Incorrect # arguments passed"); std::vector<Value *> ArgsV; for (unsigned i = 0, e = Args.size(); i != e; ++i) { @@ -328,7 +328,7 @@ codegen and attach a function body. return nullptr; if (!TheFunction->empty()) - return (Function*)ErrorV("Function cannot be redefined."); + return (Function*)LogErrorV("Function cannot be redefined."); For function definitions, we start by searching TheModule's symbol table for an |