Value *VariableExprAST::Codegen() {
// Look this variable up in the function.
Value *V = NamedValues[Name];
- return V ? V : ErrorV("Unknown variable name");
+ if (!V)
+ ErrorV("Unknown variable name");
+ return V;
}
References to variables are also quite simple using LLVM. In the simple
Value *VariableExprAST::Codegen() {
// Look this variable up in the function.
Value *V = NamedValues[Name];
- return V ? V : ErrorV("Unknown variable name");
+ if (!V)
+ return ErrorV("Unknown variable name");
+ return V;
}
Value *BinaryExprAST::Codegen() {
Value *VariableExprAST::Codegen() {
// Look this variable up in the function.
Value *V = NamedValues[Name];
- return V ? V : ErrorV("Unknown variable name");
+ if (!V)
+ return ErrorV("Unknown variable name");
+ return V;
}
Value *BinaryExprAST::Codegen() {
Value *VariableExprAST::Codegen() {
// Look this variable up in the function.
Value *V = NamedValues[Name];
- return V ? V : ErrorV("Unknown variable name");
+ if (!V)
+ return ErrorV("Unknown variable name");
+ return V;
}
Value *BinaryExprAST::Codegen() {
Value *V = NamedValues[Name];
if (!V)
return ErrorV("Unknown variable name");
-
return V;
}