LastChar = getchar();
} while (isdigit(LastChar) || LastChar == '.');
- NumVal = strtod(NumStr.c_str(), 0);
+ NumVal = strtod(NumStr.c_str(), nullptr);
return tok_number;
}
return ErrorU<ForExprAST>("expected '=' after for");
getNextToken(); // eat '='.
-
auto Start = ParseExpression();
if (!Start)
return nullptr;
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());
}
// 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.
// Special case '=' because we don't want to emit the LHS as an expression.
if (Op == '=') {
// Assignment requires the LHS to be an identifier.
- auto LHSVar = static_cast<VariableExprAST&>(*LHS);
+ auto &LHSVar = static_cast<VariableExprAST &>(*LHS);
// Codegen the RHS.
Value *Val = RHS->IRGen(C);
if (!Val) return nullptr;
// 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.
else
C.NamedValues.erase(VarName);
-
// for expr always returns 0.0.
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
}
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);