diff options
author | Lang Hames <lhames@gmail.com> | 2015-08-19 18:32:58 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2015-08-19 18:32:58 +0000 |
commit | 1356c7901a9edaaff445bd9a9eaa667cefbac043 (patch) | |
tree | 7639a292735420972ffbb973d825f1dcfd350f26 /examples/Kaleidoscope | |
parent | 4d554fb21dace91a02a37be0cd746e9b7dc5faaf (diff) |
[Kaleidoscope] More inter-chapter diff reduction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'examples/Kaleidoscope')
-rw-r--r-- | examples/Kaleidoscope/Chapter3/toy.cpp | 4 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter4/toy.cpp | 4 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter5/toy.cpp | 4 | ||||
-rw-r--r-- | examples/Kaleidoscope/Chapter6/toy.cpp | 1 |
4 files changed, 9 insertions, 4 deletions
diff --git a/examples/Kaleidoscope/Chapter3/toy.cpp b/examples/Kaleidoscope/Chapter3/toy.cpp index 29914aa0331..cb4f75f7917 100644 --- a/examples/Kaleidoscope/Chapter3/toy.cpp +++ b/examples/Kaleidoscope/Chapter3/toy.cpp @@ -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() { diff --git a/examples/Kaleidoscope/Chapter4/toy.cpp b/examples/Kaleidoscope/Chapter4/toy.cpp index eba0ab1f27d..9b0d2ecf67c 100644 --- a/examples/Kaleidoscope/Chapter4/toy.cpp +++ b/examples/Kaleidoscope/Chapter4/toy.cpp @@ -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() { diff --git a/examples/Kaleidoscope/Chapter5/toy.cpp b/examples/Kaleidoscope/Chapter5/toy.cpp index c191d61d562..da7a81c6776 100644 --- a/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/examples/Kaleidoscope/Chapter5/toy.cpp @@ -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() { diff --git a/examples/Kaleidoscope/Chapter6/toy.cpp b/examples/Kaleidoscope/Chapter6/toy.cpp index 87048bb2da4..b4e8397e9e6 100644 --- a/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/examples/Kaleidoscope/Chapter6/toy.cpp @@ -626,7 +626,6 @@ Value *VariableExprAST::Codegen() { Value *V = NamedValues[Name]; if (!V) return ErrorV("Unknown variable name"); - return V; } |