X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=examples%2FKaleidoscope%2FOrc%2Flazy_irgen%2Ftoy.cpp;h=f9b972e829488aaef42217c310085560a23db465;hb=d16725c31fbb40fcbf0cdf68b2b417ba445c5140;hp=a1779c7e1bf492da4f8c4ef67bd3a96726919c41;hpb=23662fba704e684f24d3114bb399c80d5c0afbd9;p=oota-llvm.git diff --git a/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp b/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp index a1779c7e1bf..f9b972e8294 100644 --- a/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp +++ b/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp @@ -86,7 +86,7 @@ static int gettok() { LastChar = getchar(); } while (isdigit(LastChar) || LastChar == '.'); - NumVal = strtod(NumStr.c_str(), 0); + NumVal = strtod(NumStr.c_str(), nullptr); return tok_number; } @@ -386,7 +386,6 @@ static std::unique_ptr ParseForExpr() { return ErrorU("expected '=' after for"); getNextToken(); // eat '='. - auto Start = ParseExpression(); if (!Start) return nullptr; @@ -747,7 +746,7 @@ static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction, const std::string &VarName) { IRBuilder<> TmpB(&TheFunction->getEntryBlock(), TheFunction->getEntryBlock().begin()); - return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0, + return TmpB.CreateAlloca(Type::getDoubleTy(getGlobalContext()), nullptr, VarName.c_str()); } @@ -759,7 +758,7 @@ Value *VariableExprAST::IRGen(IRGenContext &C) const { // Look this variable up in the function. Value *V = C.NamedValues[Name]; - if (V == 0) + if (!V) return ErrorP("Unknown variable name '" + Name + "'"); // Load the value. @@ -959,7 +958,7 @@ Value *ForExprAST::IRGen(IRGenContext &C) const { // Compute the end condition. Value *EndCond = End->IRGen(C); - if (EndCond == 0) return EndCond; + if (!EndCond) return nullptr; // Reload, increment, and restore the alloca. This handles the case where // the body of the loop mutates the variable. @@ -987,7 +986,6 @@ Value *ForExprAST::IRGen(IRGenContext &C) const { else C.NamedValues.erase(VarName); - // for expr always returns 0.0. return Constant::getNullValue(Type::getDoubleTy(getGlobalContext())); } @@ -1223,7 +1221,7 @@ private: RuntimeDyld::SymbolInfo searchFunctionASTs(const std::string &Name) { auto DefI = FunctionDefs.find(Name); if (DefI == FunctionDefs.end()) - return 0; + return nullptr; // Take the FunctionAST out of the map. auto FnAST = std::move(DefI->second);