[Kaleidoscope] More inter-chapter diff reduction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245474 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2015-08-19 18:32:58 +00:00
parent 4d554fb21d
commit 1356c7901a
5 changed files with 12 additions and 5 deletions

View File

@ -131,7 +131,9 @@ are all uniqued together and shared. For this reason, the API uses the
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

View File

@ -398,7 +398,9 @@ Value *NumberExprAST::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() {

View File

@ -642,7 +642,9 @@ Value *NumberExprAST::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() {

View File

@ -532,7 +532,9 @@ Value *NumberExprAST::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() {

View File

@ -626,7 +626,6 @@ Value *VariableExprAST::Codegen() {
Value *V = NamedValues[Name];
if (!V)
return ErrorV("Unknown variable name");
return V;
}