diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-06-07 19:03:35 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-06-07 19:03:35 +0800 |
| commit | 07c2f96ae65f962150610cd9dad35da0ed88ce04 (patch) | |
| tree | be4908bba91e07a4f35987704085f9a8bd5a245a | |
| parent | d5d3e8797f5dd8c52b01f497a8ef3e75062de08a (diff) | |
fix syntax
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | node/StatementNode.cc | 6 |
2 files changed, 4 insertions, 4 deletions
@@ -55,7 +55,7 @@ Then you need to link the object file qsort.o by your host-compiler. See ssl.pas and extern.pas. -For the `scanf` case, the `scanf` may be a marco in C like `__isoc99_scanf`, so you may need to wrap the scanf function, see common.pas. +For the `scanf` case, the `scanf` may be a marco in C like `__isoc99_scanf`, so you may need to wrap the scanf function, see common.c. #### calling pascal functions from C diff --git a/node/StatementNode.cc b/node/StatementNode.cc index adce4f0..183bd0f 100644 --- a/node/StatementNode.cc +++ b/node/StatementNode.cc @@ -324,7 +324,7 @@ Value SwitchStatementNode::CodeGen() { : llvm::BasicBlock::Create(GlobalLLVMContext, "default")); llvm::SwitchInst* inst = builder->CreateSwitch(SwitchValue, DefaultBlock, CasePairs_.size() + 1); - std::shared_ptr<BaseNode> PrevAcion = nullptr; + std::shared_ptr<BaseNode> PrevAction = nullptr; llvm::BasicBlock* PrevBlock = nullptr; for (auto&& CaseChild : CasePairs_) { llvm::Value* CaseValue = std::get<0>(CaseChild)->CodeGen(); @@ -342,7 +342,7 @@ Value SwitchStatementNode::CodeGen() { CaseValue = builder->CreateSExtOrTrunc(CaseValue, type->GetLLVMType()); llvm::ConstantInt* CaseConst = llvm::cast<llvm::ConstantInt>(CaseValue); std::shared_ptr<BaseNode> CaseAction = std::get<1>(CaseChild); - if (CaseAction == PrevAcion) { + if (CaseAction == PrevAction) { inst->addCase(CaseConst, PrevBlock); } else { llvm::BasicBlock* CaseBlock = @@ -351,7 +351,7 @@ Value SwitchStatementNode::CodeGen() { builder->SetInsertPoint(CaseBlock); CaseAction->CodeGen(); builder->CreateBr(EndBlock); - PrevAcion = CaseAction, PrevBlock = CaseBlock; + PrevAction = CaseAction, PrevBlock = CaseBlock; } } if (DefaultAction_ != nullptr) { |
