diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-09-29 18:02:48 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-09-29 18:02:48 +0000 |
commit | cc9deb48019f7e5faf401070aa417b0ead871fd6 (patch) | |
tree | 06e64c09dde0052a10e50542c3840643e723a913 /llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp | |
parent | 410a25aa7a093ee9f6de4d12e1f8aaa1cf9c0e81 (diff) | |
download | bcm5719-llvm-cc9deb48019f7e5faf401070aa417b0ead871fd6.tar.gz bcm5719-llvm-cc9deb48019f7e5faf401070aa417b0ead871fd6.zip |
Fix Clang-tidy modernize-use-nullptr warnings in examples and include directories; other minor cleanups.
Patch by Eugene Zelenko!
Differential Revision: http://reviews.llvm.org/D13172
llvm-svn: 248811
Diffstat (limited to 'llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp')
-rw-r--r-- | llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp b/llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp index 7e5b38cafe7..667bca46afd 100644 --- a/llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp +++ b/llvm/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp @@ -87,7 +87,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; } @@ -387,7 +387,6 @@ static std::unique_ptr<ForExprAST> ParseForExpr() { return ErrorU<ForExprAST>("expected '=' after for"); getNextToken(); // eat '='. - auto Start = ParseExpression(); if (!Start) return nullptr; @@ -748,7 +747,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()); } @@ -760,7 +759,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<Value>("Unknown variable name '" + Name + "'"); // Load the value. @@ -960,7 +959,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. @@ -988,7 +987,6 @@ Value *ForExprAST::IRGen(IRGenContext &C) const { else C.NamedValues.erase(VarName); - // for expr always returns 0.0. return Constant::getNullValue(Type::getDoubleTy(getGlobalContext())); } @@ -1236,7 +1234,7 @@ private: RuntimeDyld::SymbolInfo searchFunctionASTs(const std::string &Name) { auto DefI = FunctionDefs.find(Name); if (DefI == FunctionDefs.end()) - return 0; + return nullptr; // Return the address of the stub. // Take the FunctionAST out of the map. |