projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix Clang-tidy modernize-use-nullptr warnings in examples and include directories...
[oota-llvm.git]
/
examples
/
Kaleidoscope
/
Orc
/
lazy_codegen
/
toy.cpp
diff --git
a/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
b/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
index fc71849bebbaea101f901242ab978bf7505078c2..f5a6c19614b3a19975bc7dea5b4ff6edf46c1707 100644
(file)
--- a/
examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
+++ b/
examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
@@
-86,7
+86,7
@@
static int gettok() {
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(),
0
);
+ NumVal = strtod(NumStr.c_str(),
nullptr
);
return tok_number;
}
return tok_number;
}
@@
-386,7
+386,6
@@
static std::unique_ptr<ForExprAST> ParseForExpr() {
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
-
auto Start = ParseExpression();
if (!Start)
return nullptr;
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());
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());
}
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];
// 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.
return ErrorP<Value>("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);
// 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.
// 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);
else
C.NamedValues.erase(VarName);
-
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}