unsigned getBinaryPrecedence() const { return Precedence; }
- Function *Codegen();
+ Function *codegen();
};
Basically, in addition to knowing a name for the prototype, we now keep
.. code-block:: c++
- Value *BinaryExprAST::Codegen() {
- Value *L = LHS->Codegen();
- Value *R = RHS->Codegen();
+ Value *BinaryExprAST::codegen() {
+ Value *L = LHS->codegen();
+ Value *R = RHS->codegen();
if (!L || !R)
return nullptr;
.. code-block:: c++
- Function *FunctionAST::Codegen() {
+ Function *FunctionAST::codegen() {
NamedValues.clear();
- Function *TheFunction = Proto->Codegen();
+ Function *TheFunction = Proto->codegen();
if (!TheFunction)
return nullptr;
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
Builder.SetInsertPoint(BB);
- if (Value *RetVal = Body->Codegen()) {
+ if (Value *RetVal = Body->codegen()) {
...
Basically, before codegening a function, if it is a user-defined
public:
UnaryExprAST(char Opcode, std::unique_ptr<ExprAST> Operand)
: Opcode(Opcode), Operand(std::move(Operand)) {}
- virtual Value *Codegen();
+ virtual Value *codegen();
};
This AST node is very simple and obvious by now. It directly mirrors the
.. code-block:: c++
- Value *UnaryExprAST::Codegen() {
- Value *OperandV = Operand->Codegen();
+ Value *UnaryExprAST::codegen() {
+ Value *OperandV = Operand->codegen();
if (!OperandV)
return nullptr;