diff options
Diffstat (limited to 'llvm/examples/Kaleidoscope')
| -rw-r--r-- | llvm/examples/Kaleidoscope/Chapter3/toy.cpp | 4 | ||||
| -rw-r--r-- | llvm/examples/Kaleidoscope/Chapter4/toy.cpp | 4 | ||||
| -rw-r--r-- | llvm/examples/Kaleidoscope/Chapter5/toy.cpp | 4 | ||||
| -rw-r--r-- | llvm/examples/Kaleidoscope/Chapter6/toy.cpp | 1 |
4 files changed, 9 insertions, 4 deletions
diff --git a/llvm/examples/Kaleidoscope/Chapter3/toy.cpp b/llvm/examples/Kaleidoscope/Chapter3/toy.cpp index 29914aa0331..cb4f75f7917 100644 --- a/llvm/examples/Kaleidoscope/Chapter3/toy.cpp +++ b/llvm/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/llvm/examples/Kaleidoscope/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp index eba0ab1f27d..9b0d2ecf67c 100644 --- a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp +++ b/llvm/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/llvm/examples/Kaleidoscope/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp index c191d61d562..da7a81c6776 100644 --- a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/llvm/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/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp index 87048bb2da4..b4e8397e9e6 100644 --- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/llvm/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; } |

