[llvm] r245474 - [Kaleidoscope] More inter-chapter diff reduction.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 11:32:58 PDT 2015
Author: lhames
Date: Wed Aug 19 13:32:58 2015
New Revision: 245474
URL: http://llvm.org/viewvc/llvm-project?rev=245474&view=rev
Log:
[Kaleidoscope] More inter-chapter diff reduction.
Modified:
llvm/trunk/docs/tutorial/LangImpl3.rst
llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp
llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp
llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp
llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp
Modified: llvm/trunk/docs/tutorial/LangImpl3.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/LangImpl3.rst?rev=245474&r1=245473&r2=245474&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/LangImpl3.rst (original)
+++ llvm/trunk/docs/tutorial/LangImpl3.rst Wed Aug 19 13:32:58 2015
@@ -131,7 +131,9 @@ are all uniqued together and shared. For
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
Modified: llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp?rev=245474&r1=245473&r2=245474&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter3/toy.cpp Wed Aug 19 13:32:58 2015
@@ -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() {
Modified: llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp?rev=245474&r1=245473&r2=245474&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter4/toy.cpp Wed Aug 19 13:32:58 2015
@@ -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() {
Modified: llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp?rev=245474&r1=245473&r2=245474&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter5/toy.cpp Wed Aug 19 13:32:58 2015
@@ -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() {
Modified: llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp?rev=245474&r1=245473&r2=245474&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter6/toy.cpp Wed Aug 19 13:32:58 2015
@@ -626,7 +626,6 @@ Value *VariableExprAST::Codegen() {
Value *V = NamedValues[Name];
if (!V)
return ErrorV("Unknown variable name");
-
return V;
}
More information about the llvm-commits
mailing list